class JdbcBlob extends BlobBase {

    private final JdbcConnection conn;

    /**
     * INTERNAL
     */
    public JdbcBlob(JdbcConnection conn, Value value, int id) {
        this.conn = conn;
        this.value = value;
        this.trace = conn.getTrace(TraceObjectType.BLOB, id);
    }

    @Override
    protected void checkClosed() {
        conn.checkClosed();
        super.checkClosed();
    }

    @Override
    public int setBytes(long pos, byte[] bytes) throws SQLException {
        try {
            if (isDebugEnabled()) {
                debugCode("setBytes(" + pos + ", " + quoteBytes(bytes) + ");");
            }
            checkClosed();
            if (pos != 1) {
                throw DbException.getInvalidValueException("pos", pos);
            }
            value = conn.createBlob(new ByteArrayInputStream(bytes), -1);
            return bytes.length;
        } catch (Exception e) {
            throw logAndConvert(e);
        }
    }

    @Override
    public OutputStream setBinaryStream(long pos) throws SQLException {<FILL_FUNCTION_BODY>}
}

        try {
            if (isDebugEnabled()) {
                debugCode("setBinaryStream(" + pos + ");");
            }
            checkClosed();
            if (pos != 1) {
                throw DbException.getInvalidValueException("pos", pos);
            }
            if (value.getPrecision() != 0) {
                throw DbException.getInvalidValueException("length", value.getPrecision());
            }
            final JdbcConnection c = conn;
            final PipedInputStream in = new PipedInputStream();
            final Task task = new Task() {
                @Override
                public void call() {
                    value = c.createBlob(in, -1);
                }
            };
            PipedOutputStream out = new PipedOutputStream(in) {
                @Override
                public void close() throws IOException {
                    super.close();
                    try {
                        task.get();
                    } catch (Exception e) {
                        throw DbException.convertToIOException(e);
                    }
                }
            };
            task.execute();
            return new BufferedOutputStream(out);
        } catch (Exception e) {
            throw logAndConvert(e);
        }
    
<methods>public non-sealed void <init>() ,public void free() ,public java.io.InputStream getBinaryStream() throws java.sql.SQLException,public java.io.InputStream getBinaryStream(long, long) throws java.sql.SQLException,public byte[] getBytes(long, int) throws java.sql.SQLException,public com.lealone.db.value.Value getValue() ,public long length() throws java.sql.SQLException,public long position(byte[], long) throws java.sql.SQLException,public long position(java.sql.Blob, long) throws java.sql.SQLException,public abstract java.io.OutputStream setBinaryStream(long) throws java.sql.SQLException,public abstract int setBytes(long, byte[]) throws java.sql.SQLException,public int setBytes(long, byte[], int, int) throws java.sql.SQLException,public java.lang.String toString() ,public void truncate(long) throws java.sql.SQLException<variables>protected com.lealone.db.value.Value value