Package uk.ac.bristol.star.cdf.record
Class DataReader
java.lang.Object
uk.ac.bristol.star.cdf.record.DataReader
Reads items with a given data type from a buffer into an array.
- Since:
- 20 Jun 2013
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a workspace array which can contain a value read for one record.int
Returns the size in bytes of one record as stored in the data buffer.void
Reads a value from a data buffer into a workspace array.
-
Constructor Details
-
DataReader
Constructor.- Parameters:
dataType
- data typenelPerItem
- number of dataType elements per read item; usually 1 except for character datanItem
- number of items of given data type in the array, for scalar records it will be 1
-
-
Method Details
-
createValueArray
Creates a workspace array which can contain a value read for one record. The return value will be an array of a primitive type or String.- Returns:
- workspace array for this reader
-
readValue
Reads a value from a data buffer into a workspace array.- Parameters:
buf
- data bufferoffset
- byte offset into buf of data startvalueArray
- object created bycreateValueArray
into which results will be read- Throws:
IOException
-
getRecordSize
public int getRecordSize()Returns the size in bytes of one record as stored in the data buffer.- Returns:
- record size in bytes
-