@Override public void write(int b) { buffer[0] = (byte) b; write(buffer); }
this.tempFile = this.handler.openFile(fileName, "rw", false); this.tempFile.autoDelete(); FileStorageOutputStream out = new FileStorageOutputStream(tempFile, null, null); long tmpPrecision = 0; boolean compress = this.handler.getLobCompressionAlgorithm(Value.BLOB) != null; while (true) { tmpPrecision += len; out.write(buff, 0, len); remaining -= len; if (remaining <= 0) { out.close();
/** * 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; }
/** * Open the output stream. */ void openOutput() { String file = getFileName(); if (file == null) { return; } if (isEncrypted()) { initStore(); out = new FileStorageOutputStream(fileStorage, this, compressionAlgorithm); // always use a big buffer, otherwise end-of-block is written a lot out = new BufferedOutputStream(out, Constants.IO_BUFFER_SIZE_COMPRESS); } else { OutputStream o; try { o = FileUtils.newOutputStream(file, false); } catch (IOException e) { throw DbException.convertIOException(e, null); } out = new BufferedOutputStream(o, Constants.IO_BUFFER_SIZE); out = CompressTool.wrapOutputStream(out, compressionAlgorithm, SCRIPT_SQL); } }
@Override public void write(byte[] buff) { write(buff, 0, buff.length); }