org.archive.io
Class Endian

java.lang.Object
  extended by org.archive.io.Endian

public class Endian
extends java.lang.Object

Reads integers stored in big or little endian streams.

Author:
pjack

Method Summary
static char bigChar(java.io.InputStream input)
          Reads the next big-endian unsigned 16 bit integer from the given stream.
static int bigInt(java.io.InputStream input)
          Reads the next big-endian signed 32-bit integer from the given stream.
static char littleChar(java.io.InputStream input)
          Reads the next little-endian unsigned 16 bit integer from the given stream.
static int littleInt(java.io.InputStream input)
          Reads the next little-endian signed 32-bit integer from the given stream.
static short littleShort(java.io.InputStream input)
          Reads the next little-endian signed 16-bit integer from the given stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

littleChar

public static char littleChar(java.io.InputStream input)
                       throws java.io.IOException
Reads the next little-endian unsigned 16 bit integer from the given stream.

Parameters:
input - the input stream to read from
Returns:
the next 16-bit little-endian integer
Throws:
java.io.IOException - if an IO error occurs

littleShort

public static short littleShort(java.io.InputStream input)
                         throws java.io.IOException
Reads the next little-endian signed 16-bit integer from the given stream.

Parameters:
input - the input stream to read from
Returns:
the next 16-bit little-endian integer
Throws:
java.io.IOException - if an IO error occurs

littleInt

public static int littleInt(java.io.InputStream input)
                     throws java.io.IOException
Reads the next little-endian signed 32-bit integer from the given stream.

Parameters:
input - the input stream to read from
Returns:
the next 32-bit little-endian integer
Throws:
java.io.IOException - if an IO error occurs

bigChar

public static char bigChar(java.io.InputStream input)
                    throws java.io.IOException
Reads the next big-endian unsigned 16 bit integer from the given stream.

Parameters:
input - the input stream to read from
Returns:
the next 16-bit big-endian integer
Throws:
java.io.IOException - if an IO error occurs

bigInt

public static int bigInt(java.io.InputStream input)
                  throws java.io.IOException
Reads the next big-endian signed 32-bit integer from the given stream.

Parameters:
input - the input stream to read from
Returns:
the next 32-bit big-endian integer
Throws:
java.io.IOException - if an IO error occurs


Copyright © 2003-2011 Internet Archive. All Rights Reserved.