Class WrappedByteArrayOutputStream

java.lang.Object
java.io.OutputStream
org.bouncycastle.util.io.WrappedByteArrayOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class WrappedByteArrayOutputStream extends OutputStream
An output stream limited in size to the underlying byte array backing it.
  • Constructor Details

    • WrappedByteArrayOutputStream

      public WrappedByteArrayOutputStream()
  • Method Details

    • setBuffer

      public void setBuffer(byte[] output)
    • setBuffer

      public void setBuffer(byte[] output, int outputOffset)
    • write

      public void write(byte[] in) throws IOException
      Overrides:
      write in class OutputStream
      Throws:
      IOException
    • write

      public void write(byte[] in, int inOff, int inLen) throws IOException
      Overrides:
      write in class OutputStream
      Throws:
      IOException
    • write

      public void write(int in) throws IOException
      Specified by:
      write in class OutputStream
      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()