Class MutableByteArrayOutputStream

  • All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

    public final class MutableByteArrayOutputStream
    extends ByteArrayOutputStream
    This class doesn't work yet, but is here to show the idea of a ByteArrayOutputStream where you can track how many bytes you've already written, and go back and write over a previous part of the stream
    • Constructor Detail

      • MutableByteArrayOutputStream

        public MutableByteArrayOutputStream()
    • Method Detail

      • getBytesWritten

        public int getBytesWritten()
        Return how many bytes we've stuffed in so far
      • write

        public void write​(byte[] b)
        Write some bytes to the array
        write in class OutputStream
      • overwrite

        public void overwrite​(byte[] b,
                              int startPos)
        Write some bytes to an earlier bit of the array