BinDrvWriter
- java.lang.Object
-
- com.dashoptimization.BinDrvWriter
-
public class BinDrvWriter extends java.lang.Object
A class to generate 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_LAST
static int
CTRL_OPENLST
static int
CTRL_OPENNDX
static int
CTRL_SKIP
static int
TYP_BOOL
static int
TYP_CTRL
static int
TYP_DATA
static int
TYP_INT
static int
TYP_INTM
static int
TYP_INTP
static int
TYP_REAL
static int
TYP_STR
-
Constructor Summary
Constructor and Description BinDrvWriter(java.io.OutputStream outf)
Create a 'BinDrvWriter' from an OutputStream setting UTF-8 as the encoding.BinDrvWriter(java.io.OutputStream outf, java.lang.String enc)
Create a 'BinDrvWriter' from an OutputStream.
-
Method Summary
Modifier and Type Method and Description BinDrvWriter
put(boolean b)
Write a Boolean to the output stream.BinDrvWriter
put(byte[] bs)
Write a data block to the output stream.BinDrvWriter
put(byte[] bs, int off, int len)
Write a data block to the output stream.static void
put(java.nio.ByteBuffer bb, boolean b)
Append a Boolean to the given buffer.static void
put(java.nio.ByteBuffer bb, byte[] bs)
Append a data block to the given buffer.static void
put(java.nio.ByteBuffer bb, byte[] bs, int off, int len)
Append a data block to the given buffer.static void
put(java.nio.ByteBuffer bb, double r)
Append a real (double) to the given buffer.static void
put(java.nio.ByteBuffer bb, int i)
Append an integer to the given buffer.static void
put(java.nio.ByteBuffer bb, long i)
Append a long integer to the given buffer.static void
put(java.nio.ByteBuffer bb, java.lang.String s)
Append a text string to the given buffer using the UTF-8 encoding.static void
put(java.nio.ByteBuffer bb, java.lang.String s, java.lang.String enc)
Append a text string to the given buffer.BinDrvWriter
put(double r)
Write a real (double) to the output stream.BinDrvWriter
put(int i)
Write an integer to the output stream.BinDrvWriter
put(long i)
Write a long integer to the output stream.BinDrvWriter
put(java.lang.String s)
Write a text string to the output stream.static void
putControl(java.nio.ByteBuffer bb, int c)
Append a control code to the given buffer.BinDrvWriter
putControl(int c)
Write a control code to the output stream.
-
-
-
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_DATA
public static final int TYP_DATA
- 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
-
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
-
CTRL_LAST
public static final int CTRL_LAST
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BinDrvWriter
public BinDrvWriter(java.io.OutputStream outf, java.lang.String enc)
Create a 'BinDrvWriter' from an OutputStream.- Parameters:
-
outf
- stream to which data is written -
enc
- character encoding
-
BinDrvWriter
public BinDrvWriter(java.io.OutputStream outf)
Create a 'BinDrvWriter' from an OutputStream setting UTF-8 as the encoding.- Parameters:
-
outf
- stream to which data is written
-
-
Method Detail
-
put
public BinDrvWriter put(int i) throws java.io.IOException
Write an integer to the output stream.- Parameters:
-
i
- value to write - Returns:
- the current writer
- Throws:
-
java.io.IOException
- in case of IO error
-
put
public BinDrvWriter put(long i) throws java.io.IOException
Write a long integer to the output stream.- Parameters:
-
i
- value to write - Returns:
- the current writer
- Throws:
-
java.io.IOException
- in case of IO error
-
put
public BinDrvWriter put(double r) throws java.io.IOException
Write a real (double) to the output stream.- Parameters:
-
r
- value to write - Returns:
- the current writer
- Throws:
-
java.io.IOException
- in case of IO error
-
put
public BinDrvWriter put(boolean b) throws java.io.IOException
Write a Boolean to the output stream.- Parameters:
-
b
- value to write - Returns:
- the current writer
- Throws:
-
java.io.IOException
- in case of IO error
-
put
public BinDrvWriter put(java.lang.String s) throws java.io.IOException
Write a text string to the output stream.- Parameters:
-
s
- value to write - Returns:
- the current writer
- Throws:
-
java.io.IOException
- in case of IO error
-
put
public BinDrvWriter put(byte[] bs, int off, int len) throws java.io.IOException
Write a data block to the output stream.- Parameters:
-
bs
- data to write -
off
- start offset in the data -
len
- number of bytes to write - Returns:
- the current writer
- Throws:
-
java.io.IOException
- in case of IO error
-
put
public BinDrvWriter put(byte[] bs) throws java.io.IOException
Write a data block to the output stream.- Parameters:
-
bs
- data to write - Returns:
- the current writer
- Throws:
-
java.io.IOException
- in case of IO error
-
putControl
public BinDrvWriter putControl(int c) throws java.io.IOException
Write a control code to the output stream.- Parameters:
-
c
- value to write - Returns:
- the current writer
- Throws:
-
java.io.IOException
- in case of IO error
-
put
public static void put(java.nio.ByteBuffer bb, int i)
Append an integer to the given buffer.- Parameters:
-
bb
- destination buffer -
i
- value to write
-
put
public static void put(java.nio.ByteBuffer bb, long i)
Append a long integer to the given buffer.- Parameters:
-
bb
- destination buffer -
i
- value to write
-
put
public static void put(java.nio.ByteBuffer bb, double r)
Append a real (double) to the given buffer.- Parameters:
-
bb
- destination buffer -
r
- value to write
-
put
public static void put(java.nio.ByteBuffer bb, boolean b)
Append a Boolean to the given buffer.- Parameters:
-
bb
- destination buffer -
b
- value to write
-
put
public static void put(java.nio.ByteBuffer bb, java.lang.String s, java.lang.String enc)
Append a text string to the given buffer.- Parameters:
-
bb
- destination buffer -
s
- value to write -
enc
- character encoding
-
put
public static void put(java.nio.ByteBuffer bb, java.lang.String s)
Append a text string to the given buffer using the UTF-8 encoding.- Parameters:
-
bb
- destination buffer -
s
- value to write
-
put
public static void put(java.nio.ByteBuffer bb, byte[] bs, int off, int len)
Append a data block to the given buffer.- Parameters:
-
bb
- destination buffer -
bs
- data to write -
off
- start offset in the data -
len
- number of bytes to write
-
put
public static void put(java.nio.ByteBuffer bb, byte[] bs)
Append a data block to the given buffer.- Parameters:
-
bb
- destination buffer -
bs
- data to write
-
putControl
public static void putControl(java.nio.ByteBuffer bb, int c)
Append a control code to the given buffer.- Parameters:
-
bb
- destination buffer -
c
- value to write
-
-