public class ByteTracker
extends java.lang.Object
| Constructor and Description |
|---|
ByteTracker() |
| Modifier and Type | Method and Description |
|---|---|
CloseableDelegateByteSource |
fromSource(com.google.common.io.ByteSource source)
Creates a new byte source from another byte source.
|
CloseableDelegateByteSource |
fromStream(java.io.ByteArrayOutputStream stream)
Creates a new byte source by snapshotting the provided stream.
|
CloseableDelegateByteSource |
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.
|
public CloseableDelegateByteSource fromStream(@Nonnull java.io.InputStream stream) throws java.io.IOException
stream - the input streamjava.io.IOException - failed to read the streampublic CloseableDelegateByteSource fromStream(@Nonnull java.io.ByteArrayOutputStream stream) throws java.io.IOException
stream - the stream with the datajava.io.IOException - failed to read the streampublic CloseableDelegateByteSource fromSource(@Nonnull com.google.common.io.ByteSource source) throws java.io.IOException
source - the byte source to copy data fromjava.io.IOException - failed to read data from the byte sourcepublic long getBytesUsed()
public long getMaxBytesUsed()