return;
int remainingBytes = clearLimit();
if (length > -1 && remainingBytes > 0) {
throw new DerbyIOException(
MessageService.getTextMessage(
SQLState.SET_STREAM_INEXACT_LENGTH_DATA),
SQLState.SET_STREAM_INEXACT_LENGTH_DATA);
}
// if we had a limit try reading one more byte.
// JDBC 3.0 states the stream muct have the correct number of characters in it.
if (remainingBytes == 0) {
int c;
try
{
c = super.read();
}
catch (IOException ioe) {
c = -1;
}
if (c != -1) {
if (length > -1) {
// Stream is not capped, and should have matched the
// specified length.
throw new DerbyIOException(
MessageService.getTextMessage(
SQLState.SET_STREAM_INEXACT_LENGTH_DATA),
SQLState.SET_STREAM_INEXACT_LENGTH_DATA);
} else {
// Stream is capped, and has exceeded the maximum length.
throw new DerbyIOException(
MessageService.getTextMessage(
SQLState.LANG_STRING_TRUNCATION,
typeName,
"XXXX",
String.valueOf(maximumLength)),