Class UnsyncByteArrayOutputStream

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

    public class UnsyncByteArrayOutputStream
    extends java.io.OutputStream
    A simple Unsynced ByteArrayOutputStream
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void expandSize​(int newPos)  
      void reset()  
      byte[] toByteArray()  
      void write​(byte[] arg0)  
      void write​(byte[] arg0, int arg1, int arg2)  
      void write​(int arg0)  
      void writeTo​(java.io.OutputStream out)
      Takes the contents of this stream and writes it to the output stream out.
      • Methods inherited from class java.io.OutputStream

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

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

      • VM_ARRAY_INDEX_MAX_VALUE

        private static final int VM_ARRAY_INDEX_MAX_VALUE
        See Also:
        Constant Field Values
      • buf

        private byte[] buf
      • size

        private int size
      • pos

        private int pos
    • Constructor Detail

      • UnsyncByteArrayOutputStream

        public UnsyncByteArrayOutputStream()
    • Method Detail

      • write

        public void write​(byte[] arg0)
        Overrides:
        write in class java.io.OutputStream
      • write

        public void write​(byte[] arg0,
                          int arg1,
                          int arg2)
        Overrides:
        write in class java.io.OutputStream
      • write

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

        public byte[] toByteArray()
      • reset

        public void reset()
      • writeTo

        public void writeTo​(java.io.OutputStream out)
                     throws java.io.IOException
        Takes the contents of this stream and writes it to the output stream out.
        Parameters:
        out - an OutputStream on which to write the contents of this stream.
        Throws:
        java.io.IOException - if an error occurs while writing to out.
      • expandSize

        private void expandSize​(int newPos)