* @exception SQLException if there is an error accessing the <code>CLOB</code>
*/
public String getSubString(long pos, int length) throws SQLException {
if (pos < 1) {
Object[] params = new Object[] {new Long(pos)};
throw new SQLException(CorePlugin.Util.getString("MMClob_MMBlob.0", params)); //$NON-NLS-1$
} else if (pos > length()) {
return null;
}
pos = pos - 1;
if (length < 0) {
Object[] params = new Object[] {new Integer( length)};
throw new SQLException(CorePlugin.Util.getString("MMClob_MMBlob.1", params)); //$NON-NLS-1$
} else if ((pos+length) > length()) {
length = (int)(length()-pos);
}
Reader in = getCharacterStream();
try {
try {
long skipped = 0;
while (pos > 0) {
skipped = in.skip(pos);
pos -= skipped;
}
return new String(ObjectConverterUtil.convertToCharArray(in, length));
} finally {
in.close();
}
} catch (IOException e) {
throw new SQLException(e);
}
}