Class ByteArrayOutputStreamProvider
- java.lang.Object
-
- com.helger.commons.io.streamprovider.ByteArrayOutputStreamProvider
-
- All Implemented Interfaces:
IHasOutputStream,IHasOutputStreamAndWriter
public class ByteArrayOutputStreamProvider extends Object implements IHasOutputStreamAndWriter
AnOutputStreamprovider based on a byte array.- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description ByteArrayOutputStreamProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAsString(Charset aCharset)byte[]getBytes()NonBlockingByteArrayOutputStreamgetOutputStream(EAppend eAppend)Get the output stream to read from the object.booleanisWriteMultiple()Check if theOutputStreamfromIHasOutputStream.getOutputStream(EAppend)orIHasOutputStream.getBufferedOutputStream(EAppend)can be acquired more than once or not.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.commons.io.IHasOutputStream
getBufferedOutputStream
-
Methods inherited from interface com.helger.commons.io.IHasOutputStreamAndWriter
getBufferedWriter, getWriter
-
-
-
-
Method Detail
-
getOutputStream
@Nonnull public final NonBlockingByteArrayOutputStream getOutputStream(@Nonnull EAppend eAppend)
Description copied from interface:IHasOutputStreamGet 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()
Description copied from interface:IHasOutputStreamCheck 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
@Nonnull @ReturnsMutableCopy public final byte[] getBytes()
- Returns:
- All bytes already written
-
-