JAPI 0_6-alpha-2
Yet another Java API
API Documentation

net.sf.japi.util
Class EndianConverter

java.lang.Object
  extended by net.sf.japi.util.EndianConverter

public class EndianConverter
extends Object

Class to convert data from little endian to big endian and vice versa. Since the conversion is symmetric, there are no special conversion methods, just generic ones, e.g. the same method is used to convert a little endian integer to a big endian integer and vice versa.

Author:
Christian Hujer

Constructor Summary
EndianConverter()
           
 
Method Summary
static boolean se(boolean b)
          Convert a boolean.
static byte se(byte b)
          Convert a byte.
static char se(char c)
          Convert a char.
static double se(double d)
          Convert a double.
static float se(float f)
          Convert a float.
static int se(int i)
          Convert an int.
static long se(long l)
          Convert a long.
static short se(short s)
          Convert a short.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EndianConverter

public EndianConverter()
Method Detail

se

public static final double se(double d)
Convert a double. This method changes byte order from 1, 2, 3, 4, 5, 6, 7, 8 to 8, 7, 6, 5, 4, 3, 2, 1.

Parameters:
d - double to convert
Returns:
converted double

se

public static final float se(float f)
Convert a float. This method changes byte order from 1, 2, 3, 4 to 4, 3, 2, 1.

Parameters:
f - float to convert
Returns:
converted float

se

public static final long se(long l)
Convert a long. This method changes byte order from 1, 2, 3, 4, 5, 6, 7, 8 to 8, 7, 6, 5, 4, 3, 2, 1.

Parameters:
l - long to convert
Returns:
converted long

se

public static final int se(int i)
Convert an int. This method changes byte order from 1, 2, 3, 4 to 4, 3, 2, 1.

Parameters:
i - int to convert
Returns:
converted int

se

public static final char se(char c)
Convert a char. This method swaps low and high byte.

Parameters:
c - char to convert
Returns:
converted char

se

public static final short se(short s)
Convert a short. This method swaps low and high byte.

Parameters:
s - short to convert
Returns:
converted short

se

public static final byte se(byte b)
Convert a byte. This method does nothing and exists for convenience only.

Parameters:
b - byte to convert
Returns:
converted byte (same as b)

se

public static final boolean se(boolean b)
Convert a boolean. This method does nothing and exists for convenience only.

Parameters:
b - boolean to convert
Returns:
converted boolean (same as b)

JAPI
Yet another Java API
API Documentation

© 2005-2006 Christian Hujer. All rights reserved. See copyright