Class ByteArrayIOFileStream

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

    public class ByteArrayIOFileStream
    extends ByteArrayIOStream
    Shared input / outputStream class write once, read many...
    • Constructor Detail

      • ByteArrayIOFileStream

        public ByteArrayIOFileStream​(long maxLength)
        creates an empty input output stream class
        Parameters:
        maxLength - the maximum length in memory
      • ByteArrayIOFileStream

        public ByteArrayIOFileStream​(java.io.InputStream is,
                                     long maxLength)
        creates an input output stream class from any stream if is already is a buffered inputstream, no copy is made
        Parameters:
        is - the inputstream to buffer
        maxLength - the maximum length in memory
      • ByteArrayIOFileStream

        public ByteArrayIOFileStream​(java.io.File f,
                                     long maxLength,
                                     boolean readOnly)
        create a ByteArrayIOStream from a file
        Parameters:
        f - the file
        maxLength - the maximum length in memory
        readOnly -
        Throws:
        java.io.IOException
    • Method Detail

      • getBufferedInputStream

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

        public void write​(int b)
        Writes the specified byte to this byte array output stream.
        Overrides:
        write in class java.io.ByteArrayOutputStream
        Parameters:
        b - the byte to be written.
      • write

        public void write​(byte[] b,
                          int off,
                          int len)
        Writes len bytes from the specified byte array starting at offset off to this byte array output stream.
        Overrides:
        write in class java.io.ByteArrayOutputStream
        Parameters:
        b - the data.
        off - the start offset in the data.
        len - the number of bytes to write.
      • close

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

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable
      • size

        public int size()
        Overrides:
        size in class java.io.ByteArrayOutputStream
        Returns:
      • getFile

        public java.io.File getFile()
        Returns:
        the file