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)
Deprecated.
|
static float[] |
getAsFloatArray(byte[] bytes,
java.nio.ByteOrder byteOrder)
Deprecated.
|
static int[] |
getAsIntArray(byte[] bytes,
java.nio.ByteOrder byteOrder)
Deprecated.
|
static long[] |
getAsLongArray(byte[] bytes,
java.nio.ByteOrder byteOrder)
Deprecated.
|
static short[] |
getAsShortArray(byte[] bytes,
java.nio.ByteOrder byteOrder)
Deprecated.
|
static short[] |
getAsShortArray(byte[] bytes,
int padding,
java.nio.ByteOrder byteOrder)
Deprecated.
|
static void |
intoByteBuffer(int[] data,
int dataOffset,
int dataLen,
java.nio.ByteBuffer buffer)
Write int array into ByteBuffer.
|
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 |
swapArray32(byte[] data,
int dataOffset,
int dataLen)
Swap byte array in place assuming bytes are 32 bit ints.
|
(package private) static void |
swapBankHeader(EvioNode node,
java.nio.ByteBuffer srcBuffer,
java.nio.ByteBuffer destBuffer,
int srcPos,
int destPos)
This method reads and swaps an evio bank header.
|
(package private) static void |
swapData(DataType type,
java.nio.ByteBuffer srcBuffer,
java.nio.ByteBuffer destBuffer,
int srcPos,
int destPos,
int len,
boolean inPlace)
This method swaps the data of an evio leaf structure.
|
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,
boolean swapData,
java.util.List<EvioNode> nodeList)
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.
|
(package private) static void |
swapSegmentHeader(EvioNode node,
java.nio.ByteBuffer srcBuffer,
java.nio.ByteBuffer destBuffer,
int srcPos,
int destPos)
This method reads and swaps an evio segment header.
|
(package private) static void |
swapStructure(EvioNode node,
java.nio.ByteBuffer srcBuffer,
java.nio.ByteBuffer destBuffer,
int srcPos,
int destPos,
boolean inPlace,
boolean swapData,
java.util.List<EvioNode> nodeList)
Swap an evio structure.
|
(package private) static void |
swapTagSegmentHeader(EvioNode node,
java.nio.ByteBuffer srcBuffer,
java.nio.ByteBuffer destBuffer,
int srcPos,
int destPos)
This method reads and swaps an evio tagsegment header.
|
static void |
toBitSet(java.util.BitSet bSet,
int bits)
Converts an integer into a BitSet object.
|
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 void |
toBytes(int[] data,
int dataOff,
int dataLen,
java.nio.ByteOrder byteOrder,
byte[] dest,
int off)
Write 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[] |
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(java.util.BitSet bSet)
Converts a BitSet object into an integer.
|
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 void |
toIntArray(byte[] data,
int dataOffset,
java.nio.ByteOrder byteOrder,
int[] dest,
int destOffset)
Turn byte array into an int array.
|
static void |
toIntArray(byte[] data,
int dataOffset,
int dataLen,
java.nio.ByteOrder byteOrder,
int[] dest,
int destOffset)
Turn byte array into an int array.
|
static int[] |
toIntArray(java.nio.ByteBuffer byteBuffer)
Converts an ByteBuffer object into an int array.
|
static int |
toIntArray(java.nio.ByteBuffer byteBuffer,
int[] dest)
Writes ByteBuffer data 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.
|
static java.lang.String[] |
toStringArray(java.nio.ByteBuffer byteBuffer)
Converts an ByteBuffer object containing evio String data into a String array.
|
public static int toInt(java.util.BitSet bSet) throws EvioException
bSet
- BitSet to convert to integer.EvioException
- if arg null or contains too many true bits to fit into integer.public static void toBitSet(java.util.BitSet bSet, int bits) throws EvioException
bSet
- BitSet object to hold int data.bits
- integer to convert to BitSet.EvioException
- if arg null.@Deprecated 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
.@Deprecated 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
.@Deprecated 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 multiples of 2 (though only 0 and 2 are used).byteOrder
- the endianness of the data in the byte array,
ByteOrder.BIG_ENDIAN
or ByteOrder.LITTLE_ENDIAN
.@Deprecated 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
.@Deprecated 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
.@Deprecated 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 int toIntArray(java.nio.ByteBuffer byteBuffer, int[] dest) throws EvioException
byteBuffer
- the buffer to convert.dest
- array in which to put buffer data.EvioException
- if bad args or dest cannot hold all of byteBuffer's data
(from position to limit).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 java.lang.String[] toStringArray(java.nio.ByteBuffer byteBuffer)
byteBuffer
- the buffer to convert.public static void intoByteBuffer(int[] data, int dataOffset, int dataLen, java.nio.ByteBuffer buffer) throws EvioException
data
- int data to writedataOffset
- offset into data arraydataLen
- number of ints to writebuffer
- buffer in which to write dataEvioException
- if data is null, buffer is null or too small, or offset out of bounds;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 void toBytes(int[] data, int dataOff, int dataLen, java.nio.ByteOrder byteOrder, byte[] dest, int off) throws EvioException
data
- int data to convertdataOff
- offset into data arraydataLen
- number of ints to writebyteOrder
- 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/dest are null or bad offset valuespublic 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 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 void toIntArray(byte[] data, int dataOffset, java.nio.ByteOrder byteOrder, int[] dest, int destOffset) throws EvioException
data
- byte array to convertdataOffset
- offset into data arraybyteOrder
- byte order of supplied bytes (big endian if null)dest
- array in which to write converted bytesdestOffset
- offset into dest arrayEvioException
- if data is null; dest is null, wrong size, or off < 0public static void toIntArray(byte[] data, int dataOffset, int dataLen, java.nio.ByteOrder byteOrder, int[] dest, int destOffset) throws EvioException
data
- byte array to convert.dataOffset
- offset into data array.dataLen
- number of bytes to convert.byteOrder
- byte order of supplied bytes (big endian if null).dest
- array in which to write converted bytes.destOffset
- offset into dest array.EvioException
- if data is null; 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 swapArray32(byte[] data, int dataOffset, int dataLen) throws EvioException
data
- byte array to convert.dataOffset
- offset into data array.dataLen
- number of bytes to convert.EvioException
- if data is null; data offset and length are improper;
dataLen is not a multiple of 4.public 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 and store node objects here -
one for each swapped evio structure in destBuffer.EvioException
- 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, boolean swapData, 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 eventswapData
- if false, do NOT swap data, else swap data toonodeList
- if not null, generate and store node objects here -
one for each swapped evio structure in destBuffer.EvioException
- if srcBuffer arg is null;
if any buffer position is not zerostatic void swapBankHeader(EvioNode node, java.nio.ByteBuffer srcBuffer, java.nio.ByteBuffer destBuffer, int srcPos, int destPos) throws EvioException
This method reads and swaps an evio bank header. It can also return information about the bank. Position and limit of neither buffer argument is changed.
This only swaps data if buffer arguments have opposite byte order!node
- object in which to store data about the bank
in destBuffer after swap; may be nullsrcBuffer
- buffer containing bank header to be swappeddestBuffer
- buffer in which to place swapped bank headersrcPos
- position in srcBuffer to start reading bank headerdestPos
- position in destBuffer to start writing swapped bank headerEvioException
- if srcBuffer too little data;
if destBuffer is too small to contain swapped datastatic void swapSegmentHeader(EvioNode node, java.nio.ByteBuffer srcBuffer, java.nio.ByteBuffer destBuffer, int srcPos, int destPos) throws EvioException
This method reads and swaps an evio segment header. It can also return information about the segment. Position and limit of neither buffer argument is changed.
This only swaps data if buffer arguments have opposite byte order!node
- object in which to store data about the segment
in destBuffer after swap; may be nullsrcBuffer
- buffer containing segment header to be swappeddestBuffer
- buffer in which to place swapped segment headersrcPos
- position in srcBuffer to start reading segment headerdestPos
- position in destBuffer to start writing swapped segment headerEvioException
- if srcBuffer too little data;
if destBuffer is too small to contain swapped datastatic void swapTagSegmentHeader(EvioNode node, java.nio.ByteBuffer srcBuffer, java.nio.ByteBuffer destBuffer, int srcPos, int destPos) throws EvioException
This method reads and swaps an evio tagsegment header. It can also return information about the tagsegment. Position and limit of neither buffer argument is changed.
This only swaps data if buffer arguments have opposite byte order!node
- object in which to store data about the tagsegment
in destBuffer after swap; may be nullsrcBuffer
- buffer containing tagsegment header to be swappeddestBuffer
- buffer in which to place swapped tagsegment headersrcPos
- position in srcBuffer to start reading tagsegment headerdestPos
- position in destBuffer to start writing swapped tagsegment headerEvioException
- if srcBuffer too little data;
if destBuffer is too small to contain swapped datastatic void swapData(DataType type, java.nio.ByteBuffer srcBuffer, java.nio.ByteBuffer destBuffer, int srcPos, int destPos, int len, boolean inPlace) throws EvioException
type
- type of data being swappedsrcBuffer
- buffer containing data to be swappeddestBuffer
- buffer in which to place swapped datasrcPos
- position in srcBuffer to start reading datadestPos
- position in destBuffer to start writing swapped datalen
- length of data in 32 bit wordsinPlace
- if true, data is swapped in srcBufferEvioException
- if srcBuffer not in evio format;
if destBuffer too small;
if bad values for srcPos and/or destPos;static void swapStructure(EvioNode node, java.nio.ByteBuffer srcBuffer, java.nio.ByteBuffer destBuffer, int srcPos, int destPos, boolean inPlace, boolean swapData, java.util.List<EvioNode> nodeList) throws EvioException
node
- info from parsed headersrcBuffer
- buffer containing structure to swap.destBuffer
- buffer in which to place the swapped structure.srcPos
- position in srcBuffer to start reading structuredestPos
- position in destBuffer to start writing swapped structureinPlace
- if true, data is swapped in srcBufferswapData
- if false, data is NOT swapped, else it isnodeList
- if not null, store all node objects here -
one for each swapped evio structure in destBuffer.EvioException
- if srcBuffer not in evio format;
if destBuffer too small;
if bad values for srcPos and/or destPos;