Class ByteArrayIOStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable
    Direct Known Subclasses:
    ByteArrayIOFileStream

    public class ByteArrayIOStream
    extends java.io.ByteArrayOutputStream
    Shared input / outputStream class write once, read many...
    • Field Summary

      • Fields inherited from class java.io.ByteArrayOutputStream

        buf, count
    • Constructor Summary

      Constructors 
      Constructor Description
      ByteArrayIOStream()
      creates an empty input output stream class
      ByteArrayIOStream​(byte[] b)
      creates a sized input output stream class
      ByteArrayIOStream​(int i)
      creates a sized input output stream class
      ByteArrayIOStream​(java.io.File f)
      create a ByteArrayIOStream from a file
      ByteArrayIOStream​(java.io.InputStream is)
      creates an input output stream class from any stream if is alraedy is a buffered inputstream, no copy is made
    • Constructor Detail

      • ByteArrayIOStream

        public ByteArrayIOStream()
        creates an empty input output stream class
      • ByteArrayIOStream

        public ByteArrayIOStream​(int i)
        creates a sized input output stream class
        Parameters:
        i - the size of the stream
      • ByteArrayIOStream

        public ByteArrayIOStream​(java.io.InputStream is)
        creates an input output stream class from any stream if is alraedy is a buffered inputstream, no copy is made
        Parameters:
        is - the inputstream to buffer
      • ByteArrayIOStream

        public ByteArrayIOStream​(java.io.File f)
                          throws java.io.IOException
        create a ByteArrayIOStream from a file
        Parameters:
        f - the file
        Throws:
        java.io.IOException
      • ByteArrayIOStream

        public ByteArrayIOStream​(byte[] b)
        creates a sized input output stream class
        Parameters:
        b - the buffer to use (is NOT copied)
    • Method Detail

      • getBufferedInputStream

        public static ByteArrayIOStream.ByteArrayIOInputStream getBufferedInputStream​(java.io.InputStream is)
        get a completely buffered and resizable input stream
        Parameters:
        is -
        Returns:
      • getInputStream

        public ByteArrayIOStream.ByteArrayIOInputStream getInputStream()
        gets an input stream based on the current byte contents and positions - note this operates on the internal data
        Returns:
        an input stream
      • getNewStream

        public ByteArrayIOStream.ByteArrayIOInputStream getNewStream()
        gets an input stream starting at 0 based on the current byte contents - note this operates on the internal data
        Returns:
        an input stream
      • getBuf

        public byte[] getBuf()
        get the internal buffer - be careful, this is THE buffer
        Returns:
        the internal buffer
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.io.ByteArrayOutputStream
        See Also:
        ByteArrayOutputStream.toString()
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.ByteArrayOutputStream
        See Also:
        ByteArrayOutputStream.close()