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 TypeMethodDescriptionvoid
erase()
byte[]
Return a reference to the internal buffer.'int
void
moveOffset
(int delta) Move the offset pointer for the next write.void
setBuffer
(byte[] output) void
setBuffer
(byte[] output, int outputOffset) int
size()
byte[]
Return a trimmed copy of the current buffer, the whole buffer if it's full.void
write
(byte[] in) void
write
(byte[] in, int inOff, int inLen) void
write
(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:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Specified by:
write
in 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()
-