Class TestableByteArrayInputStream

java.lang.Object
java.io.InputStream
java.io.ByteArrayInputStream
com.google.api.client.testing.util.TestableByteArrayInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

@Beta public class TestableByteArrayInputStream extends ByteArrayInputStream
Beta
Testable extension for a byte array input stream.
Since:
1.14
  • Field Details

    • closed

      private boolean closed
      Whether the input stream has been closed.
  • Constructor Details

    • TestableByteArrayInputStream

      public TestableByteArrayInputStream(byte[] buf)
      Parameters:
      buf - buffer
    • TestableByteArrayInputStream

      public TestableByteArrayInputStream(byte[] buf, int offset, int length)
      Parameters:
      buf - buffer
      offset - offset in the buffer of the first byte to read
      length - maximum number of bytes to read from the buffer
  • Method Details

    • close

      public void close() throws IOException

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

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class ByteArrayInputStream
      Throws:
      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.