/** * Read a number of bytes. * * @param buff the target buffer * @param len the number of bytes to read */ public void readFully(byte[] buff, int len) throws IOException { int got = IOUtils.readFully(in, buff, len); if (got < len) { throw new FastEOFException(); } }
private void createFromReader(char[] buff, int len, Reader in, long remaining, DataHandler h) throws IOException { try (FileStoreOutputStream out = initLarge(h)) { boolean compress = h.getLobCompressionAlgorithm(Value.CLOB) != null; while (true) { precision += len; byte[] b = new String(buff, 0, len).getBytes(StandardCharsets.UTF_8); out.write(b, 0, b.length); remaining -= len; if (remaining <= 0) { break; } len = getBufferSize(h, compress, remaining); len = IOUtils.readFully(in, buff, len); if (len == 0) { break; } } } }
buff.append("INSERT INTO SYSTEM_LOB_STREAM VALUES(").append(id) .append(", ").append(i).append(", NULL, '"); int len = IOUtils.readFully(input, bytes, lobBlockSize); if (len <= 0) { break; buff.append("INSERT INTO SYSTEM_LOB_STREAM VALUES(").append(id).append(", ").append(i) .append(", "); int len = IOUtils.readFully(reader, chars, lobBlockSize); if (len == 0) { break;
private void createFromStream(byte[] buff, int len, InputStream in, long remaining, DataHandler h) throws IOException { try (FileStoreOutputStream out = initLarge(h)) { boolean compress = h.getLobCompressionAlgorithm(Value.BLOB) != null; while (true) { precision += len; out.write(buff, 0, len); remaining -= len; if (remaining <= 0) { break; } len = getBufferSize(h, compress, remaining); len = IOUtils.readFully(in, buff, len); if (len <= 0) { break; } } } }
/** * Create a CLOB in a temporary file. */ private ValueLobDb(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(); long tmpPrecision = 0; try (FileStoreOutputStream out = new FileStoreOutputStream(tempFile, null, null)) { 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; } byte[] data = new String(buff, 0, len).getBytes(StandardCharsets.UTF_8); out.write(data); tmpPrecision += len; } } this.precision = tmpPrecision; this.tableId = 0; }
buff = new char[len]; reader.mark(len); len = IOUtils.readFully(reader, buff, len);
@Override public Value createBlob(InputStream in, long maxLength) { init(); int type = Value.BLOB; try { if (maxLength != -1 && maxLength <= database.getMaxLengthInplaceLob()) { byte[] small = new byte[(int) maxLength]; int len = IOUtils.readFully(in, small, (int) maxLength); if (len > maxLength) { throw new IllegalStateException( "len > blobLength, " + len + " > " + maxLength); } if (len < small.length) { small = Arrays.copyOf(small, len); } return ValueLobDb.createSmallLob(type, small); } if (maxLength != -1) { in = new RangeInputStream(in, 0L, maxLength); } return createLob(in, type); } catch (IllegalStateException e) { throw DbException.get(ErrorCode.OBJECT_CLOSED, e); } catch (IOException e) { throw DbException.convertIOException(e, null); } }
try { for (int seq = 0;; seq++) { int l = IOUtils.readFully(in, block, block.length); String x = StringUtils.convertBytesToHex(block, l); if (l > 0) {
} else { buff = new char[len]; len = IOUtils.readFully(in, buff, len);
&& maxLength * 3 <= database.getMaxLengthInplaceLob()) { char[] small = new char[(int) maxLength]; int len = IOUtils.readFully(reader, small, (int) maxLength); if (len > maxLength) { throw new IllegalStateException(
len = IOUtils.readFully(in, buff, len); if (len <= 0) { break;
} else { buff = Utils.newBytes(len); len = IOUtils.readFully(in, buff, len);
for (int seq = 0; maxLength > 0; seq++) { int len = (int) Math.min(BLOCK_LENGTH, maxLength); len = IOUtils.readFully(in, buff, len); if (len <= 0) { break;
} else { buff = Utils.newBytes(len); len = IOUtils.readFully(in, buff, len);
length = IOUtils.readFully(in, buff, length); transfer.writeInt(SessionRemote.STATUS_OK); transfer.writeInt(length);
/** * Read a number of bytes. * * @param buff the target buffer * @param len the number of bytes to read */ public void readFully(byte[] buff, int len) throws IOException { int got = IOUtils.readFully(in, buff, len); if (got < len) { throw new FastEOFException(); } }
/** * Read a number of bytes. * * @param buff the target buffer * @param len the number of bytes to read */ public void readFully(byte[] buff, int len) throws IOException { int got = IOUtils.readFully(in, buff, len); if (got < len) { throw new FastEOFException(); } }
private void createFromReader(char[] buff, int len, Reader in, long remaining, DataHandler h) throws IOException { try (FileStoreOutputStream out = initLarge(h)) { boolean compress = h.getLobCompressionAlgorithm(Value.CLOB) != null; while (true) { precision += len; byte[] b = new String(buff, 0, len).getBytes(Constants.UTF8); out.write(b, 0, b.length); remaining -= len; if (remaining <= 0) { break; } len = getBufferSize(h, compress, remaining); len = IOUtils.readFully(in, buff, len); if (len == 0) { break; } } } }
private void createFromStream(byte[] buff, int len, InputStream in, long remaining, DataHandler h) throws IOException { try (FileStoreOutputStream out = initLarge(h)) { boolean compress = h.getLobCompressionAlgorithm(Value.BLOB) != null; while (true) { precision += len; out.write(buff, 0, len); remaining -= len; if (remaining <= 0) { break; } len = getBufferSize(h, compress, remaining); len = IOUtils.readFully(in, buff, len); if (len <= 0) { break; } } } }
private void createFromStream(byte[] buff, int len, InputStream in, long remaining, DataHandler h) throws IOException { FileStoreOutputStream out = initLarge(h); boolean compress = h.getLobCompressionAlgorithm(Value.BLOB) != null; try { while (true) { precision += len; out.write(buff, 0, len); remaining -= len; if (remaining <= 0) { break; } len = getBufferSize(h, compress, remaining); len = IOUtils.readFully(in, buff, len); if (len <= 0) { break; } } } finally { out.close(); } }