Initializing help system before first use

BinDrvReader

  • java.lang.Object
    • com.dashoptimization.BinDrvReader


  • public class BinDrvReader
    extends java.lang.Object
    A class to read Mosel's 'bin' data
    • Constructor Summary

      Constructor and Description
      BinDrvReader(java.io.InputStream inf)
      Create a 'BinDrvReader' from an InputStream setting UTF-8 as the encoding.
      BinDrvReader(java.io.InputStream inf, java.lang.String enc)
      Create a 'BinDrvReader' from an InputStream.
    • Method Summary

      Modifier and Type Method and Description
      boolean getBoolean()
      Read a Boolean from the input stream.
      static boolean getBoolean(java.nio.ByteBuffer bb)
      Read a Boolean from given buffer.
      int getControl()
      Read a control code from the input stream.
      static int getControl(java.nio.ByteBuffer bb)
      Read a control code from given buffer.
      byte[] getData()
      Read a data block from the input stream.
      static byte[] getData(java.nio.ByteBuffer bb)
      Read a data block from given buffer.
      int getInt()
      Read an integer from the input stream.
      static int getInt(java.nio.ByteBuffer bb)
      Read an integer from given buffer.
      long getLong()
      Read a long integer from the input stream.
      static long getLong(java.nio.ByteBuffer bb)
      Read a long integer from given buffer.
      double getReal()
      Read a real (double) from the input stream.
      static double getReal(java.nio.ByteBuffer bb)
      Read a real (double) from given buffer.
      java.lang.String getString()
      Read a text string from the input stream.
      static java.lang.String getString(java.nio.ByteBuffer bb)
      Read a text string from the given buffer using the UTF-8 encoding.
      static java.lang.String getString(java.nio.ByteBuffer bb, java.lang.String enc)
      Read a text string from given buffer.
      int nextToken()
      Get the type of the next available token.
      static int nextToken(java.nio.ByteBuffer bb)
      Get the type of the next available token.
      • Methods inherited from class java.lang.Object

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

      • BinDrvReader

        public BinDrvReader(java.io.InputStream inf,
                            java.lang.String enc)
        Create a 'BinDrvReader' from an InputStream.
        Parameters:
        inf - stream from which data is read
        enc - character encoding
      • BinDrvReader

        public BinDrvReader(java.io.InputStream inf)
        Create a 'BinDrvReader' from an InputStream setting UTF-8 as the encoding.
        Parameters:
        inf - stream from which data is read
    • Method Detail

      • nextToken

        public int nextToken()
                      throws java.io.IOException
        Get the type of the next available token.
        Returns:
        the next token type or -1 in case of end of file
        Throws:
        java.io.IOException - in case of IO error
      • getInt

        public int getInt()
                   throws java.io.IOException
        Read an integer from the input stream.
        Returns:
        next integer
        Throws:
        java.io.EOFException - if trying to read after the end of stream or an IOException in case of read error or the next token is not an integer
        java.io.IOException
      • getLong

        public long getLong()
                     throws java.io.IOException
        Read a long integer from the input stream.
        Returns:
        next long integer
        Throws:
        java.io.EOFException - if trying to read after the end of stream or an IOException in case of read error or the next token is not an integer
        java.io.IOException
      • getReal

        public double getReal()
                       throws java.io.IOException
        Read a real (double) from the input stream.
        Returns:
        next real
        Throws:
        java.io.EOFException - if trying to read after the end of stream or an IOException in case of read error or the next token is not a real
        java.io.IOException
      • getBoolean

        public boolean getBoolean()
                           throws java.io.IOException
        Read a Boolean from the input stream.
        Returns:
        next Boolean
        Throws:
        java.io.EOFException - if trying to read after the end of stream or an IOException in case of read error or the next token is not a Boolean
        java.io.IOException
      • getString

        public java.lang.String getString()
                                   throws java.io.IOException
        Read a text string from the input stream.
        Returns:
        next text string
        Throws:
        java.io.EOFException - if trying to read after the end of stream or an IOException in case of read error or the next token is not a string
        java.io.IOException
      • getData

        public byte[] getData()
                       throws java.io.IOException
        Read a data block from the input stream.
        Returns:
        next data block as an array of bytes or null for an empty block
        Throws:
        java.io.EOFException - if trying to read after the end of stream or an IOException in case of read error or the next token is not a data block
        java.io.IOException
      • getControl

        public int getControl()
                       throws java.io.IOException
        Read a control code from the input stream.
        Returns:
        next control code
        Throws:
        java.io.EOFException - if trying to read after the end of stream or an IOException in case of read error or the next token is not a control code
        java.io.IOException
      • nextToken

        public static int nextToken(java.nio.ByteBuffer bb)
        Get the type of the next available token.
        Parameters:
        bb - buffer from where data is read
        Returns:
        the next token type or -1 in case of end of buffer
      • getInt

        public static int getInt(java.nio.ByteBuffer bb)
                          throws java.io.EOFException
        Read an integer from given buffer.
        Parameters:
        bb - buffer from where data is read
        Returns:
        next integer
        Throws:
        java.io.EOFException - if trying to read after the end of the buffer or a RuntimeException in case the next token is not an integer
      • getLong

        public static long getLong(java.nio.ByteBuffer bb)
                            throws java.io.EOFException
        Read a long integer from given buffer.
        Parameters:
        bb - buffer from where data is read
        Returns:
        next long integer
        Throws:
        java.io.EOFException - if trying to read after the end of the buffer or a RuntimeException in case the next token is not an integer
      • getReal

        public static double getReal(java.nio.ByteBuffer bb)
                              throws java.io.EOFException
        Read a real (double) from given buffer.
        Parameters:
        bb - buffer from where data is read
        Returns:
        next real
        Throws:
        java.io.EOFException - if trying to read after the end of the buffer or a RuntimeException in case the next token is not a real
      • getBoolean

        public static boolean getBoolean(java.nio.ByteBuffer bb)
                                  throws java.io.EOFException
        Read a Boolean from given buffer.
        Parameters:
        bb - buffer from where data is read
        Returns:
        next Boolean
        Throws:
        java.io.EOFException - if trying to read after the end of the buffer or a RuntimeException in case the next token is not a Boolean
      • getString

        public static java.lang.String getString(java.nio.ByteBuffer bb,
                                                 java.lang.String enc)
                                          throws java.io.EOFException
        Read a text string from given buffer.
        Parameters:
        bb - buffer from where data is read
        enc - character encoding
        Returns:
        next text string
        Throws:
        java.io.EOFException - if trying to read after the end of the buffer or a RuntimeException in case the next token is not a string
      • getData

        public static byte[] getData(java.nio.ByteBuffer bb)
                              throws java.io.IOException
        Read a data block from given buffer.
        Parameters:
        bb - buffer from where data is read
        Returns:
        next data block as an array of bytes or null for an empty block
        Throws:
        java.io.EOFException - if trying to read after the end of the buffer or a RuntimeException in case the next token is not a data block
        java.io.IOException
      • getString

        public static java.lang.String getString(java.nio.ByteBuffer bb)
                                          throws java.io.EOFException
        Read a text string from the given buffer using the UTF-8 encoding.
        Parameters:
        bb - buffer from where data is read
        Returns:
        next text string
        Throws:
        java.io.EOFException - if trying to read after the end of the buffer or a RuntimeException in case the next token is not a string
      • getControl

        public static int getControl(java.nio.ByteBuffer bb)
                              throws java.io.EOFException
        Read a control code from given buffer.
        Parameters:
        bb - buffer from where data is read
        Returns:
        next control code
        Throws:
        java.io.EOFException - if trying to read after the end of the buffer or a RuntimeException in case the next token is not a control code