org.jboss.ejb.client.remoting
Class PackedInteger
java.lang.Object
org.jboss.ejb.client.remoting.PackedInteger
public class PackedInteger
- extends Object
A PackedInteger
is a variable-length integer. The most-significant bit of each byte of a
PackedInteger
value indicates whether that byte is the final (lowest-order) byte of the value.
If the bit is 0, then this is the last byte; if the bit is 1, then there is at least one more subsequent
byte pending, and the current value should be shifted to the left by 7 bits to accommodate the next byte's data.
Note: PackedInteger
cannot hold signed integer values.
- Author:
- Carlo de Wolf
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PackedInteger
public PackedInteger()
readPackedInteger
public static int readPackedInteger(DataInput input)
throws IOException
- Reads a
PackedInteger
value from the passed input
and returns the
value of the integer.
- Parameters:
input
- The DataInput
from which the PackedInteger
value will be read
- Returns:
-
- Throws:
IOException
IllegalArgumentException
- If the passed input
is null
writePackedInteger
public static void writePackedInteger(DataOutput output,
int value)
throws IOException
- Converts the passed
value
into a PackedInteger
and writes it to the
output
- Parameters:
output
- The DataOutput
to which the PackedInteger
is written tovalue
- The integer value which will be converted to a PackedInteger
- Throws:
IOException
IllegalArgumentException
- If the passed value
is < 0. PackedInteger
doesn't
allow signed integer
IllegalArgumentException
- If the passed output
is null
toPackedInteger
public static byte[] toPackedInteger(int value)
throws IOException
- Throws:
IOException
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.