@Override @Nullable public InputStream getBlobAsBinaryStream(ResultSet rs, int columnIndex) throws SQLException { logger.debug("Returning BLOB as binary stream"); if (this.wrapAsLob) { Blob blob = rs.getBlob(columnIndex); return blob.getBinaryStream(); } else { return rs.getBinaryStream(columnIndex); } }
@Override public java.io.InputStream getBinaryStream(String columnLabel) throws SQLException { try { return rs.getBinaryStream(columnLabel); } catch (Throwable t) { throw checkException(t); } }
@Override public java.io.InputStream getBinaryStream(int columnIndex) throws SQLException { try { return rs.getBinaryStream(columnIndex); } catch (Throwable t) { throw checkException(t); } }
@Override public void run() throws Exception { rs.getBinaryStream("id"); } });
@Override public void run() throws Exception { rs.getBinaryStream(1); } });
@SuppressWarnings("deprecation") @Override public InputStream getInputStream(final int columnIndex, final String type) throws SQLException { switch (type) { case "Ascii": return resultSet.getAsciiStream(columnIndex); case "Unicode": return resultSet.getUnicodeStream(columnIndex); case "Binary": return resultSet.getBinaryStream(columnIndex); default: throw new SQLException(String.format("Unsupported type: %s", type)); } }
@SuppressWarnings("deprecation") @Override public InputStream getInputStream(final String columnLabel, final String type) throws SQLException { switch (type) { case "Ascii": return resultSet.getAsciiStream(columnLabel); case "Unicode": return resultSet.getUnicodeStream(columnLabel); case "Binary": return resultSet.getBinaryStream(columnLabel); default: throw new SQLException(String.format("Unsupported type: %s", type)); } }
@Override public java.io.InputStream resultSet_getBinaryStream(ResultSetProxy rs, int columnIndex) throws SQLException { if (this.pos < filterSize) { return nextFilter() .resultSet_getBinaryStream(this, rs, columnIndex); } return rs.getResultSetRaw() .getBinaryStream(columnIndex); }
@Override public java.io.InputStream resultSet_getBinaryStream(ResultSetProxy rs, String columnLabel) throws SQLException { if (this.pos < filterSize) { return nextFilter() .resultSet_getBinaryStream(this, rs, columnLabel); } return rs.getResultSetRaw() .getBinaryStream(columnLabel); }
@Override protected Object getJobDataFromBlob(ResultSet rs, String colName) throws ClassNotFoundException, IOException, SQLException { if (canUseProperties()) { InputStream binaryInput = rs.getBinaryStream(colName); return binaryInput; } return getObjectFromBlob(rs, colName); }
@Override protected Object getJobDataFromBlob(ResultSet rs, String colName) throws ClassNotFoundException, IOException, SQLException { if (canUseProperties()) { InputStream binaryInput = rs.getBinaryStream(colName); return binaryInput; } return getObjectFromBlob(rs, colName); } }
@Override protected Object getJobDataFromBlob(ResultSet rs, String colName) throws ClassNotFoundException, IOException, SQLException { if (canUseProperties()) { InputStream binaryInput = rs.getBinaryStream(colName); return binaryInput; } return getObjectFromBlob(rs, colName); } }
@Override protected Object getJobDataFromBlob(ResultSet rs, String colName) throws ClassNotFoundException, IOException, SQLException { if (canUseProperties()) { InputStream binaryInput = rs.getBinaryStream(colName); return binaryInput; } return getObjectFromBlob(rs, colName); } }
@Override protected Object getJobDataFromBlob(ResultSet rs, String colName) throws ClassNotFoundException, IOException, SQLException { if (canUseProperties()) { InputStream binaryInput = rs.getBinaryStream(colName); return binaryInput; } return getObjectFromBlob(rs, colName); } }
@Override protected Object getJobDataFromBlob(ResultSet rs, String colName) throws ClassNotFoundException, IOException, SQLException { if (canUseProperties()) { InputStream binaryInput = rs.getBinaryStream(colName); return binaryInput; } return getObjectFromBlob(rs, colName); }
@Override protected Object getJobDataFromBlob(ResultSet rs, String colName) throws ClassNotFoundException, IOException, SQLException { if (canUseProperties()) { InputStream binaryInput = rs.getBinaryStream(colName); return binaryInput; } return getObjectFromBlob(rs, colName); }
@Override protected Object getJobDataFromBlob(ResultSet rs, String colName) throws ClassNotFoundException, IOException, SQLException { if (canUseProperties()) { InputStream binaryInput = rs.getBinaryStream(colName); return binaryInput; } return getObjectFromBlob(rs, colName); }
@Override public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException { final String type = rs.getString( names[0] ); // For debug purpose. return convertInputStreamToObject( rs.getBinaryStream( names[1] ) ); }
@Override public Object get(ResultSet rs, String colName) throws SQLException { InputStream ins = rs.getBinaryStream(colName); if (ins == null) return null; File f = this.createTempFile(); Files.write(f, ins); return new SimpleBlob(f); }
@Test public void testGetBlobAsBinaryStream() throws SQLException { lobHandler.getBlobAsBinaryStream(rs, 1); verify(rs).getBinaryStream(1); }