@Override public InputStream getInputStream() { if (fileName == null) { return new ByteArrayInputStream(small); } FileStore store = handler.openFile(fileName, "r", true); boolean alwaysClose = SysProperties.LOB_CLOSE_BETWEEN_READS; return new BufferedInputStream( new FileStoreInputStream(store, handler, compressed, alwaysClose), Constants.IO_BUFFER_SIZE); }
private FileStoreOutputStream initLarge(DataHandler h) { this.handler = h; this.tableId = 0; this.linked = false; this.precision = 0; this.small = null; this.hash = 0; String compressionAlgorithm = h.getLobCompressionAlgorithm(type); this.compressed = compressionAlgorithm != null; synchronized (h) { String path = h.getDatabasePath(); if ((path != null) && (path.length() == 0)) { path = new File(Utils.getProperty("java.io.tmpdir", "."), SysProperties.PREFIX_TEMP_FILE) .getAbsolutePath(); } objectId = getNewObjectId(h); fileName = getFileNamePrefix(path, objectId) + Constants.SUFFIX_TEMP_FILE; tempFile = h.openFile(fileName, "rw", false); tempFile.autoDelete(); } FileStoreOutputStream out = new FileStoreOutputStream(tempFile, h, compressionAlgorithm); return out; }