Class ByteArrayOutputStreamProvider
java.lang.Object
com.helger.base.io.streamprovider.ByteArrayOutputStreamProvider
- All Implemented Interfaces:
IHasOutputStream,IHasOutputStreamAndWriter
An
OutputStream provider based on a byte array.- Author:
- Philip Helger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal @NonNull StringgetAsString(@NonNull Charset aCharset) final byte @NonNull []getBytes()final @NonNull NonBlockingByteArrayOutputStreamgetOutputStream(@NonNull EAppend eAppend) Get the output stream to read from the object.final booleanCheck if theOutputStreamfromIHasOutputStream.getOutputStream(EAppend)orIHasOutputStream.getBufferedOutputStream(EAppend)can be acquired more than once or not.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.base.io.iface.IHasOutputStream
getBufferedOutputStreamMethods inherited from interface com.helger.base.io.iface.IHasOutputStreamAndWriter
getBufferedWriter, getWriter
-
Constructor Details
-
ByteArrayOutputStreamProvider
public ByteArrayOutputStreamProvider()Create a new empty instance.
-
-
Method Details
-
getOutputStream
Get the output stream to read from the object. Each time this method is call, a newOutputStreamneeds to be created!- Specified by:
getOutputStreamin interfaceIHasOutputStream- Parameters:
eAppend- appending mode. May not benull.- Returns:
nullif resolving failed.
-
isWriteMultiple
public final boolean isWriteMultiple()Check if theOutputStreamfromIHasOutputStream.getOutputStream(EAppend)orIHasOutputStream.getBufferedOutputStream(EAppend)can be acquired more than once or not.- Specified by:
isWriteMultiplein interfaceIHasOutputStream- Returns:
trueif the output stream can be acquired more than once,falseif not.
-
getBytes
@ReturnsMutableCopy public final byte @NonNull [] getBytes()- Returns:
- All bytes already written
-
getAsString
- Parameters:
aCharset- The charset to use for converting the bytes to a String. May not benull.- Returns:
- All bytes already written as a String. Never
null.
-
toString
-