@Override public InputStream getBinaryStream() throws SQLException { return getStream(); }
@Override public byte[] getBytes(final long start, final int length) throws SQLException { if ( start < 1 ) { throw new SQLException( "Start position 1-based; must be 1 or more." ); } if ( length < 0 ) { throw new SQLException( "Length must be great-than-or-equal to zero." ); } return DataHelper.extractBytes( getStream(), start-1, length ); }
@Override public InputStream getBinaryStream(final long start, final long length) throws SQLException { if ( start < 1 ) { throw new SQLException( "Start position 1-based; must be 1 or more." ); } if ( start > length() ) { throw new SQLException( "Start position [" + start + "] cannot exceed overall CLOB length [" + length() + "]" ); } if ( length > Integer.MAX_VALUE ) { throw new SQLException( "Can't deal with Blobs larger than Integer.MAX_VALUE" ); } final int intLength = (int)length; if ( intLength < 0 ) { // java docs specifically say for getBinaryStream(long,int) that the start+length must not exceed the // total length, however that is at odds with the getBytes(long,int) behavior. throw new SQLException( "Length must be great-than-or-equal to zero." ); } return DataHelper.subStream( getStream(), start-1, intLength ); }
@Override public InputStream getBinaryStream() throws SQLException { return getStream(); }
@Override public byte[] getBytes(final long start, final int length) throws SQLException { if ( start < 1 ) { throw new SQLException( "Start position 1-based; must be 1 or more." ); } if ( length < 0 ) { throw new SQLException( "Length must be great-than-or-equal to zero." ); } return LobStreamDataHelper.extractBytes( getStream(), start-1, length ); }
@Override public InputStream getBinaryStream(final long start, final long length) throws SQLException { if ( start < 1 ) { throw new SQLException( "Start position 1-based; must be 1 or more." ); } if ( start > length() ) { throw new SQLException( "Start position [" + start + "] cannot exceed overall CLOB length [" + length() + "]" ); } if ( length > Integer.MAX_VALUE ) { throw new SQLException( "Can't deal with Blobs larger than Integer.MAX_VALUE" ); } final int intLength = (int)length; if ( intLength < 0 ) { // java docs specifically say for getBinaryStream(long,int) that the start+length must not exceed the // total length, however that is at odds with the getBytes(long,int) behavior. throw new SQLException( "Length must be great-than-or-equal to zero." ); } return LobStreamDataHelper.subStream( getStream(), start-1, intLength ); }