public class ChunkBasedByteStorage extends java.lang.Object implements ByteStorage
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
CloseableByteSource |
fromSource(com.google.common.io.ByteSource source)
Creates a new byte source from another byte source.
|
CloseableByteSource |
fromStream(java.io.InputStream stream)
Creates a new byte source by fully reading an input stream.
|
long |
getBytesUsed()
Obtains the number of bytes currently used.
|
ByteStorage |
getDelegate()
Obtains the byte storage chunks are allocated from.
|
long |
getMaxBytesUsed()
Obtains the maximum number of bytes ever used by this tracker.
|
CloseableByteSourceFromOutputStreamBuilder |
makeBuilder()
Creates a builder that is an output stream and can create a byte source.
|
public ByteStorage getDelegate()
public CloseableByteSource fromStream(java.io.InputStream stream) throws java.io.IOException
ByteStoragefromStream in interface ByteStoragestream - the input streamjava.io.IOException - failed to read the streampublic CloseableByteSourceFromOutputStreamBuilder makeBuilder() throws java.io.IOException
ByteStoragemakeBuilder in interface ByteStorageCloseableByteSource can eventually
be obtained fromjava.io.IOException - failed to create the builder; this may happen if the builder require some
preparation such as temporary storage allocation that may failpublic CloseableByteSource fromSource(com.google.common.io.ByteSource source) throws java.io.IOException
ByteStoragefromSource in interface ByteStoragesource - the byte source to copy data fromjava.io.IOException - failed to read data from the byte sourcepublic long getBytesUsed()
ByteStoragegetBytesUsed in interface ByteStoragepublic long getMaxBytesUsed()
ByteStoragegetMaxBytesUsed in interface ByteStoragepublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOException