jAER project on SourceForge

net.sf.jaer.util
Class ByteSwapper

java.lang.Object
  extended by net.sf.jaer.util.ByteSwapper

public class ByteSwapper
extends java.lang.Object

Utility class for doing byte swapping (i.e. conversion between little-endian and big-endian representations) of different data types. Byte swapping is typically used when data is read from a stream delivered by a system of different endian type as the present one.

Author:
Jacob Dreyer

Constructor Summary
ByteSwapper()
           
 
Method Summary
static double swap(double value)
          Byte swap a single double value.
static void swap(double[] array)
          Byte swap an array of doubles.
static float swap(float value)
          Byte swap a single float value.
static void swap(float[] array)
          Byte swap an array of floats.
static int swap(int value)
          Byte swap a single int value.
static void swap(int[] array)
          Byte swap an array of ints.
static long swap(long value)
          Byte swap a single long value.
static void swap(long[] array)
          Byte swap an array of longs.
static short swap(short value)
          Byte swap a single short value.
static void swap(short[] array)
          Byte swap an array of shorts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteSwapper

public ByteSwapper()
Method Detail

swap

public static short swap(short value)
Byte swap a single short value.

Parameters:
value - Value to byte swap.
Returns:
Byte swapped representation.

swap

public static int swap(int value)
Byte swap a single int value.

Parameters:
value - Value to byte swap.
Returns:
Byte swapped representation.

swap

public static long swap(long value)
Byte swap a single long value.

Parameters:
value - Value to byte swap.
Returns:
Byte swapped representation.

swap

public static float swap(float value)
Byte swap a single float value.

Parameters:
value - Value to byte swap.
Returns:
Byte swapped representation.

swap

public static double swap(double value)
Byte swap a single double value.

Parameters:
value - Value to byte swap.
Returns:
Byte swapped representation.

swap

public static void swap(short[] array)
Byte swap an array of shorts. The result of the swapping is put back into the specified array.

Parameters:
array - Array of values to swap

swap

public static void swap(int[] array)
Byte swap an array of ints. The result of the swapping is put back into the specified array.

Parameters:
array - Array of values to swap

swap

public static void swap(long[] array)
Byte swap an array of longs. The result of the swapping is put back into the specified array.

Parameters:
array - Array of values to swap

swap

public static void swap(float[] array)
Byte swap an array of floats. The result of the swapping is put back into the specified array.

Parameters:
array - Array of values to swap

swap

public static void swap(double[] array)
Byte swap an array of doubles. The result of the swapping is put back into the specified array.

Parameters:
array - Array of values to swap

jAER project on SourceForge