Class CellBufferInputStream

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

    final class CellBufferInputStream
    extends java.io.InputStream
    implements CellInput
    This is a reusable cell stream object that is extended from the ByteArrayInputStream class, which provides methods for reusing the object on a different byte[] arrays. It is used as an efficient way of reading cell information from a binary fixed length cell type file.

    It would usually be wrapped in a DataInputStream object.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private byte[] buf  
      private char[] char_buffer  
      private int count  
      private int mark  
      private int pos  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()  
      void close()  
      void mark​(int readAheadLimit)  
      int read()
      Sped up methods.
      int read​(byte[] b, int off, int len)  
      boolean readBoolean()  
      byte readByte()  
      char readChar()  
      java.lang.String readChars​(int length)
      Reads a string of chars from the input stream up to the given length and returns it as a String object.
      double readDouble()  
      float readFloat()  
      void readFully​(byte[] b)  
      void readFully​(byte[] b, int off, int len)  
      int readInt()  
      java.lang.String readLine()  
      long readLong()  
      short readShort()  
      int readUnsignedByte()  
      int readUnsignedShort()  
      java.lang.String readUTF()  
      void reset()  
      (package private) void setArray​(byte[] new_buffer)
      Sets up the stream to the start of the underlying array.
      (package private) void setArray​(byte[] new_buffer, int offset, int length)
      Sets up the stream to the underlying array with the given variables.
      long skip​(long n)  
      int skipBytes​(int n)  
      • Methods inherited from class java.io.InputStream

        markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, transferTo
      • Methods inherited from class java.lang.Object

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

      • buf

        private byte[] buf
      • pos

        private int pos
      • mark

        private int mark
      • count

        private int count
      • char_buffer

        private char[] char_buffer
    • Constructor Detail

      • CellBufferInputStream

        CellBufferInputStream()
        The Constructor.
    • Method Detail

      • setArray

        void setArray​(byte[] new_buffer)
        Sets up the stream to the start of the underlying array.
      • setArray

        void setArray​(byte[] new_buffer,
                      int offset,
                      int length)
        Sets up the stream to the underlying array with the given variables.
      • read

        public int read()
        Sped up methods.
        Specified by:
        read in class java.io.InputStream
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
        Overrides:
        read in class java.io.InputStream
      • skip

        public long skip​(long n)
        Overrides:
        skip in class java.io.InputStream
      • available

        public int available()
        Overrides:
        available in class java.io.InputStream
      • mark

        public void mark​(int readAheadLimit)
        Overrides:
        mark in class java.io.InputStream
      • reset

        public void reset()
        Overrides:
        reset in class java.io.InputStream
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.InputStream
        Throws:
        java.io.IOException
      • readFully

        public void readFully​(byte[] b)
                       throws java.io.IOException
        Specified by:
        readFully in interface java.io.DataInput
        Throws:
        java.io.IOException
      • readFully

        public void readFully​(byte[] b,
                              int off,
                              int len)
                       throws java.io.IOException
        Specified by:
        readFully in interface java.io.DataInput
        Throws:
        java.io.IOException
      • skipBytes

        public int skipBytes​(int n)
                      throws java.io.IOException
        Specified by:
        skipBytes in interface java.io.DataInput
        Throws:
        java.io.IOException
      • readBoolean

        public boolean readBoolean()
                            throws java.io.IOException
        Specified by:
        readBoolean in interface java.io.DataInput
        Throws:
        java.io.IOException
      • readByte

        public byte readByte()
                      throws java.io.IOException
        Specified by:
        readByte in interface java.io.DataInput
        Throws:
        java.io.IOException
      • readUnsignedByte

        public int readUnsignedByte()
                             throws java.io.IOException
        Specified by:
        readUnsignedByte in interface java.io.DataInput
        Throws:
        java.io.IOException
      • readShort

        public short readShort()
                        throws java.io.IOException
        Specified by:
        readShort in interface java.io.DataInput
        Throws:
        java.io.IOException
      • readUnsignedShort

        public int readUnsignedShort()
                              throws java.io.IOException
        Specified by:
        readUnsignedShort in interface java.io.DataInput
        Throws:
        java.io.IOException
      • readChar

        public char readChar()
                      throws java.io.IOException
        Specified by:
        readChar in interface java.io.DataInput
        Throws:
        java.io.IOException
      • readChars

        public java.lang.String readChars​(int length)
                                   throws java.io.IOException
        Description copied from interface: CellInput
        Reads a string of chars from the input stream up to the given length and returns it as a String object.
        Specified by:
        readChars in interface CellInput
        Throws:
        java.io.IOException
      • readInt

        public int readInt()
                    throws java.io.IOException
        Specified by:
        readInt in interface java.io.DataInput
        Throws:
        java.io.IOException
      • readLong

        public long readLong()
                      throws java.io.IOException
        Specified by:
        readLong in interface java.io.DataInput
        Throws:
        java.io.IOException
      • readFloat

        public float readFloat()
                        throws java.io.IOException
        Specified by:
        readFloat in interface java.io.DataInput
        Throws:
        java.io.IOException
      • readDouble

        public double readDouble()
                          throws java.io.IOException
        Specified by:
        readDouble in interface java.io.DataInput
        Throws:
        java.io.IOException
      • readLine

        public java.lang.String readLine()
                                  throws java.io.IOException
        Specified by:
        readLine in interface java.io.DataInput
        Throws:
        java.io.IOException
      • readUTF

        public java.lang.String readUTF()
                                 throws java.io.IOException
        Specified by:
        readUTF in interface java.io.DataInput
        Throws:
        java.io.IOException