@Override public void write(int b) { buffer[0] = (byte) b; write(buffer); }
@Override public void write(byte[] buff) { write(buff, 0, buff.length); }
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; } } } }
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; }
while (true) { tmpPrecision += len; out.write(buff, 0, len); remaining -= len; if (remaining <= 0) {
@Override public void write(int b) { buffer[0] = (byte) b; write(buffer); }
@Override public void write(byte[] buff) { write(buff, 0, buff.length); }
@Override public void write(int b) { buffer[0] = (byte) b; write(buffer); }
@Override public void write(byte[] buff) { write(buff, 0, buff.length); }
public void write(byte[] buff) throws IOException { write(buff, 0, buff.length); }
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 createFromReader(char[] buff, int len, Reader in, long remaining, DataHandler h) throws IOException { FileStoreOutputStream out = initLarge(h); boolean compress = h.getLobCompressionAlgorithm(Value.CLOB) != null; try { 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; } } } finally { out.close(); } }
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("UTF-8"); out.write(data); tmpPrecision += len; } } this.precision = tmpPrecision; }
out.write(data); tmpPrecision += len;
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(); } }
private void createFromReader(char[] buff, int len, Reader in, long remaining, DataHandler handler) throws SQLException { try { FileStoreOutputStream out = initLarge(handler); boolean compress = handler.getLobCompressionAlgorithm(Value.CLOB) != null; try { while (true) { precision += len; byte[] b = StringUtils.utf8Encode(new String(buff, 0, len)); out.write(b, 0, b.length); remaining -= len; if (remaining <= 0) { break; } len = getBufferSize(handler, compress, remaining); len = IOUtils.readFully(in, buff, len); if (len <= 0) { break; } } } finally { out.close(); } } catch (IOException e) { throw Message.convertIOException(e, null); } }
private void createFromStream(byte[] buff, int len, InputStream in, long remaining, DataHandler handler) throws SQLException { try { FileStoreOutputStream out = initLarge(handler); boolean compress = handler.getLobCompressionAlgorithm(Value.BLOB) != null; try { while (true) { precision += len; out.write(buff, 0, len); remaining -= len; if (remaining <= 0) { break; } len = getBufferSize(handler, compress, remaining); len = IOUtils.readFully(in, buff, 0, len); if (len <= 0) { break; } } } finally { out.close(); } } catch (IOException e) { throw Message.convertIOException(e, null); } }
while (true) { tmpPrecision += len; out.write(buff, 0, len); remaining -= len; if (remaining <= 0) {