+ length;
throw Util.sqlException(Trace.INPUTSTREAM_ERROR, msg);
}
HsqlByteArrayOutputStream out = null;
try {
out = new HsqlByteArrayOutputStream();
java.io.InputStream in = x.getBinaryStream();
int buffSize = 2048;
byte[] buff = new byte[buffSize];
for (int left = (int) length; left > 0; ) {
int read = in.read(buff, 0, left > buffSize ? buffSize
: left);
if (read == -1) {
break;
}
out.write(buff, 0, read);
left -= read;
}
setParameter(i, out.toByteArray());
} catch (IOException e) {
throw Util.sqlException(Trace.INPUTSTREAM_ERROR, e.toString());
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e1) {}
}
}
}