Package nom.tam.util

Class BufferDecoder


  • public abstract class BufferDecoder
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract void checkBuffer​(int needBytes)
      This should only be used when a small number of bytes is required (substantially smaller than bufferSize.
      protected abstract int eofCheck​(java.io.EOFException e, int start, int index, int length)  
      protected int read​(boolean[] b, int start, int length)  
      protected int read​(byte[] buf, int offset, int len)  
      protected int read​(char[] c, int start, int length)  
      protected int read​(double[] d, int start, int length)  
      protected int read​(float[] f, int start, int length)  
      protected int read​(int[] i, int start, int length)  
      protected int read​(long[] l, int start, int length)  
      protected int read​(short[] s, int start, int length)  
      protected boolean readBoolean()  
      protected char readChar()  
      protected double readDouble()  
      protected float readFloat()  
      protected void readFully​(byte[] b, int off, int len)  
      protected int readInt()  
      protected long readLArray​(java.lang.Object o)  
      protected long readLong()  
      protected short readShort()  
      private int readUncheckedInt()  
      private int readUncheckedShort()  
      • Methods inherited from class java.lang.Object

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

      • BufferDecoder

        public BufferDecoder​(BufferPointer sharedBuffer)
    • Method Detail

      • checkBuffer

        protected abstract void checkBuffer​(int needBytes)
                                     throws java.io.IOException
        This should only be used when a small number of bytes is required (substantially smaller than bufferSize.
        Parameters:
        needBytes - the number of bytes needed for the next operation.
        Throws:
        java.io.IOException - if the buffer could not be filled
      • eofCheck

        protected abstract int eofCheck​(java.io.EOFException e,
                                        int start,
                                        int index,
                                        int length)
                                 throws java.io.EOFException
        Throws:
        java.io.EOFException
      • read

        protected int read​(boolean[] b,
                           int start,
                           int length)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        protected int read​(byte[] buf,
                           int offset,
                           int len)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        protected int read​(char[] c,
                           int start,
                           int length)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        protected int read​(double[] d,
                           int start,
                           int length)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        protected int read​(float[] f,
                           int start,
                           int length)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        protected int read​(int[] i,
                           int start,
                           int length)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        protected int read​(long[] l,
                           int start,
                           int length)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        protected int read​(short[] s,
                           int start,
                           int length)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • readBoolean

        protected boolean readBoolean()
                               throws java.io.IOException
        Returns:
        a boolean from the buffer
        Throws:
        java.io.IOException - if the underlying operation fails
      • readChar

        protected char readChar()
                         throws java.io.IOException
        Returns:
        a char from the buffer
        Throws:
        java.io.IOException - if the underlying operation fails
      • readInt

        protected int readInt()
                       throws java.io.IOException
        Returns:
        an integer value from the buffer
        Throws:
        java.io.IOException - if the underlying operation fails
      • readLArray

        protected long readLArray​(java.lang.Object o)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • readLong

        protected long readLong()
                         throws java.io.IOException
        Returns:
        a long value from the buffer
        Throws:
        java.io.IOException - if the underlying operation fails
      • readDouble

        protected double readDouble()
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • readFloat

        protected float readFloat()
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • readFully

        protected void readFully​(byte[] b,
                                 int off,
                                 int len)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • readShort

        protected short readShort()
                           throws java.io.IOException
        Returns:
        a short from the buffer
        Throws:
        java.io.IOException - if the underlying operation fails
      • readUncheckedInt

        private int readUncheckedInt()
      • readUncheckedShort

        private int readUncheckedShort()