code: 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
      }
docs: {@inheritDoc}