public final class EndianUtil extends Object
Copyright (c) 2016-2017 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See Sim0MQ License.
Modifier and Type | Method and Description |
---|---|
static char |
decodeChar(byte[] message,
int pointer)
Decode a char (16 bits).
|
static double |
decodeDouble(byte[] message,
int pointer)
Decode a double.
|
static float |
decodeFloat(byte[] message,
int pointer)
Decode a float.
|
static int |
decodeInt(byte[] message,
int pointer)
Decode a int.
|
static long |
decodeLong(byte[] message,
int pointer)
Decode a long.
|
static short |
decodeShort(byte[] message,
int pointer)
Decode a short.
|
static String |
decodeUTF16String(byte[] message,
int pointer)
Decode a String including the length int from the message byte array.
|
static String |
decodeUTF8String(byte[] message,
int pointer)
Decode a String including the length int from the message byte array.
|
static byte[] |
doubleToByteArray(double v)
Return a double encoded as a byte array.
|
static int |
encodeChar(char v,
byte[] message,
int pointer)
Encode a char (16 bits) into a message buffer.
|
static int |
encodeDouble(double v,
byte[] message,
int pointer)
Encode a double into a message buffer.
|
static int |
encodeFloat(float v,
byte[] message,
int pointer)
Encode a float into a message buffer.
|
static int |
encodeInt(int v,
byte[] message,
int pointer)
Encode a int into a message buffer.
|
static int |
encodeLong(long v,
byte[] message,
int pointer)
Encode a long into a message buffer.
|
static int |
encodeShort(short v,
byte[] message,
int pointer)
Encode a short into a message buffer.
|
static byte[] |
floatToByteArray(float v)
Return a float encoded as a byte array.
|
static byte[] |
intToByteArray(int v)
Return an int encoded as a byte array.
|
static boolean |
isDefaultBigEndian() |
static boolean |
isPlatformBigEndian() |
static byte[] |
longToByteArray(long v)
Return a long encoded as a byte array.
|
static void |
setDefaultBigEndian(boolean defaultBigEndian) |
public static short decodeShort(byte[] message, int pointer)
message
- the ZeroMQ byte array to decodepointer
- the first byte to considerpublic static int decodeInt(byte[] message, int pointer)
message
- the ZeroMQ byte array to decodepointer
- the first byte to considerpublic static long decodeLong(byte[] message, int pointer)
message
- the ZeroMQ byte array to decodepointer
- the first byte to considerpublic static float decodeFloat(byte[] message, int pointer)
message
- the ZeroMQ byte array to decodepointer
- the first byte to considerpublic static double decodeDouble(byte[] message, int pointer)
message
- the ZeroMQ byte array to decodepointer
- the first byte to considerpublic static char decodeChar(byte[] message, int pointer)
message
- the ZeroMQ byte array to decodepointer
- the first byte to considerpublic static String decodeUTF8String(byte[] message, int pointer)
message
- the message byte arraypointer
- the start position in the arraypublic static String decodeUTF16String(byte[] message, int pointer)
message
- the message byte arraypointer
- the start position in the arraypublic static int encodeShort(short v, byte[] message, int pointer)
v
- the variable to encodemessage
- the message buffer to encode the variable intopointer
- the pointer to start writingpublic static int encodeChar(char v, byte[] message, int pointer)
v
- the variable to encodemessage
- the message buffer to encode the variable intopointer
- the pointer to start writingpublic static int encodeInt(int v, byte[] message, int pointer)
v
- the variable to encodemessage
- the message buffer to encode the variable intopointer
- the pointer to start writingpublic static int encodeLong(long v, byte[] message, int pointer)
v
- the variable to encodemessage
- the message buffer to encode the variable intopointer
- the pointer to start writingpublic static int encodeFloat(float v, byte[] message, int pointer)
v
- the variable to encodemessage
- the message buffer to encode the variable intopointer
- the pointer to start writingpublic static int encodeDouble(double v, byte[] message, int pointer)
v
- the variable to encodemessage
- the message buffer to encode the variable intopointer
- the pointer to start writingpublic static byte[] longToByteArray(long v)
v
- the long variable to encodepublic static byte[] intToByteArray(int v)
v
- the int variable to encodepublic static byte[] doubleToByteArray(double v)
v
- the double variable to encodepublic static byte[] floatToByteArray(float v)
v
- the float variable to encodepublic static boolean isDefaultBigEndian()
public static void setDefaultBigEndian(boolean defaultBigEndian)
defaultBigEndian
- set defaultBigEndianpublic static boolean isPlatformBigEndian()
Copyright © 2016–2018 Delft University of Technology. All rights reserved.