@Override public Value createBlob(InputStream in, long maxLength) { init(); int type = Value.BLOB; if (maxLength < 0) { maxLength = Long.MAX_VALUE; } int max = (int) Math.min(maxLength, dataHandler.getMaxLengthInplaceLob()); try { if (max != 0 && max < Integer.MAX_VALUE) { BufferedInputStream b = new BufferedInputStream(in, max); b.mark(max); byte[] small = new byte[max]; int len = IOUtils.readFully(b, small, max); if (len < max) { if (len < small.length) { small = Arrays.copyOf(small, len); } return ValueLob.createSmallLob(type, small); } b.reset(); in = b; } return createLob(in, type); } catch (IllegalStateException e) { throw DbException.get(ErrorCode.OBJECT_CLOSED, e); } catch (IOException e) { throw DbException.convertIOException(e, null); } }
buff = new char[len]; reader.mark(len); len = IOUtils.readFully(reader, buff, len);
StringBuilder buff = new StringBuilder(lobBlockSize * 2); buff.append("INSERT INTO SYSTEM_LOB_STREAM VALUES(" + id + ", " + i + ", NULL, '"); int len = IOUtils.readFully(input, bytes, lobBlockSize); if (len <= 0) { break; StringBuilder buff = new StringBuilder(lobBlockSize * 2); buff.append("INSERT INTO SYSTEM_LOB_STREAM VALUES(" + id + ", " + i + ", "); int len = IOUtils.readFully(reader, chars, lobBlockSize); if (len < 0) { break;
b.mark(max); char[] small = new char[max]; int len = IOUtils.readFully(b, small, max); if (len < max) { if (len < small.length) {
/** * Create a CLOB in a temporary file. */ private ValueLob(DataHandler handler, Reader in, long remaining) throws IOException { this.type = Value.CLOB; this.handler = handler; this.small = null; this.lobId = 0; this.hmac = null; this.fileName = createTempLobFileName(handler); this.tempFile = this.handler.openFile(fileName, "rw", false); this.tempFile.autoDelete(); FileStorageOutputStream out = new FileStorageOutputStream(tempFile, null, null); long tmpPrecision = 0; try { char[] buff = new char[Constants.IO_BUFFER_SIZE]; while (true) { int len = getBufferSize(this.handler, false, remaining); len = IOUtils.readFully(in, buff, len); if (len == 0) { break; } } } finally { out.close(); } this.precision = tmpPrecision; }
} else { buff = DataUtils.newBytes(len); len = IOUtils.readFully(in, buff, len);
len = IOUtils.readFully(in, buff, len); if (len <= 0) { break;
length = IOUtils.readFully(in, buff, length); transfer.writeResponseHeader(id, Session.STATUS_OK); transfer.writeInt(length);