public class TemporaryDirectoryStorage extends java.lang.Object implements ByteStorage
| Constructor and Description |
|---|
TemporaryDirectoryStorage(TemporaryDirectoryFactory temporaryDirectoryFactory)
Creates a new storage using the provided temporary directory.
|
| 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.
|
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 TemporaryDirectoryStorage(TemporaryDirectoryFactory temporaryDirectoryFactory) throws java.io.IOException
temporaryDirectoryFactory - a factory used to create the directory to use for temporary
files; this directory will be closed when the TemporaryDirectoryStorage is closed.java.io.IOException - failed to create the temporary directorypublic 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