Code example for Blob

Methods: getBytes, length

0
  public byte[] getNullableResult(ResultSet rs, String columnName)
      throws SQLException { 
    Blob blob = rs.getBlob(columnName);
    byte[] returnValue = null;
    if (null != blob) {
      returnValue = blob.getBytes(1, (int) blob.length());
    } 
    return returnValue;
  } 
 
  @Override 
  public byte[] getNullableResult(ResultSet rs, int columnIndex)
      throws SQLException { 
    Blob blob = rs.getBlob(columnIndex);
    byte[] returnValue = null;
    if (null != blob) {
      returnValue = blob.getBytes(1, (int) blob.length());
    } 
    return returnValue;
  }