|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jlab.coda.jevio.ByteDataTransformer
public class ByteDataTransformer
This utility class contains methods for transforming a raw byte array into arrays of other types such as int and double. It also contains a method for byte swapping evio format data.
Constructor Summary | |
---|---|
ByteDataTransformer()
|
Method Summary | |
---|---|
static double[] |
getAsDoubleArray(byte[] bytes,
java.nio.ByteOrder byteOrder)
Converts a byte array into a double array. |
static float[] |
getAsFloatArray(byte[] bytes,
java.nio.ByteOrder byteOrder)
Converts a byte array into a float array. |
static int[] |
getAsIntArray(byte[] bytes,
java.nio.ByteOrder byteOrder)
Converts a byte array into an int array. |
static long[] |
getAsLongArray(byte[] bytes,
java.nio.ByteOrder byteOrder)
Converts a byte array into a long array. |
static short[] |
getAsShortArray(byte[] bytes,
java.nio.ByteOrder byteOrder)
Converts a byte array into an short array. |
static void |
intToBytes(int intVal,
byte[] b,
int off)
Copies an integer value into 4 bytes of a byte array. |
static void |
swap(java.nio.ByteBuffer srcBuf,
java.nio.ByteBuffer destBuf)
Swaps evio format data (event or bank) contained in a ByteBuffer. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ByteDataTransformer()
Method Detail |
---|
public static int[] getAsIntArray(byte[] bytes, java.nio.ByteOrder byteOrder)
bytes
- the byte array.byteOrder
- the endianness of the data in the byte array,
ByteOrder.BIG_ENDIAN
or ByteOrder.LITTLE_ENDIAN
.
public static short[] getAsShortArray(byte[] bytes, java.nio.ByteOrder byteOrder)
bytes
- the byte array.byteOrder
- the endianness of the data in the byte array,
ByteOrder.BIG_ENDIAN
or ByteOrder.LITTLE_ENDIAN
.
public static long[] getAsLongArray(byte[] bytes, java.nio.ByteOrder byteOrder)
bytes
- the byte array.byteOrder
- the endianness of the data in the byte array,
ByteOrder.BIG_ENDIAN
or ByteOrder.LITTLE_ENDIAN
.
public static double[] getAsDoubleArray(byte[] bytes, java.nio.ByteOrder byteOrder)
bytes
- the byte array.byteOrder
- the endianness of the data in the byte array,
ByteOrder.BIG_ENDIAN
or ByteOrder.LITTLE_ENDIAN
.
public static float[] getAsFloatArray(byte[] bytes, java.nio.ByteOrder byteOrder)
bytes
- the byte array.byteOrder
- the endianness of the data in the byte array,
ByteOrder.BIG_ENDIAN
or ByteOrder.LITTLE_ENDIAN
.
public static final void intToBytes(int intVal, byte[] b, int off)
intVal
- integer valueb
- byte arrayoff
- offset into the byte arraypublic static void swap(java.nio.ByteBuffer srcBuf, java.nio.ByteBuffer destBuf) throws EvioException
ByteBuffer.order(java.nio.ByteOrder)
.
srcBuf
- evio data (event or bank) to be swappeddestBuf
- destination for swapped evio data; if null, swap in place
EvioException
- if data not in evio format
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |