| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.io.EndianUtils
public final class EndianUtils
Utility code for dealing with different endian systems.
 
 Origin of code: Apache Avalon (Excalibur)
| Constructor Summary | |
|---|---|
| EndianUtils()Instances should NOT be constructed in standard programming. | |
| Method Summary | |
|---|---|
| static double | readSwappedDouble(byte[] data,
                  int offset)Reads a "double" value from a byte array at a given offset. | 
| static double | readSwappedDouble(InputStream input)Reads a "double" value from an InputStream. | 
| static float | readSwappedFloat(byte[] data,
                 int offset)Reads a "float" value from a byte array at a given offset. | 
| static float | readSwappedFloat(InputStream input)Reads a "float" value from an InputStream. | 
| static int | readSwappedInteger(byte[] data,
                   int offset)Reads a "int" value from a byte array at a given offset. | 
| static int | readSwappedInteger(InputStream input)Reads a "int" value from an InputStream. | 
| static long | readSwappedLong(byte[] data,
                int offset)Reads a "long" value from a byte array at a given offset. | 
| static long | readSwappedLong(InputStream input)Reads a "long" value from an InputStream. | 
| static short | readSwappedShort(byte[] data,
                 int offset)Reads a "short" value from a byte array at a given offset. | 
| static short | readSwappedShort(InputStream input)Reads a "short" value from an InputStream. | 
| static long | readSwappedUnsignedInteger(byte[] data,
                           int offset)Reads an unsigned integer (32-bit) value from a byte array at a given offset. | 
| static long | readSwappedUnsignedInteger(InputStream input)Reads a unsigned integer (32-bit) from an InputStream. | 
| static int | readSwappedUnsignedShort(byte[] data,
                         int offset)Reads an unsigned short (16-bit) value from a byte array at a given offset. | 
| static int | readSwappedUnsignedShort(InputStream input)Reads a unsigned short (16-bit) from an InputStream. | 
| static double | swapDouble(double value)Converts a "double" value between endian systems. | 
| static float | swapFloat(float value)Converts a "float" value between endian systems. | 
| static int | swapInteger(int value)Converts a "int" value between endian systems. | 
| static long | swapLong(long value)Converts a "long" value between endian systems. | 
| static short | swapShort(short value)Converts a "short" value between endian systems. | 
| static void | writeSwappedDouble(byte[] data,
                   int offset,
                   double value)Writes a "double" value to a byte array at a given offset. | 
| static void | writeSwappedDouble(OutputStream output,
                   double value)Writes a "double" value to an OutputStream. | 
| static void | writeSwappedFloat(byte[] data,
                  int offset,
                  float value)Writes a "float" value to a byte array at a given offset. | 
| static void | writeSwappedFloat(OutputStream output,
                  float value)Writes a "float" value to an OutputStream. | 
| static void | writeSwappedInteger(byte[] data,
                    int offset,
                    int value)Writes a "int" value to a byte array at a given offset. | 
| static void | writeSwappedInteger(OutputStream output,
                    int value)Writes a "int" value to an OutputStream. | 
| static void | writeSwappedLong(byte[] data,
                 int offset,
                 long value)Writes a "long" value to a byte array at a given offset. | 
| static void | writeSwappedLong(OutputStream output,
                 long value)Writes a "long" value to an OutputStream. | 
| static void | writeSwappedShort(byte[] data,
                  int offset,
                  short value)Writes a "short" value to a byte array at a given offset. | 
| static void | writeSwappedShort(OutputStream output,
                  short value)Writes a "short" value to an OutputStream. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public EndianUtils()
| Method Detail | 
|---|
public static short swapShort(short value)
value - value to convert
public static int swapInteger(int value)
value - value to convert
public static long swapLong(long value)
value - value to convert
public static float swapFloat(float value)
value - value to convert
public static double swapDouble(double value)
value - value to convert
public static void writeSwappedShort(byte[] data,
                                     int offset,
                                     short value)
data - target byte arrayoffset - starting offset in the byte arrayvalue - value to write
public static short readSwappedShort(byte[] data,
                                     int offset)
data - source byte arrayoffset - starting offset in the byte array
public static int readSwappedUnsignedShort(byte[] data,
                                           int offset)
data - source byte arrayoffset - starting offset in the byte array
public static void writeSwappedInteger(byte[] data,
                                       int offset,
                                       int value)
data - target byte arrayoffset - starting offset in the byte arrayvalue - value to write
public static int readSwappedInteger(byte[] data,
                                     int offset)
data - source byte arrayoffset - starting offset in the byte array
public static long readSwappedUnsignedInteger(byte[] data,
                                              int offset)
data - source byte arrayoffset - starting offset in the byte array
public static void writeSwappedLong(byte[] data,
                                    int offset,
                                    long value)
data - target byte arrayoffset - starting offset in the byte arrayvalue - value to write
public static long readSwappedLong(byte[] data,
                                   int offset)
data - source byte arrayoffset - starting offset in the byte array
public static void writeSwappedFloat(byte[] data,
                                     int offset,
                                     float value)
data - target byte arrayoffset - starting offset in the byte arrayvalue - value to write
public static float readSwappedFloat(byte[] data,
                                     int offset)
data - source byte arrayoffset - starting offset in the byte array
public static void writeSwappedDouble(byte[] data,
                                      int offset,
                                      double value)
data - target byte arrayoffset - starting offset in the byte arrayvalue - value to write
public static double readSwappedDouble(byte[] data,
                                       int offset)
data - source byte arrayoffset - starting offset in the byte array
public static void writeSwappedShort(OutputStream output,
                                     short value)
                              throws IOException
output - target OutputStreamvalue - value to write
IOException - in case of an I/O problem
public static short readSwappedShort(InputStream input)
                              throws IOException
input - source InputStream
IOException - in case of an I/O problem
public static int readSwappedUnsignedShort(InputStream input)
                                    throws IOException
input - source InputStream
IOException - in case of an I/O problem
public static void writeSwappedInteger(OutputStream output,
                                       int value)
                                throws IOException
output - target OutputStreamvalue - value to write
IOException - in case of an I/O problem
public static int readSwappedInteger(InputStream input)
                              throws IOException
input - source InputStream
IOException - in case of an I/O problem
public static long readSwappedUnsignedInteger(InputStream input)
                                       throws IOException
input - source InputStream
IOException - in case of an I/O problem
public static void writeSwappedLong(OutputStream output,
                                    long value)
                             throws IOException
output - target OutputStreamvalue - value to write
IOException - in case of an I/O problem
public static long readSwappedLong(InputStream input)
                            throws IOException
input - source InputStream
IOException - in case of an I/O problem
public static void writeSwappedFloat(OutputStream output,
                                     float value)
                              throws IOException
output - target OutputStreamvalue - value to write
IOException - in case of an I/O problem
public static float readSwappedFloat(InputStream input)
                              throws IOException
input - source InputStream
IOException - in case of an I/O problem
public static void writeSwappedDouble(OutputStream output,
                                      double value)
                               throws IOException
output - target OutputStreamvalue - value to write
IOException - in case of an I/O problem
public static double readSwappedDouble(InputStream input)
                                throws IOException
input - source InputStream
IOException - in case of an I/O problem| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||