Class TestableByteArrayOutputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    @Beta
    public class TestableByteArrayOutputStream
    extends java.io.ByteArrayOutputStream
    Beta
    Testable extension for a byte array output stream.
    Since:
    1.14
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean closed
      Whether the output stream has been closed.
      • Fields inherited from class java.io.ByteArrayOutputStream

        buf, count
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      byte[] getBuffer()
      Returns the written buffer value as a modifiable byte array.
      boolean isClosed()
      Returns whether the output stream has been closed.
      • Methods inherited from class java.io.ByteArrayOutputStream

        reset, size, toByteArray, toString, toString, toString, write, write, writeTo
      • Methods inherited from class java.io.OutputStream

        flush, write
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • closed

        private boolean closed
        Whether the output stream has been closed.
    • Constructor Detail

      • TestableByteArrayOutputStream

        public TestableByteArrayOutputStream()
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException

        Overriding is supported, but overriding method must call the super implementation.

        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.ByteArrayOutputStream
        Throws:
        java.io.IOException
      • getBuffer

        public final byte[] getBuffer()
        Returns the written buffer value as a modifiable byte array.
      • isClosed

        public final boolean isClosed()
        Returns whether the output stream has been closed.