public class ByteDataTransformer
extends java.lang.Object
Constructor and Description |
---|
ByteDataTransformer() |
Modifier and Type | Method and Description |
---|---|
static int |
byteBitsToInt(byte byteVal)
Copies a 1-byte byte value into a 4-byte int while preserving bit pattern.
|
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 short[] |
getAsShortArray(byte[] bytes,
int padding,
java.nio.ByteOrder byteOrder)
Converts a byte array into an short array while accounting for padding.
|
static void |
intToBytes(int intVal,
byte[] b,
int off)
Copies an integer value into 4 bytes of a byte array.
|
static int |
shortBitsToInt(short shortVal)
Copies a 2-byte short value into a 4-byte int while preserving bit pattern.
|
static void |
shortToBytes(short val,
byte[] b,
int off)
Copies a short value into 2 bytes of a byte array.
|
static void |
swapEvent(java.nio.ByteBuffer srcBuffer,
java.nio.ByteBuffer destBuffer,
int srcPos,
int destPos)
This method swaps the byte order of an entire evio event or bank.
|
static void |
swapEvent(java.nio.ByteBuffer srcBuffer,
java.nio.ByteBuffer destBuffer,
int srcPos,
int destPos,
java.util.List<EvioNode> nodeList)
This method swaps the byte order of an entire evio event or bank.
|
static byte[] |
toByteArray(java.nio.ByteBuffer byteBuffer)
Converts an ByteBuffer object into a byte array.
|
static byte[] |
toBytes(double[] data,
java.nio.ByteOrder byteOrder)
Turn double array into byte array.
|
static void |
toBytes(double[] data,
java.nio.ByteOrder byteOrder,
byte[] dest,
int off)
Turn double array into byte array.
|
static byte[] |
toBytes(double data,
java.nio.ByteOrder byteOrder)
Turn double into byte array.
|
static void |
toBytes(double data,
java.nio.ByteOrder byteOrder,
byte[] dest,
int off)
Turn double into byte array.
|
static byte[] |
toBytes(float[] data,
java.nio.ByteOrder byteOrder)
Turn float array into byte array.
|
static void |
toBytes(float[] data,
java.nio.ByteOrder byteOrder,
byte[] dest,
int off)
Turn float array into byte array.
|
static byte[] |
toBytes(float data,
java.nio.ByteOrder byteOrder)
Turn float into byte array.
|
static void |
toBytes(float data,
java.nio.ByteOrder byteOrder,
byte[] dest,
int off)
Turn float into byte array.
|
static byte[] |
toBytes(int[] data,
java.nio.ByteOrder byteOrder)
Turn int array into byte array.
|
static void |
toBytes(int[] data,
java.nio.ByteOrder byteOrder,
byte[] dest,
int off)
Turn int array into byte array.
|
static byte[] |
toBytes(int[] data,
int offset,
int length,
java.nio.ByteOrder byteOrder)
Turn int array into byte array.
|
static byte[] |
toBytes(int data,
java.nio.ByteOrder byteOrder)
Turn int into byte array.
|
static void |
toBytes(int data,
java.nio.ByteOrder byteOrder,
byte[] dest,
int off)
Turn int into byte array.
|
static byte[] |
toBytes(long[] data,
java.nio.ByteOrder byteOrder)
Turn long array into byte array.
|
static void |
toBytes(long[] data,
java.nio.ByteOrder byteOrder,
byte[] dest,
int off)
Turn long array into byte array.
|
static byte[] |
toBytes(long data,
java.nio.ByteOrder byteOrder)
Turn long into byte array.
|
static void |
toBytes(long data,
java.nio.ByteOrder byteOrder,
byte[] dest,
int off)
Turn long into byte array.
|
static byte[] |
toBytes(short[] data,
java.nio.ByteOrder byteOrder)
Turn short array into byte array.
|
static void |
toBytes(short[] data,
java.nio.ByteOrder byteOrder,
byte[] dest,
int off)
Turn short array into byte array.
|
static byte[] |
toBytes(short data,
java.nio.ByteOrder byteOrder)
Turn short into byte array.
|
static void |
toBytes(short data,
java.nio.ByteOrder byteOrder,
byte[] dest,
int off)
Turn short into byte array.
|
static byte[] |
toBytes2(double[] data,
java.nio.ByteOrder byteOrder)
Turn double array into byte array.
|
static void |
toBytes2(double[] data,
java.nio.ByteOrder byteOrder,
byte[] dest,
int off)
Turn double array into byte array.
|
static byte[] |
toBytesStream(int[] data,
java.nio.ByteOrder byteOrder)
Turn int array into byte array.
|
static double |
toDouble(byte[] data,
java.nio.ByteOrder byteOrder,
int off)
Turn section of byte array into a double.
|
static double |
toDouble(byte b1,
byte b2,
byte b3,
byte b4,
byte b5,
byte b6,
byte b7,
byte b8,
java.nio.ByteOrder byteOrder)
Turn 8 bytes into a double.
|
static double[] |
toDoubleArray(byte[] data,
java.nio.ByteOrder byteOrder)
Turn byte array into a double array.
|
static void |
toDoubleArray(byte[] data,
java.nio.ByteOrder byteOrder,
double[] dest,
int off)
Turn byte array into an double array.
|
static double[] |
toDoubleArray(java.nio.ByteBuffer byteBuffer)
Converts an ByteBuffer object into a double array.
|
static float |
toFloat(byte[] data,
java.nio.ByteOrder byteOrder,
int off)
Turn section of byte array into a float.
|
static float |
toFloat(byte b1,
byte b2,
byte b3,
byte b4,
java.nio.ByteOrder byteOrder)
Turn 4 bytes into a float.
|
static float[] |
toFloatArray(byte[] data,
java.nio.ByteOrder byteOrder)
Turn byte array into a float array.
|
static void |
toFloatArray(byte[] data,
java.nio.ByteOrder byteOrder,
float[] dest,
int off)
Turn byte array into an float array.
|
static float[] |
toFloatArray(java.nio.ByteBuffer byteBuffer)
Converts an ByteBuffer object into a float array.
|
static int |
toInt(byte[] data,
java.nio.ByteOrder byteOrder,
int off)
Turn section of byte array into an int.
|
static int |
toInt(byte b1,
byte b2,
byte b3,
byte b4,
java.nio.ByteOrder byteOrder)
Turn 4 bytes into an int.
|
static int[] |
toIntArray(byte[] data,
java.nio.ByteOrder byteOrder)
Turn byte array into an int array.
|
static void |
toIntArray(byte[] data,
java.nio.ByteOrder byteOrder,
int[] dest,
int off)
Turn byte array into an int array.
|
static int[] |
toIntArray(java.nio.ByteBuffer byteBuffer)
Converts an ByteBuffer object into an int array.
|
static long |
toLong(byte[] data,
java.nio.ByteOrder byteOrder,
int off)
Turn section of byte array into a long.
|
static long |
toLong(byte b1,
byte b2,
byte b3,
byte b4,
byte b5,
byte b6,
byte b7,
byte b8,
java.nio.ByteOrder byteOrder)
Turn 8 bytes into a long.
|
static long[] |
toLongArray(byte[] data,
java.nio.ByteOrder byteOrder)
Turn byte array into a long array.
|
static void |
toLongArray(byte[] data,
java.nio.ByteOrder byteOrder,
long[] dest,
int off)
Turn byte array into an long array.
|
static long[] |
toLongArray(java.nio.ByteBuffer byteBuffer)
Converts an ByteBuffer object into a long array.
|
static short |
toShort(byte[] data,
java.nio.ByteOrder byteOrder,
int off)
Turn section of byte array into a short.
|
static short |
toShort(byte b1,
byte b2,
java.nio.ByteOrder byteOrder)
Turn 2 bytes into a short.
|
static short[] |
toShortArray(byte[] data,
java.nio.ByteOrder byteOrder)
Turn byte array into a short array.
|
static void |
toShortArray(byte[] data,
java.nio.ByteOrder byteOrder,
short[] dest,
int off)
Turn byte array into an short array.
|
static short[] |
toShortArray(byte[] data,
int padding,
java.nio.ByteOrder byteOrder)
Turn byte array into a short array while taking padding into account.
|
static void |
toShortArray(byte[] data,
int padding,
java.nio.ByteOrder byteOrder,
short[] dest,
int off)
Turn byte array into a short array while taking padding into account.
|
static short[] |
toShortArray(java.nio.ByteBuffer byteBuffer)
Converts an ByteBuffer object into a short array.
|
public static int[] getAsIntArray(byte[] bytes, java.nio.ByteOrder byteOrder)
toIntArray(byte[], java.nio.ByteOrder)
for better performance.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)
toShortArray(byte[], java.nio.ByteOrder)
for better performance.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, int padding, java.nio.ByteOrder byteOrder)
toShortArray(byte[], int, java.nio.ByteOrder)
for better performance.bytes
- the byte array.padding
- number of bytes at the end of the byte array to ignore.
Valid values are 0 and mulitples of 2 (though only 0 & 2 are used).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)
toLongArray(byte[], java.nio.ByteOrder)
for better performance.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)
toDoubleArray(byte[], java.nio.ByteOrder)
for better performance.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)
toFloatArray(byte[], java.nio.ByteOrder)
for better performance.bytes
- the byte array.byteOrder
- the endianness of the data in the byte array,
ByteOrder.BIG_ENDIAN
or ByteOrder.LITTLE_ENDIAN
.public static final int shortBitsToInt(short shortVal)
shortVal
- short value considered to be unsignedpublic static final int byteBitsToInt(byte byteVal)
byteVal
- byte value considered to be unsignedpublic static byte[] toByteArray(java.nio.ByteBuffer byteBuffer)
byteBuffer
- the buffer to convert.public static int[] toIntArray(java.nio.ByteBuffer byteBuffer)
byteBuffer
- the buffer to convert.public static short[] toShortArray(java.nio.ByteBuffer byteBuffer)
byteBuffer
- the buffer to convert.public static long[] toLongArray(java.nio.ByteBuffer byteBuffer)
byteBuffer
- the buffer to convert.public static float[] toFloatArray(java.nio.ByteBuffer byteBuffer)
byteBuffer
- the buffer to convert.public static double[] toDoubleArray(java.nio.ByteBuffer byteBuffer)
byteBuffer
- the buffer to convert.public static final void intToBytes(int intVal, byte[] b, int off)
intVal
- integer valueb
- byte arrayoff
- offset into the byte arraypublic static final void shortToBytes(short val, byte[] b, int off)
val
- short valueb
- byte arrayoff
- offset into the byte arraypublic static byte[] toBytes(short data, java.nio.ByteOrder byteOrder)
data
- short to convertbyteOrder
- byte order of returned byte array (big endian if null)public static void toBytes(short data, java.nio.ByteOrder byteOrder, byte[] dest, int off) throws EvioException
data
- short to convertbyteOrder
- byte order of returned bytes (big endian if null)dest
- array in which to store returned bytesoff
- offset into dest array where returned bytes are placedEvioException
- if dest is null or too small or offset negativepublic static byte[] toBytes(short[] data, java.nio.ByteOrder byteOrder) throws EvioException
data
- short array to convertbyteOrder
- byte order of returned bytes (big endian if null)EvioException
- if data array has too many elements to convert to a byte arraypublic static void toBytes(short[] data, java.nio.ByteOrder byteOrder, byte[] dest, int off) throws EvioException
data
- short array to convertbyteOrder
- byte order of written bytes (big endian if null)dest
- array in which to store written bytesoff
- offset into dest array where returned bytes are placedEvioException
- if data is null, dest is null or too small, or offset negative;
if data array has too many elements to convert to a byte arraypublic static byte[] toBytes(int data, java.nio.ByteOrder byteOrder)
data
- int to convertbyteOrder
- byte order of returned byte array (big endian if null)public static void toBytes(int data, java.nio.ByteOrder byteOrder, byte[] dest, int off) throws EvioException
data
- int to convertbyteOrder
- byte order of returned bytes (big endian if null)dest
- array in which to store returned bytesoff
- offset into dest array where returned bytes are placedEvioException
- if dest is null or too small or offset negativepublic static byte[] toBytes(int[] data, java.nio.ByteOrder byteOrder) throws EvioException
data
- int array to convertbyteOrder
- byte order of returned bytes (big endian if null)EvioException
- if data array as too many elements to
convert to a byte arraypublic static byte[] toBytes(int[] data, int offset, int length, java.nio.ByteOrder byteOrder) throws EvioException
data
- int array to convertoffset
- into int arraylength
- number of integers to conver to bytesbyteOrder
- byte order of returned bytes (big endian if null)EvioException
- if data array has too many elements to
convert to a byte arraypublic static void toBytes(int[] data, java.nio.ByteOrder byteOrder, byte[] dest, int off) throws EvioException
data
- int array to convertbyteOrder
- byte order of written bytes (big endian if null)dest
- array in which to store written bytesoff
- offset into dest array where returned bytes are placedEvioException
- if data is null, dest is null or too small, or offset negative;
if data array has too many elements to convert to a byte arraypublic static byte[] toBytesStream(int[] data, java.nio.ByteOrder byteOrder) throws EvioException
data
- int array to convertbyteOrder
- byte order of returned bytes (big endian if null)EvioException
- if data array has too many elements to
convert to a byte arraypublic static byte[] toBytes(long data, java.nio.ByteOrder byteOrder)
data
- long to convertbyteOrder
- byte order of returned byte array (big endian if null)public static void toBytes(long data, java.nio.ByteOrder byteOrder, byte[] dest, int off) throws EvioException
data
- long to convertbyteOrder
- byte order of returned bytes (big endian if null)dest
- array in which to store returned bytesoff
- offset into dest array where returned bytes are placedEvioException
- if dest is null or too small or offset negativepublic static byte[] toBytes(long[] data, java.nio.ByteOrder byteOrder) throws EvioException
data
- long array to convertbyteOrder
- byte order of returned bytes (big endian if null)EvioException
- if data array has too many elements to
convert to a byte arraypublic static void toBytes(long[] data, java.nio.ByteOrder byteOrder, byte[] dest, int off) throws EvioException
data
- long array to convertbyteOrder
- byte order of written bytes (big endian if null)dest
- array in which to store written bytesoff
- offset into dest array where returned bytes are placedEvioException
- if data is null, dest is null or too small, or offset negative;
if data array has too many elements to convert to a byte arraypublic static byte[] toBytes(float data, java.nio.ByteOrder byteOrder)
data
- float to convertbyteOrder
- byte order of returned byte array (big endian if null)public static void toBytes(float data, java.nio.ByteOrder byteOrder, byte[] dest, int off) throws EvioException
data
- float to convertbyteOrder
- byte order of returned bytes (big endian if null)dest
- array in which to store returned bytesoff
- offset into dest array where returned bytes are placedEvioException
- if dest is null or too small or offset negativepublic static byte[] toBytes(float[] data, java.nio.ByteOrder byteOrder) throws EvioException
data
- float array to convertbyteOrder
- byte order of returned bytes (big endian if null)EvioException
- if data array has too many elements to
convert to a byte arraypublic static void toBytes(float[] data, java.nio.ByteOrder byteOrder, byte[] dest, int off) throws EvioException
data
- float array to convertbyteOrder
- byte order of written bytes (big endian if null)dest
- array in which to store written bytesoff
- offset into dest array where returned bytes are placedEvioException
- if data is null, dest is null or too small, or offset negative;
if data array has too many elements to convert to a byte arraypublic static byte[] toBytes(double data, java.nio.ByteOrder byteOrder)
data
- double to convertbyteOrder
- byte order of returned byte array (big endian if null)public static void toBytes(double data, java.nio.ByteOrder byteOrder, byte[] dest, int off) throws EvioException
data
- double to convertbyteOrder
- byte order of returned bytes (big endian if null)dest
- array in which to store returned bytesoff
- offset into dest array where returned bytes are placedEvioException
- if dest is null or too small or offset negativepublic static byte[] toBytes(double[] data, java.nio.ByteOrder byteOrder) throws EvioException
data
- double array to convertbyteOrder
- byte order of returned bytes (big endian if null)EvioException
- if data array has too many elements to
convert to a byte arraypublic static void toBytes(double[] data, java.nio.ByteOrder byteOrder, byte[] dest, int off) throws EvioException
data
- double array to convertbyteOrder
- byte order of written bytes (big endian if null)dest
- array in which to store written bytesoff
- offset into dest array where returned bytes are placedEvioException
- if data is null, dest is null or too small, or offset negative;
if data array has too many elements to convert to a byte arraypublic static byte[] toBytes2(double[] data, java.nio.ByteOrder byteOrder) throws EvioException
toBytes(double[], ByteOrder)
.
Keep this around for completeness purposes - a record
of what was already tried and found wanting. Tried this
for all data types.data
- double array to convertbyteOrder
- byte order of returned bytes (big endian if null)EvioException
- if data array has too many elements to
convert to a byte arraypublic static void toBytes2(double[] data, java.nio.ByteOrder byteOrder, byte[] dest, int off) throws EvioException
toBytes(double[], ByteOrder, byte[], int)
.
Keep this around for completeness purposes - a record
of what was already tried and found wanting. Tried this
for all data types.data
- double array to convertbyteOrder
- byte order of returned bytes (big endian if null)dest
- array in which to store returned bytesoff
- offset into dest array where returned bytes are placedEvioException
- if data is null, dest is null or too small, or offset negative;
if data array has too many elements to convert to a byte arraypublic static short toShort(byte[] data, java.nio.ByteOrder byteOrder, int off) throws EvioException
data
- byte array to convertbyteOrder
- byte order of supplied bytes (big endian if null)off
- offset into data arrayEvioException
- if data is null or wrong size, or off is negativepublic static short toShort(byte b1, byte b2, java.nio.ByteOrder byteOrder)
b1
- 1st byteb2
- 2nd bytebyteOrder
- if big endian, 1st byte is most significant (big endian if null)public static short[] toShortArray(byte[] data, java.nio.ByteOrder byteOrder) throws EvioException
data
- byte array to convertbyteOrder
- byte order of supplied bytes (big endian if null)EvioException
- if data is null or odd sizepublic static short[] toShortArray(byte[] data, int padding, java.nio.ByteOrder byteOrder) throws EvioException
data
- byte array to convertpadding
- number of bytes at the end of the byte array to ignore.
Valid values are 0 and 2byteOrder
- byte order of supplied bytes (big endian if null)EvioException
- if data is null or odd size; padding not 0 or 2public static void toShortArray(byte[] data, int padding, java.nio.ByteOrder byteOrder, short[] dest, int off) throws EvioException
data
- byte array to convertpadding
- number of bytes at the end of the byte array to ignore.
Valid values are 0 and 2byteOrder
- byte order of supplied bytes (big endian if null)dest
- array in which to write converted bytesoff
- offset into dest arrayEvioException
- if data is null or wrong size; dest is null, wrong size, or off < 0public static void toShortArray(byte[] data, java.nio.ByteOrder byteOrder, short[] dest, int off) throws EvioException
data
- byte array to convertbyteOrder
- byte order of supplied bytes (big endian if null)dest
- array in which to write converted bytesoff
- offset into dest arrayEvioException
- if data is null or wrong size; dest is null, wrong size, or off < 0public static int toInt(byte[] data, java.nio.ByteOrder byteOrder, int off) throws EvioException
data
- byte array to convertbyteOrder
- byte order of supplied bytes (big endian if null)off
- offset into data arrayEvioException
- if data is null or wrong size, or off is negativepublic static int toInt(byte b1, byte b2, byte b3, byte b4, java.nio.ByteOrder byteOrder)
b1
- 1st byteb2
- 2nd byteb3
- 3rd byteb4
- 4th bytebyteOrder
- if big endian, 1st byte is most significant &
4th is least (big endian if null)public static int[] toIntArray(byte[] data, java.nio.ByteOrder byteOrder) throws EvioException
data
- byte array to convertbyteOrder
- byte order of supplied bytes (big endian if null)EvioException
- if data is null or wrong sizepublic static void toIntArray(byte[] data, java.nio.ByteOrder byteOrder, int[] dest, int off) throws EvioException
data
- byte array to convertbyteOrder
- byte order of supplied bytes (big endian if null)dest
- array in which to write converted bytesoff
- offset into dest arrayEvioException
- if data is null or wrong size; dest is null, wrong size, or off < 0public static long toLong(byte[] data, java.nio.ByteOrder byteOrder, int off) throws EvioException
data
- byte array to convertbyteOrder
- byte order of supplied bytes (big endian if null)off
- offset into data arrayEvioException
- if data is null or wrong size, or off is negativepublic static long toLong(byte b1, byte b2, byte b3, byte b4, byte b5, byte b6, byte b7, byte b8, java.nio.ByteOrder byteOrder)
b1
- 1st byteb2
- 2nd byteb3
- 3rd byteb4
- 4th byteb5
- 5th byteb6
- 6th byteb7
- 7th byteb8
- 8th bytebyteOrder
- if big endian, 1st byte is most significant &
8th least (big endian if null)public static long[] toLongArray(byte[] data, java.nio.ByteOrder byteOrder) throws EvioException
data
- byte array to convertbyteOrder
- byte order of supplied bytes (big endian if null)EvioException
- if data is null or wrong sizepublic static void toLongArray(byte[] data, java.nio.ByteOrder byteOrder, long[] dest, int off) throws EvioException
data
- byte array to convertbyteOrder
- byte order of supplied bytes (big endian if null)dest
- array in which to write converted bytesoff
- offset into dest arrayEvioException
- if data is null or wrong size; dest is null, wrong size, or off < 0public static float toFloat(byte[] data, java.nio.ByteOrder byteOrder, int off) throws EvioException
data
- byte array to convertbyteOrder
- byte order of supplied bytes (big endian if null)off
- offset into data arrayEvioException
- if data is null or wrong size, or off is negativepublic static float toFloat(byte b1, byte b2, byte b3, byte b4, java.nio.ByteOrder byteOrder)
b1
- 1st byteb2
- 2nd byteb3
- 3rd byteb4
- 4th bytebyteOrder
- if big endian, 1st byte is most significant &
4th least (big endian if null)public static float[] toFloatArray(byte[] data, java.nio.ByteOrder byteOrder) throws EvioException
data
- byte array to convertbyteOrder
- byte order of supplied bytes (big endian if null)EvioException
- if data is null or wrong sizepublic static void toFloatArray(byte[] data, java.nio.ByteOrder byteOrder, float[] dest, int off) throws EvioException
data
- byte array to convertbyteOrder
- byte order of supplied bytes (big endian if null)dest
- array in which to write converted bytesoff
- offset into dest arrayEvioException
- if data is null or wrong size; dest is null, wrong size, or off < 0public static double toDouble(byte[] data, java.nio.ByteOrder byteOrder, int off) throws EvioException
data
- byte array to convertbyteOrder
- byte order of supplied bytes (big endian if null)off
- offset into data arrayEvioException
- if data is null or wrong size, or off is negativepublic static double toDouble(byte b1, byte b2, byte b3, byte b4, byte b5, byte b6, byte b7, byte b8, java.nio.ByteOrder byteOrder)
b1
- 1st byteb2
- 2nd byteb3
- 3rd byteb4
- 4th byteb5
- 5th byteb6
- 6th byteb7
- 7th byteb8
- 8th bytebyteOrder
- if big endian, 1st byte is most significant &
8th least (big endian if null)public static double[] toDoubleArray(byte[] data, java.nio.ByteOrder byteOrder) throws EvioException
data
- byte array to convertbyteOrder
- byte order of supplied bytes (big endian if null)EvioException
- if data is null or wrong sizepublic static void toDoubleArray(byte[] data, java.nio.ByteOrder byteOrder, double[] dest, int off) throws EvioException
data
- byte array to convertbyteOrder
- byte order of supplied bytes (big endian if null)dest
- array in which to write converted bytesoff
- offset into dest arrayEvioException
- if data is null or wrong size; dest is null, wrong size, or off < 0public static void swapEvent(java.nio.ByteBuffer srcBuffer, java.nio.ByteBuffer destBuffer, int srcPos, int destPos) throws EvioException
ByteBuffer.order()
.The data to be swapped must not be in the evio file format (with block headers). Data must only consist of bytes representing a single event/bank. Position and limit of neither buffer is changed.
srcBuffer
- buffer containing event to swap.destBuffer
- buffer in which to placed the swapped event.
If null, or identical to srcBuffer, the data is swapped in place.srcPos
- position in srcBuffer to start reading eventdestPos
- position in destBuffer to start writing swapped eventEvioException
- if srcBuffer arg is null;
if any buffer position is not zeropublic static void swapEvent(java.nio.ByteBuffer srcBuffer, java.nio.ByteBuffer destBuffer, int srcPos, int destPos, java.util.List<EvioNode> nodeList) throws EvioException
ByteBuffer.order()
.The data to be swapped must not be in the evio file format (with block headers). Data must only consist of bytes representing a single event/bank. Position and limit of neither buffer is changed.
srcBuffer
- buffer containing event to swap.destBuffer
- buffer in which to placed the swapped event.
If null, or identical to srcBuffer, the data is swapped in place.srcPos
- position in srcBuffer to start reading eventdestPos
- position in destBuffer to start writing swapped eventnodeList
- if not null, generate & store node objects here -
one for each swapped evio structure in destBuffer.EvioException
- if srcBuffer arg is null;
if any buffer position is not zero