if (blob == BLOB_NULL_VALUE) return BYTES_NULL_VALUE;  InputStream in = blob.getBinaryStream();  if (in == STREAM_NULL_VALUE) return BYTES_NULL_VALUE;  ByteArrayOutputStream bout = new ByteArrayOutputStream();   byte[] buff = new byte[BUFF_SIZE]; int counter = 0; try { while((counter = in.read(buff)) != -1) { bout.write(buff, 0, counter); } } catch(IOException ioex) { throw (SQLException)createException( BYTES_CONVERSION_ERROR + " " + ioex.getMessage()); } finally { try { in.close(); } catch(IOException ioex) { throw new SQLException("Unable to close BLOB input stream."); }  try { bout.close(); } catch(IOException ioex) { throw new SQLException("Unable to close ByteArrayOutputStream."); } }  return bout.toByteArray();
return getBytesInternal();
    byte[] getBytes() throws SQLException {        // getBytes() is not defined for BLOB types, only for BINARY        if (field.sqlsubtype < 0)            throw (SQLException)createException(                BYTES_CONVERSION_ERROR);                Blob blob = getBlob();        if (blob == BLOB_NULL_VALUE)            return BYTES_NULL_VALUE;        InputStream in = blob.getBinaryStream();        if (in == STREAM_NULL_VALUE)            return BYTES_NULL_VALUE;        ByteArrayOutputStream bout = new ByteArrayOutputStream();        // copy stream data        byte[] buff = new byte[BUFF_SIZE];        int counter = 0;        try {            while((counter = in.read(buff)) != -1) {                bout.write(buff, 0, counter);            }        } catch(IOException ioex) {            throw (SQLException)createException(                BYTES_CONVERSION_ERROR + " " + ioex.getMessage());        } finally {            try {                in.close();            } catch(IOException ioex) {                throw new SQLException("Unable to close BLOB input stream.");            }            try {                bout.close();            } catch(IOException ioex) {                throw new SQLException("Unable to close ByteArrayOutputStream.");            }        }        return bout.toByteArray();    }