@Override public int read() throws IOException { if (is == null) { is = isf.getInputStream(); } return is.read(); }
public long length() throws SQLException { if (length == -1) { if (InputStreamFactory.getStorageMode(this.reference) == StorageMode.FREE) { throw new SQLException("Already freed or streaming"); //$NON-NLS-1$ } length = computeLength(); } return length; }
public void detachLob(final Streamable<?> lob, final FileStore store, byte[] bytes) throws TeiidComponentException { // if this is not attached, just return if (InputStreamFactory.getStorageMode(lob) != StorageMode.MEMORY) { persistLob(lob, store, bytes, inlineLobs, maxMemoryBytes); } else { InputStreamFactory.setTemporary(lob, false); } }
&& (byteLength <= maxMemoryBytes))) { lob.setReferenceStreamId(null); if (InputStreamFactory.getStorageMode(lob) == StorageMode.MEMORY) { return; isf.setLength(byteLength); if (lob instanceof BlobType) { ((BlobType)lob).setReference(new BlobImpl(isf));
@Test public void testStorageMode() throws IOException { SaveOnReadInputStream soris = getSaveOnReadInputStream(); InputStreamFactory isf = soris.getInputStreamFactory(); assertEquals(StorageMode.MEMORY, isf.getStorageMode()); InputStream is = isf.getInputStream(); assertEquals("hello world", new String(ObjectConverterUtil.convertToByteArray(is), Streamable.CHARSET)); }
if (o instanceof BaseLob) { InputStreamFactory isf = ((BaseLob)o).getStreamFactory(); if (isf.getStorageMode() == StorageMode.MEMORY) { long length = isf.getLength(); if (length >= 0) { return 40 + alignMemory(length); } else if (isf.getStorageMode() == StorageMode.PERSISTENT) { long length = isf.getLength(); return 40 + alignMemory(Math.min(DataTypeManager.MAX_LOB_MEMORY_BYTES, length));
streamFactory.setLength(length); Blob b = new BlobImpl(streamFactory);
@SuppressWarnings("unchecked") public <T extends Source> T getSource(Class<T> sourceClass) throws SQLException { if (sourceClass == null || sourceClass == StreamSource.class) { return (T)new StreamSource(getBinaryStream(), this.getStreamFactory().getSystemId()); } else if (sourceClass == StAXSource.class) { XMLInputFactory factory = XMLType.getXmlInputFactory();
@Override public void close() throws IOException { isf.free(); }
private void saveTemporaryLob(Streamable<?> lob) { if (saveTemporary) { InputStreamFactory.setTemporary(lob, false); } }
&& (byteLength <= maxMemoryBytes))) { lob.setReferenceStreamId(null); if (InputStreamFactory.getStorageMode(lob) == StorageMode.MEMORY) { return; isf.setLength(byteLength); if (lob instanceof BlobType) { ((BlobType)lob).setReference(new BlobImpl(isf));
if (o instanceof BaseLob) { InputStreamFactory isf = ((BaseLob)o).getStreamFactory(); if (isf.getStorageMode() == StorageMode.MEMORY) { long length = isf.getLength(); if (length >= 0) { return 40 + alignMemory(length); } else if (isf.getStorageMode() == StorageMode.PERSISTENT) { long length = isf.getLength(); return 40 + alignMemory(Math.min(DataTypeManager.MAX_LOB_MEMORY_BYTES, length));
isf.setLength(((BlobType)currentValue).getLength()); return new BlobImpl(isf);
public void detachLob(final Streamable<?> lob, final FileStore store, byte[] bytes) throws TeiidComponentException { // if this is not attached, just return if (InputStreamFactory.getStorageMode(lob) != StorageMode.MEMORY) { persistLob(lob, store, bytes, inlineLobs, maxMemoryBytes); } else { InputStreamFactory.setTemporary(lob, false); } }
@SuppressWarnings("unchecked") public <T extends Source> T getSource(Class<T> sourceClass) throws SQLException { if (sourceClass == null || sourceClass == StreamSource.class) { return (T)new StreamSource(getBinaryStream(), this.getStreamFactory().getSystemId()); } else if (sourceClass == StAXSource.class) { XMLInputFactory factory = XMLType.getXmlInputFactory();
@Override public void close() throws IOException { isf.free(); }
private void saveTemporaryLob(Streamable<?> lob) { if (saveTemporary) { InputStreamFactory.setTemporary(lob, false); } }
@Override public int read() throws IOException { if (is == null) { is = isf.getInputStream(); } return is.read(); }
@Override public long length() throws SQLException { if (this.length != -1) { return length; } StorageMode storageMode = InputStreamFactory.getStorageMode(this); if (storageMode != StorageMode.OTHER) { return super.length(); } throw new SQLException("Computing the length may leave the XML value unreadable"); //$NON-NLS-1$ } }