Package com.google.common.io
Class FileBackedOutputStream
java.lang.Object
java.io.OutputStream
com.google.common.io.FileBackedOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
@Beta
@Deprecated(since="2022-12-01")
public final class FileBackedOutputStream
extends OutputStream
Deprecated.
The Google Guava Core Libraries are deprecated and will not be part of the AEM SDK after April 2023
An
OutputStream that starts buffering to a byte array, but
switches to file buffering once the data reaches a configurable size.
This class is thread-safe.
- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionFileBackedOutputStream(int fileThreshold) Deprecated.Creates a new instance that uses the given file threshold, and does not reset the data when theByteSourcereturned byasByteSource()is finalized.FileBackedOutputStream(int fileThreshold, boolean resetOnFinalize) Deprecated.Creates a new instance that uses the given file threshold, and optionally resets the data when theByteSourcereturned byasByteSource()is finalized. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Returns a readableByteSourceview of the data that has been written to this stream.voidclose()Deprecated.voidflush()Deprecated.Deprecated.UseasByteSource()instead.voidreset()Deprecated.Callsclose()if not already closed, and then resets this object back to its initial state, for reuse.voidwrite(byte[] b) Deprecated.voidwrite(byte[] b, int off, int len) Deprecated.voidwrite(int b) Deprecated.Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
FileBackedOutputStream
public FileBackedOutputStream(int fileThreshold) Deprecated.Creates a new instance that uses the given file threshold, and does not reset the data when theByteSourcereturned byasByteSource()is finalized.- Parameters:
fileThreshold- the number of bytes before the stream should switch to buffering to a file
-
FileBackedOutputStream
public FileBackedOutputStream(int fileThreshold, boolean resetOnFinalize) Deprecated.Creates a new instance that uses the given file threshold, and optionally resets the data when theByteSourcereturned byasByteSource()is finalized.- Parameters:
fileThreshold- the number of bytes before the stream should switch to buffering to a fileresetOnFinalize- if true, thereset()method will be called when theByteSourcereturned byasByteSource()is finalized
-
-
Method Details
-
getSupplier
Deprecated.UseasByteSource()instead. This method is scheduled to be removed in Guava 16.0.Returns a supplier that may be used to retrieve the data buffered by this stream. This method returns the same object asasByteSource(). -
asByteSource
Deprecated.Returns a readableByteSourceview of the data that has been written to this stream.- Since:
- 15.0
-
reset
Deprecated.Callsclose()if not already closed, and then resets this object back to its initial state, for reuse. If data was buffered to a file, it will be deleted.- Throws:
IOException- if an I/O error occurred while deleting the file buffer
-
write
Deprecated.- Specified by:
writein classOutputStream- Throws:
IOException
-
write
Deprecated.- Overrides:
writein classOutputStream- Throws:
IOException
-
write
Deprecated.- Overrides:
writein classOutputStream- Throws:
IOException
-
close
Deprecated.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
flush
Deprecated.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-