public class TemporaryFileBackedOutputStream extends OutputStream
close()
is called. The method asByteSource()
should not be called after close()
is called.Constructor and Description |
---|
TemporaryFileBackedOutputStream()
Use a file threshold size of
DEFAULT_THRESHOLD . |
TemporaryFileBackedOutputStream(int fileThreshold) |
Modifier and Type | Method and Description |
---|---|
com.google.common.io.ByteSource |
asByteSource()
Returns a readable
ByteSource view of the data that has been written to this stream. |
void |
close() |
void |
flush() |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
public TemporaryFileBackedOutputStream(int fileThreshold)
fileThreshold
- the number of bytes before the stream should switch to buffering to a filepublic TemporaryFileBackedOutputStream()
DEFAULT_THRESHOLD
.public void write(int b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public com.google.common.io.ByteSource asByteSource() throws IOException
ByteSource
view of the data that has been written to this stream.
Must not be called after close()
is called, otherwise an IllegalStateException
will be thrown.IOException
- throws an exception if the stream is closedThis work is licensed under a Creative Commons Attribution 4.0 International License.