Class BufferedFileImageInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.DataInput, java.lang.AutoCloseable, javax.imageio.stream.ImageInputStream

    public final class BufferedFileImageInputStream
    extends javax.imageio.stream.ImageInputStreamImpl
    A buffered replacement for FileImageInputStream that provides greatly improved performance for shorter reads, like single byte or bit reads. As with javax.imageio.stream.FileImageInputStream, either File or RandomAccessFile can be used as input.
    See Also:
    FileImageInputStream
    • Field Summary

      • Fields inherited from class javax.imageio.stream.ImageInputStreamImpl

        bitOffset, byteOrder, flushedPos, streamPos
    • Constructor Summary

      Constructors 
      Constructor Description
      BufferedFileImageInputStream​(java.io.File file)
      Constructs a BufferedFileImageInputStream that will read from a given File.
      BufferedFileImageInputStream​(java.io.RandomAccessFile raf)
      Constructs a BufferedFileImageInputStream that will read from a given RandomAccessFile.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      long length()  
      int read()  
      int read​(byte[] pBuffer, int pOffset, int pLength)  
      int readInt()  
      long readLong()  
      short readShort()  
      void seek​(long position)  
      void setByteOrder​(java.nio.ByteOrder byteOrder)  
      • Methods inherited from class javax.imageio.stream.ImageInputStreamImpl

        checkClosed, finalize, flush, flushBefore, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, mark, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readLine, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, reset, setBitOffset, skipBytes, skipBytes
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BufferedFileImageInputStream

        public BufferedFileImageInputStream​(java.io.File file)
                                     throws java.io.FileNotFoundException
        Constructs a BufferedFileImageInputStream that will read from a given File.
        Parameters:
        file - a File to read from.
        Throws:
        java.lang.IllegalArgumentException - if file is null.
        java.io.FileNotFoundException - if file is a directory or cannot be opened for reading for any reason.
      • BufferedFileImageInputStream

        public BufferedFileImageInputStream​(java.io.RandomAccessFile raf)
        Constructs a BufferedFileImageInputStream that will read from a given RandomAccessFile.
        Parameters:
        raf - a RandomAccessFile to read from.
        Throws:
        java.lang.IllegalArgumentException - if raf is null.
    • Method Detail

      • setByteOrder

        public void setByteOrder​(java.nio.ByteOrder byteOrder)
        Specified by:
        setByteOrder in interface javax.imageio.stream.ImageInputStream
        Overrides:
        setByteOrder in class javax.imageio.stream.ImageInputStreamImpl
      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read in interface javax.imageio.stream.ImageInputStream
        Specified by:
        read in class javax.imageio.stream.ImageInputStreamImpl
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] pBuffer,
                        int pOffset,
                        int pLength)
                 throws java.io.IOException
        Specified by:
        read in interface javax.imageio.stream.ImageInputStream
        Specified by:
        read in class javax.imageio.stream.ImageInputStreamImpl
        Throws:
        java.io.IOException
      • length

        public long length()
        Specified by:
        length in interface javax.imageio.stream.ImageInputStream
        Overrides:
        length in class javax.imageio.stream.ImageInputStreamImpl
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface javax.imageio.stream.ImageInputStream
        Overrides:
        close in class javax.imageio.stream.ImageInputStreamImpl
        Throws:
        java.io.IOException
      • readShort

        public short readShort()
                        throws java.io.IOException
        Specified by:
        readShort in interface java.io.DataInput
        Specified by:
        readShort in interface javax.imageio.stream.ImageInputStream
        Overrides:
        readShort in class javax.imageio.stream.ImageInputStreamImpl
        Throws:
        java.io.IOException
      • readInt

        public int readInt()
                    throws java.io.IOException
        Specified by:
        readInt in interface java.io.DataInput
        Specified by:
        readInt in interface javax.imageio.stream.ImageInputStream
        Overrides:
        readInt in class javax.imageio.stream.ImageInputStreamImpl
        Throws:
        java.io.IOException
      • readLong

        public long readLong()
                      throws java.io.IOException
        Specified by:
        readLong in interface java.io.DataInput
        Specified by:
        readLong in interface javax.imageio.stream.ImageInputStream
        Overrides:
        readLong in class javax.imageio.stream.ImageInputStreamImpl
        Throws:
        java.io.IOException
      • seek

        public void seek​(long position)
                  throws java.io.IOException
        Specified by:
        seek in interface javax.imageio.stream.ImageInputStream
        Overrides:
        seek in class javax.imageio.stream.ImageInputStreamImpl
        Throws:
        java.io.IOException