Package com.google.common.io
Class ByteSink
java.lang.Object
com.google.common.io.ByteSink
- All Implemented Interfaces:
OutputSupplier<OutputStream>
@Deprecated(since="2022-12-01")
public abstract class ByteSink
extends Object
implements OutputSupplier<OutputStream>
Deprecated.
The Google Guava Core Libraries are deprecated and will not be part of the AEM SDK after April 2023
A destination to which bytes can be written, such as a file. Unlike an
OutputStream, a
ByteSink is not an open, stateful stream that can be written to and closed. Instead, it
is an immutable supplier of OutputStream instances.
ByteSink provides two kinds of methods:
- Methods that return a stream: These methods should return a new, independent instance each time they are called. The caller is responsible for ensuring that the returned stream is closed.
- Convenience methods: These are implementations of common operations that are typically implemented by opening a stream using one of the methods in the first category, doing something and finally closing the stream or channel that was opened.
- Since:
- 14.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasCharSink(Charset charset) Deprecated.final OutputStreamDeprecated.This method is only provided for temporary compatibility with theOutputSupplierinterface and should not be called directly.Deprecated.Opens a new bufferedOutputStreamfor writing to this sink.abstract OutputStreamDeprecated.Opens a newOutputStreamfor writing to this sink.voidwrite(byte[] bytes) Deprecated.Writes all the given bytes to this sink.longwriteFrom(InputStream input) Deprecated.Writes all the bytes from the givenInputStreamto this sink.
-
Constructor Details
-
ByteSink
public ByteSink()Deprecated.
-
-
Method Details
-
asCharSink
Deprecated. -
openStream
Deprecated.Opens a newOutputStreamfor writing to this sink. This method should return a new, independent stream each time it is called.The caller is responsible for ensuring that the returned stream is closed.
- Throws:
IOException- if an I/O error occurs in the process of opening the stream
-
getOutput
Deprecated.This method is only provided for temporary compatibility with theOutputSupplierinterface and should not be called directly. UseopenStream()instead.This method is a temporary method provided for easing migration from suppliers to sources and sinks.- Specified by:
getOutputin interfaceOutputSupplier<OutputStream>- Throws:
IOException- Since:
- 15.0
-
openBufferedStream
Deprecated.Opens a new bufferedOutputStreamfor writing to this sink. The returned stream is not required to be aBufferedOutputStreamin order to allow implementations to simply delegate toopenStream()when the stream returned by that method does not benefit from additional buffering (for example, aByteArrayOutputStream). This method should return a new, independent stream each time it is called.The caller is responsible for ensuring that the returned stream is closed.
- Throws:
IOException- if an I/O error occurs in the process of opening the stream- Since:
- 15.0 (in 14.0 with return type
BufferedOutputStream)
-
write
Deprecated.Writes all the given bytes to this sink.- Throws:
IOException- if an I/O occurs in the process of writing to this sink
-
writeFrom
Deprecated.Writes all the bytes from the givenInputStreamto this sink. Does not closeinput.- Throws:
IOException- if an I/O occurs in the process of reading frominputor writing to this sink
-