Package org.bouncycastle.util.io
Class WrappedByteArrayOutputStream
java.lang.Object
java.io.OutputStream
org.bouncycastle.util.io.WrappedByteArrayOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
An output stream limited in size to the underlying byte array backing it.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiderase()byte[]Return a reference to the internal buffer.'intvoidmoveOffset(int delta) Move the offset pointer for the next write.voidsetBuffer(byte[] output) voidsetBuffer(byte[] output, int outputOffset) intsize()byte[]Return a trimmed copy of the current buffer, the whole buffer if it's full.voidwrite(byte[] in) voidwrite(byte[] in, int inOff, int inLen) voidwrite(int in) Methods inherited from class java.io.OutputStream
close, flush, nullOutputStream
-
Constructor Details
-
WrappedByteArrayOutputStream
public WrappedByteArrayOutputStream()
-
-
Method Details
-
setBuffer
public void setBuffer(byte[] output) -
setBuffer
public void setBuffer(byte[] output, int outputOffset) -
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
size
public int size() -
getBuffer
public byte[] getBuffer()Return a reference to the internal buffer.'- Returns:
- a reference to buf.
-
moveOffset
public void moveOffset(int delta) Move the offset pointer for the next write.- Parameters:
delta- offset point change
-
toTrimmedByteArray
public byte[] toTrimmedByteArray()Return a trimmed copy of the current buffer, the whole buffer if it's full.- Returns:
- a copy if full, or a trimmed version.
-
erase
public void erase() -
getOffset
public int getOffset()
-