Java SQL ResultSet Blob Read readBlobUTF16BinaryStream(ResultSet rs, String fieldName)

Here you can find the source of readBlobUTF16BinaryStream(ResultSet rs, String fieldName)

Description

read Blob UTF Binary Stream

License

Open Source License

Declaration

public static String readBlobUTF16BinaryStream(ResultSet rs, String fieldName) throws SQLException 

Method Source Code


//package com.java2s;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Main {
    public static String readBlobUTF16BinaryStream(ResultSet rs, String fieldName) throws SQLException {
        /*try {/*from   ww  w.  j av a  2 s.co  m*/
           Blob clob = rs.getBlob(fieldName);
            
           InputStream is = clob.getBinaryStream();
           StringBuffer sb = new StringBuffer();
            
           int readedBytes;
           int bufferSize = 4096;
            
           do {
        byte[] bytes = new byte[bufferSize];
            
        readedBytes = is.read(bytes);
            
        if (readedBytes > 0) {
           String readed = new String(bytes, 0, readedBytes, "UTF-16");
           sb.append(readed);
        }
           } while (readedBytes == bufferSize);
            
           is.close();
           return sb.toString();
        }
        catch (IOException e) {
           throw new DatabaseException(e);
        }*/
        return null;
    }
}

Related

  1. getBlobAsBytes(ResultSet rs, int col)
  2. getBlobBytes(ResultSet rs, int iColumn)
  3. getBlobValue(ResultSet result, String strField)
  4. readBlob(ResultSet rs, int index)
  5. readBlobUTF16BinaryStream(ResultSet rs, String fieldName)
  6. readFromBlob(ResultSet rs, String column)