public class ImportBinary
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
BYTE |
static int |
DOUBLE |
static int |
FLOAT |
protected java.io.InputStream |
instream
the stream data is being input from
|
static int |
INT |
static int |
LONG |
static int |
SHORT |
Constructor and Description |
---|
ImportBinary(java.io.InputStream instream) |
Modifier and Type | Method and Description |
---|---|
static double |
byteToDouble(byte[] bytes,
int offset)
Converts the short bytes at the given offset into a double by packing the bytes in the correct order.
|
void |
close()
Closes the import binary and the underlying data stream
|
static double |
doubleBytesToDouble(byte[] bytes,
int offset)
Converts the double bytes at the given offset into a double by packing the bytes in the correct order.
|
static double |
floatBytesToDouble(byte[] bytes,
int offset)
Converts the float bytes at the given offset into a double by packing the bytes in the correct order.
|
int |
getActualRows() |
int |
getColumns() |
int |
getDataType() |
int |
getRows() |
static double |
intBytesToDouble(byte[] bytes,
int offset)
Converts the int bytes at the given offset into a double by packing the bytes in the correct order.
|
boolean |
isOneBytePerColumn() |
boolean |
isReverseByteOrder() |
static double |
longBytesToDouble(byte[] bytes,
int offset)
Converts the long bytes at the given offset into a double by packing the bytes in the correct order.
|
void |
nextDataSet()
Moves to the next data set in the input stream
|
boolean |
offset(int amount)
Offsets the data by the specified number of bytes/characters (returns fales if the end of input stream is
reached)
|
protected boolean |
readAdditionalRow()
Reads in an additional row when the number of rows is unspecified
|
protected boolean |
readColumnData(DataSchema rowschema)
Reads in a data set when importing columns.
|
VectorType[] |
readColumns(DataSchema colschema,
DataSchema rowschema) |
VectorType |
readRow(DataSchema colschema,
DataSchema rowschema) |
protected boolean |
readRowData(DataSchema rowschema)
Reads in a data set when importing rows (only if at the start of the set)
|
static double |
reverseDoubleBytesToDouble(byte[] bytes,
int offset)
Converts the double bytes at the given offset into a double by packing the bytes in reverse order
|
static double |
reverseFloatBytesToDouble(byte[] bytes,
int offset)
Converts the float bytes at the given offset into a double by packing the bytes in reverse order
|
static double |
reverseIntBytesToDouble(byte[] bytes,
int offset)
Converts the int bytes at the given offset into a double by packing the bytes in reverse order
|
static double |
reverseLongBytesToDouble(byte[] bytes,
int offset)
Converts the long bytes at the given offset into a double by packing the bytes in reverse order
|
static double |
reverseShortBytesToDouble(byte[] bytes,
int offset)
Converts the short bytes at the given offset into a double by packing the bytes in reverse order
|
protected void |
setActualRows(int actualrows)
Sets the actual number of rows read in for the last data set
|
void |
setColumns(int columns)
Sets the number of columns in each data set
|
void |
setDataType(int datatype)
Sets the type of data being read in
|
void |
setOneBytePerColumn(boolean state)
Sets whether each column is one byte (or alternatively whether the number of bytes in a field is the same as the
data type
|
void |
setReverseByteOrder(boolean reverse)
Sets whether the data is in reverse byte order
|
void |
setRows(int rows)
Sets the number of rows in each data set, or -1 if unknown
|
static double |
shortBytesToDouble(byte[] bytes,
int offset)
Converts the short bytes at the given offset into a double by packing the bytes in the correct order.
|
public static final int BYTE
public static final int SHORT
public static final int INT
public static final int LONG
public static final int FLOAT
public static final int DOUBLE
protected java.io.InputStream instream
public int getDataType()
public void setDataType(int datatype)
public boolean isOneBytePerColumn()
public void setOneBytePerColumn(boolean state)
public boolean isReverseByteOrder()
public void setReverseByteOrder(boolean reverse)
public int getRows()
public int getActualRows()
public void setRows(int rows)
protected void setActualRows(int actualrows)
public int getColumns()
public void setColumns(int columns)
public void nextDataSet() throws java.io.IOException
java.io.IOException
public boolean offset(int amount) throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
java.io.IOException
public VectorType[] readColumns(DataSchema colschema, DataSchema rowschema) throws java.io.IOException
colschema
- the columns that are to be read in (e.g. 2,3,6-10)rowschema
- the rows that are to be included in the column (e.g. 2,3,8-10,15+)java.io.IOException
protected boolean readColumnData(DataSchema rowschema) throws java.io.IOException
java.io.IOException
public VectorType readRow(DataSchema colschema, DataSchema rowschema) throws java.io.IOException
colschema
- the columns that are to be included in the row (e.g. 2,3,6-10,15+)rowschema
- the rows that are to be read in (e.g. 2,3,8-10,15+)java.io.IOException
protected boolean readRowData(DataSchema rowschema) throws java.io.IOException
java.io.IOException
protected boolean readAdditionalRow() throws java.io.IOException
java.io.IOException
public static final double byteToDouble(byte[] bytes, int offset)
public static final double shortBytesToDouble(byte[] bytes, int offset)
public static final double intBytesToDouble(byte[] bytes, int offset)
public static final double floatBytesToDouble(byte[] bytes, int offset)
public static final double longBytesToDouble(byte[] bytes, int offset)
public static final double doubleBytesToDouble(byte[] bytes, int offset)
public static final double reverseShortBytesToDouble(byte[] bytes, int offset)
public static final double reverseIntBytesToDouble(byte[] bytes, int offset)
public static final double reverseFloatBytesToDouble(byte[] bytes, int offset)
public static final double reverseLongBytesToDouble(byte[] bytes, int offset)
public static final double reverseDoubleBytesToDouble(byte[] bytes, int offset)