private void createFromReader(char[] buff, int len, Reader in, long remaining) throws IOException { FileOutputStream out = initLarge(); 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(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) throws IOException { FileOutputStream out = initLarge(); try { while (true) { precision += len; out.write(buff, 0, len); remaining -= len; if (remaining <= 0) { break; } len = getBufferSize(remaining); len = IOUtils.readFully(in, buff, len); if (len <= 0) { break; } } } finally { out.close(); } }
remaining = length; int len = getBufferSize(remaining); char[] buff; if (len >= Integer.MAX_VALUE) {
remaining = length; int len = getBufferSize(remaining); byte[] buff; if (len >= Integer.MAX_VALUE) {
/** * Store the lob data to a file if the size of the buffer is larger than the * maximum size for an in-place lob. * * @param h the data handler */ public void convertToFileIfRequired() { try { if (small != null && small.length > getMaxLengthInplaceLob()) { int len = getBufferSize(Long.MAX_VALUE); int tabId = tableId; if (type == Value.BLOB) { createFromStream( DataUtils.newBytes(len), 0, getInputStream(), Long.MAX_VALUE); } else { createFromReader( new char[len], 0, getReader(), Long.MAX_VALUE); } Value v2 = link(tabId); if (SysProperties.CHECK && v2 != this) { DbException.throwInternalError(); } } } catch (IOException e) { throw DbException.convertIOException(e, null); } }