/** * Truncates the <code>CLOB</code> value that this <code>SerialClob</code> * object represents so that it has a length of <code>len</code> * characters. * <p> * Truncating a <code>SerialClob</code> object to length 0 has the effect of * clearing its contents. * * @param length the length, in bytes, to which the <code>CLOB</code> * value should be truncated * @throws SerialException if there is an error accessing the * <code>CLOB</code> value; * if the {@code free} method had been previously called on this object */ public void truncate(long length) throws SerialException { isValid(); if (length > len) { throw new SerialException ("Length more than what can be truncated"); } else { len = length; // re-size the buffer if (len == 0) { buf = new char[] {}; } else { buf = (this.getSubString(1, (int)len)).toCharArray(); } } }