BinDrvReader
- java.lang.Object
-
- com.dashoptimization.BinDrvReader
-
public class BinDrvReader extends java.lang.Object
A class to read Mosel's 'bin' data
-
-
Field Summary
Modifier and Type Field and Description static int
CTRL_CLOSELST
static int
CTRL_CLOSENDX
static int
CTRL_LABEL
static int
CTRL_OPENLST
static int
CTRL_OPENNDX
static int
CTRL_SKIP
static int
TYP_BOOL
static int
TYP_CTRL
static int
TYP_INT
static int
TYP_INTM
static int
TYP_INTP
static int
TYP_LONG
static int
TYP_REAL
static int
TYP_STR
static int
TYP_VOID
-
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.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.
-
-
-
Field Detail
-
TYP_INTP
public static final int TYP_INTP
- See Also:
- Constant Field Values
-
TYP_INTM
public static final int TYP_INTM
- See Also:
- Constant Field Values
-
TYP_INT
public static final int TYP_INT
- See Also:
- Constant Field Values
-
TYP_VOID
public static final int TYP_VOID
- See Also:
- Constant Field Values
-
TYP_REAL
public static final int TYP_REAL
- See Also:
- Constant Field Values
-
TYP_STR
public static final int TYP_STR
- See Also:
- Constant Field Values
-
TYP_BOOL
public static final int TYP_BOOL
- See Also:
- Constant Field Values
-
TYP_CTRL
public static final int TYP_CTRL
- See Also:
- Constant Field Values
-
TYP_LONG
public static final int TYP_LONG
- See Also:
- Constant Field Values
-
CTRL_SKIP
public static final int CTRL_SKIP
- See Also:
- Constant Field Values
-
CTRL_LABEL
public static final int CTRL_LABEL
- See Also:
- Constant Field Values
-
CTRL_OPENLST
public static final int CTRL_OPENLST
- See Also:
- Constant Field Values
-
CTRL_CLOSELST
public static final int CTRL_CLOSELST
- See Also:
- Constant Field Values
-
CTRL_OPENNDX
public static final int CTRL_OPENNDX
- See Also:
- Constant Field Values
-
CTRL_CLOSENDX
public static final int CTRL_CLOSENDX
- See Also:
- Constant Field Values
-
-
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
-
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
-
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
-
-
© 2001-2019 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.