|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectunsigned.uShort
public class uShort
Written by Evangelos Haleplidis, e_halep at yahoo dot gr, and Sean R Owens, sean at guild dot net, released to the public domain. Share and enjoy. Since some people argue that it is impossible to release software to the public domain, you are also free to use this code under any version of the GPL, LPGL, or BSD licenses, or contact the authors for use of another license. The unsigned Short Class.
Constructor Summary | |
---|---|
uShort()
Unsigned Short constructor with no value. |
|
uShort(byte[] bytes,
int offset)
Unsigned Short constructor that gets an already read unsigned Integer that exists inside a Byte Array at position offset and converts it into the proper format for Java |
|
uShort(java.nio.ByteBuffer bb,
int offset)
Unsigned Short constructor that read gets an already read unsigned Short that exists inside a ByteBuffer at position offset and converts it into the proper format for Java Caution, the position of the bytebuffer is not changed inside the constructor. |
|
uShort(char tobecomeunsigned)
Unsigned Short constructor with a value in Java format. |
|
uShort(short unsigned)
Unsigned Short constructor with an already read unsigned short to be converted to Java format. |
Method Summary | |
---|---|
char |
getValue()
getValue returns the actual value of the unsigned short. |
void |
read(byte[] bytes,
int offset)
Read gets an already read unsigned Integer that exists inside a Byte Array at position offset and converts it into the proper format for Java |
void |
read(java.nio.ByteBuffer bb,
int offset)
Read gets an already read unsigned Short that exists inside a ByteBuffer at position offset and converts it into the proper format for Java Caution, the position of the bytebuffer is not changed inside this read call. |
void |
read(short i)
Read gets an already read unsigned Short and converts it into the proper format for Java |
void |
setValue(char value)
SetValue sets a unSigned short value. |
byte[] |
write()
WriteUnShort prepares the unsigned Shot from Java format to be written into the proper unsigned format for the wire. |
boolean |
write(byte[] bytes,
int offset)
Write prepares the unsigned Short from Java format to be written into the proper unsigned format for the wire and puts it at a ByteArray at position equal to offset. |
boolean |
write(java.nio.ByteBuffer bb,
int offset)
Write prepares the unsigned Short from Java format to be written into the proper unsigned format for the wire and puts it at a ByteBuffer at position equal to offset. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public uShort()
public uShort(short unsigned)
unsigned
- The already read unsigned short that needs to be converted to Java format.public uShort(char tobecomeunsigned)
tobecomeunsigned
- The value in javaformat.public uShort(java.nio.ByteBuffer bb, int offset)
bb
- The ByteBuffer in which the already read unsigned Short existsoffset
- The position that the 2 bytes of the unsigned Short startspublic uShort(byte[] bytes, int offset)
bytes
- The byte arrayoffset
- The position that the 2 bytes of the unsigned integer startsMethod Detail |
---|
public void read(short i)
i
- The read unsigned short that needs to be converted to Java format.public void read(java.nio.ByteBuffer bb, int offset)
bb
- The ByteBuffer in which the already read unsigned Short existsoffset
- The position that the 2 bytes of the unsigned Short startspublic void read(byte[] bytes, int offset)
bytes
- The byte arrayoffset
- The position that the 2 bytes of the unsigned integer startspublic byte[] write()
public boolean write(java.nio.ByteBuffer bb, int offset)
bb
- The Bytebuffer to put the Unsigned Shortoffset
- The position to start putting the 2 bytes
public boolean write(byte[] bytes, int offset)
bytes
- The Byte Array to put the Unsigned Shortoffset
- The position to start putting the 2 bytes
public char getValue()
public void setValue(char value)
value
- The value in char format.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |