Package llnl.gnem.core.waveform.io
Class BinaryData
java.lang.Object
llnl.gnem.core.waveform.io.BinaryData
- Direct Known Subclasses:
DoubleBinaryData
,FloatBinaryData
,IntBinaryData
Return type for the readData method of BinaryDataReader interface. Supports
int, float, and double arrays currently. Can convert internal contents to
desired format on demand.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
fillAsFloats
(byte[] in, boolean swapBytes) void
fillAsInts
(byte[] in, boolean isLittleEndian) abstract double[]
Returns an array of doubles corresponding to the contents of this object.abstract float[]
Returns an array of floats corresponding to the contents of this object.abstract int
getInt
(int i) abstract int[]
Returns an array of ints corresponding to the contents of this object.abstract void
setDouble
(int i, double value) abstract void
setFloat
(int i, float value) abstract void
setInt
(int i, int value) abstract int
size()
static BinaryData
truncateTo
(BinaryData source, int newLength)
-
Constructor Details
-
BinaryData
public BinaryData()
-
-
Method Details
-
getIntData
public abstract int[] getIntData()Returns an array of ints corresponding to the contents of this object. If the internal data are in float or double form a loss of precision may occur.- Returns:
- The contents of this object as an array of ints.
-
getFloatData
public abstract float[] getFloatData()Returns an array of floats corresponding to the contents of this object. If the internal data are in double form a loss of precision may occur. If the internal data are stored as ints with values that require more precision that can be represented by a float then a loss of precision will occur.- Returns:
- The contents of this object as an array of floats.
-
getDoubleData
public abstract double[] getDoubleData()Returns an array of doubles corresponding to the contents of this object. If the internal data are stored as ints with values that require more precision that can be represented by a double then a loss of precision will occur.- Returns:
- The contents of this object as an array of doubles.
-
getInt
public abstract int getInt(int i) -
size
public abstract int size() -
setInt
public abstract void setInt(int i, int value) -
setFloat
public abstract void setFloat(int i, float value) -
setDouble
public abstract void setDouble(int i, double value) -
fillAsInts
public void fillAsInts(byte[] in, boolean isLittleEndian) -
fillAsFloats
public void fillAsFloats(byte[] in, boolean swapBytes) -
truncateTo
-