public int setBytes(final long pos, byte[] bytes,
                        final int offset, final int len) throws SQLException {

        synchronized (this) {
            if (this.underlying == null) {
                if (pos > 1) {
                    throw new SQLException("Invalid position: " + pos);
                } // end of if

                if (len < 0) {
                    throw new IllegalArgumentException("Invalid bytes length: " 
                                                       + len);

                } // end of if

                // ---

                final byte[] copy = new byte[len];

                try {
                    System.arraycopy(bytes, offset, copy, 0, len);
                } catch (Exception e) {
                    throw new IllegalArgumentException("Fails to prepare binary data", e);
                } // end of catch

                // ---

                this.underlying = new SerialBlob(copy);

                return len;
            } // end of if

            // ---

            return this.underlying.setBytes(pos, bytes, offset, len);
        } // end of sync
    }
public int setBytes ( final long pos , byte [ ] bytes , final int offset , final int len ) throws SQLException { synchronized ( this ) { if ( this . underlying == null ) { if ( pos > 1 ) { throw new SQLException ( "Invalid position: " + pos ) ; } if ( len < 0 ) { throw new IllegalArgumentException ( "Invalid bytes length: " + len ) ; } final byte [ ] copy = new byte [ len ] ; try { System . arraycopy ( bytes , offset , copy , 0 , len ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Fails to prepare binary data" , e ) ; } this . underlying = new SerialBlob ( copy ) ; return len ; } return this . underlying . setBytes ( pos , bytes , offset , len ) ; } }
{@inheritDoc}