|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.obsearch.utils.bytes.ByteConversion
public class ByteConversion
ByteConversion. Utilities to convert primitive types from and to byte arrays.
| Field Summary | |
|---|---|
static ByteOrder |
ORDERING
|
| Constructor Summary | |
|---|---|
ByteConversion()
|
|
| Method Summary | |
|---|---|
static byte |
byteBufferToByte(ByteBuffer data)
Reads a(n) Byte from the beginning of the given ByteBuffer. |
static double |
byteBufferToDouble(ByteBuffer data)
Reads a(n) Double from the beginning of the given ByteBuffer. |
static float |
byteBufferToFloat(ByteBuffer data)
Reads a(n) Float from the beginning of the given ByteBuffer. |
static int |
byteBufferToInt(ByteBuffer data)
Reads a(n) Int from the beginning of the given ByteBuffer. |
static long |
byteBufferToLong(ByteBuffer data)
Reads a(n) Long from the beginning of the given ByteBuffer. |
static short |
byteBufferToShort(ByteBuffer data)
Reads a(n) Short from the beginning of the given ByteBuffer. |
static byte |
bytesToByte(byte[] data)
Reads a(n) Byte from the beginning of the given data array. |
static double |
bytesToDouble(byte[] data)
Reads a(n) Double from the beginning of the given data array. |
static float |
bytesToFloat(byte[] data)
Reads a(n) Float from the beginning of the given data array. |
static int |
bytesToInt(byte[] data)
Reads a(n) Int from the beginning of the given data array. |
static long |
bytesToLong(byte[] data)
Reads a(n) Long from the beginning of the given data array. |
static short |
bytesToShort(byte[] data)
Reads a(n) Short from the beginning of the given data array. |
static ByteBuffer |
byteToByteBuffer(byte i)
Convert a(n) Byte into bytes. |
static byte[] |
byteToBytes(byte i)
Convert a(n) Byte into bytes. |
static ByteBuffer |
createByteBuffer(byte[] data)
Create a ByteBuffer from the given byte array. |
static ByteBuffer |
createByteBuffer(int n)
Create a ByteBuffer of size n. |
static ByteBuffer |
doubleToByteBuffer(double i)
Convert a(n) Double into bytes. |
static byte[] |
doubleToBytes(double i)
Convert a(n) Double into bytes. |
static ByteBuffer |
floatToByteBuffer(float i)
Convert a(n) Float into bytes. |
static byte[] |
floatToBytes(float i)
Convert a(n) Float into bytes. |
static ByteBuffer |
intToByteBuffer(int i)
Convert a(n) Int into bytes. |
static byte[] |
intToBytes(int i)
Convert a(n) Int into bytes. |
static ByteBuffer |
longToByteBuffer(long i)
Convert a(n) Long into bytes. |
static byte[] |
longToBytes(long i)
Convert a(n) Long into bytes. |
static ByteBuffer |
shortToByteBuffer(short i)
Convert a(n) Short into bytes. |
static byte[] |
shortToBytes(short i)
Convert a(n) Short into bytes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final ByteOrder ORDERING
| Constructor Detail |
|---|
public ByteConversion()
| Method Detail |
|---|
public static ByteBuffer createByteBuffer(int n)
n - size of the new buffer.
public static ByteBuffer createByteBuffer(byte[] data)
n - size of the new buffer.
public static byte bytesToByte(byte[] data)
data - Data that holds the encoded byte.
public static byte[] byteToBytes(byte i)
i - value to convert.
public static byte byteBufferToByte(ByteBuffer data)
data - Data that holds the encoded byte.
public static ByteBuffer byteToByteBuffer(byte i)
i - value to convert.
public static short bytesToShort(byte[] data)
data - Data that holds the encoded short.
public static byte[] shortToBytes(short i)
i - value to convert.
public static short byteBufferToShort(ByteBuffer data)
data - Data that holds the encoded short.
public static ByteBuffer shortToByteBuffer(short i)
i - value to convert.
public static int bytesToInt(byte[] data)
data - Data that holds the encoded int.
public static byte[] intToBytes(int i)
i - value to convert.
public static int byteBufferToInt(ByteBuffer data)
data - Data that holds the encoded int.
public static ByteBuffer intToByteBuffer(int i)
i - value to convert.
public static long bytesToLong(byte[] data)
data - Data that holds the encoded long.
public static byte[] longToBytes(long i)
i - value to convert.
public static long byteBufferToLong(ByteBuffer data)
data - Data that holds the encoded long.
public static ByteBuffer longToByteBuffer(long i)
i - value to convert.
public static float bytesToFloat(byte[] data)
data - Data that holds the encoded float.
public static byte[] floatToBytes(float i)
i - value to convert.
public static float byteBufferToFloat(ByteBuffer data)
data - Data that holds the encoded float.
public static ByteBuffer floatToByteBuffer(float i)
i - value to convert.
public static double bytesToDouble(byte[] data)
data - Data that holds the encoded double.
public static byte[] doubleToBytes(double i)
i - value to convert.
public static double byteBufferToDouble(ByteBuffer data)
data - Data that holds the encoded double.
public static ByteBuffer doubleToByteBuffer(double i)
i - value to convert.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||