Class FastByteArrayOutputStream

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

    public class FastByteArrayOutputStream
    extends java.io.OutputStream
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected byte[] buf
      The buffer where data is stored.
      protected int count
      The number of valid bytes in the buffer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getBytes()  
      void reset()  
      int size()  
      byte[] toByteArray()  
      void write​(byte[] b, int off, int len)  
      void write​(int b)  
      • Methods inherited from class java.io.OutputStream

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

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

      • buf

        protected byte[] buf
        The buffer where data is stored.
      • count

        protected int count
        The number of valid bytes in the buffer.
    • Constructor Detail

      • FastByteArrayOutputStream

        public FastByteArrayOutputStream()
      • FastByteArrayOutputStream

        public FastByteArrayOutputStream​(int size)
    • Method Detail

      • getBytes

        public byte[] getBytes()
      • reset

        public void reset()
      • size

        public int size()
      • toByteArray

        public byte[] toByteArray()
      • write

        public void write​(byte[] b,
                          int off,
                          int len)
        Overrides:
        write in class java.io.OutputStream
      • write

        public void write​(int b)
        Specified by:
        write in class java.io.OutputStream