|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.limegroup.gnutella.ByteOrder
Various static routines for solving endian problems.
| Constructor Summary | |
ByteOrder()
|
|
| Method Summary | |
static int |
beb2int(byte[] x,
int offset)
Big-endian bytes to int. |
static void |
int2leb(int x,
byte[] buf,
int offset)
Int to little-endian bytes: writes x to buf[offset..] |
static void |
int2leb(int x,
java.io.OutputStream os)
Int to little-endian bytes: writes x to given stream |
static byte[] |
int2minLeb(int x)
Returns the minimum number of bytes needed to encode x in little-endian format, assuming x is non-negative. |
static int |
leb2int(byte[] x,
int offset)
Little-endian bytes to int |
static int |
leb2int(byte[] x,
int offset,
int n)
Little-endian bytes to int. |
static int |
leb2int(java.io.InputStream is)
Little-endian bytes to int - stream version |
static short |
leb2short(byte[] x,
int offset)
Little-endian bytes to short |
static short |
leb2short(java.io.InputStream is)
Little-endian bytes to short - stream version |
static int |
long2int(long l)
Returns the int value that is closest to l. |
static byte[] |
reverse(byte[] x)
Returns the reverse of x. |
static void |
short2leb(short x,
byte[] buf,
int offset)
Short to little-endian bytes: writes x to buf[offset...] |
static void |
short2leb(short x,
java.io.OutputStream os)
Short to little-endian bytes: writes x to given stream |
static int |
ubyte2int(byte x)
Interprets the value of x as an unsigned byte, and returns it as integer. |
static int |
ubytes2int(short x)
Interprets the value of x as am unsigned two-byte number |
static long |
ubytes2long(int x)
Interprets the value of x as an unsigned two-byte number |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ByteOrder()
| Method Detail |
public static byte[] reverse(byte[] x)
public static short leb2short(byte[] x,
int offset)
public static short leb2short(java.io.InputStream is)
throws java.io.IOException
java.io.IOException
public static int leb2int(byte[] x,
int offset)
public static int beb2int(byte[] x,
int offset)
public static int leb2int(java.io.InputStream is)
throws java.io.IOException
java.io.IOException
public static int leb2int(byte[] x,
int offset,
int n)
throws java.lang.IndexOutOfBoundsException,
java.lang.IllegalArgumentException
x - the source of the bytesoffset - the index to start reading bytesn - the number of bytes to read, which must be between 1 and 4,
inclusive
java.lang.IllegalArgumentException - n is less than 1 or greater than 4
java.lang.IndexOutOfBoundsException - offset<0 or offset+n>x.length
public static void short2leb(short x,
byte[] buf,
int offset)
public static void short2leb(short x,
java.io.OutputStream os)
throws java.io.IOException
java.io.IOException
public static void int2leb(int x,
byte[] buf,
int offset)
public static void int2leb(int x,
java.io.OutputStream os)
throws java.io.IOException
java.io.IOException
public static byte[] int2minLeb(int x)
throws java.lang.IllegalArgumentException
x - a non-negative integer
java.lang.IllegalArgumentException - x is negativepublic static int ubyte2int(byte x)
public static int ubytes2int(short x)
public static long ubytes2long(int x)
public static int long2int(long l)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||