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 | Field and Description | 
|---|---|
static EndianUtil | 
BIG_ENDIAN
Directly usable bigEndian EndianUtil. 
 | 
static EndianUtil | 
LITTLE_ENDIAN
Directly usable littleEndian EndianUtil. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
static EndianUtil | 
bigEndian()
Construct an EndianUtil object that uses bigEndian encoding. 
 | 
char | 
decodeChar(byte[] message,
          int pointer)
Decode a char (16 bits). 
 | 
double | 
decodeDouble(byte[] message,
            int pointer)
Decode a double. 
 | 
float | 
decodeFloat(byte[] message,
           int pointer)
Decode a float. 
 | 
int | 
decodeInt(byte[] message,
         int pointer)
Decode a int. 
 | 
long | 
decodeLong(byte[] message,
          int pointer)
Decode a long. 
 | 
short | 
decodeShort(byte[] message,
           int pointer)
Decode a short. 
 | 
String | 
decodeUTF16String(byte[] message,
                 int pointer)
Decode a String including the length int from the message byte array. 
 | 
String | 
decodeUTF8String(byte[] message,
                int pointer)
Decode a String including the length int from the message byte array. 
 | 
int | 
encodeChar(char v,
          byte[] message,
          int pointer)
Encode a char (16 bits) into a message buffer. 
 | 
int | 
encodeDouble(double v,
            byte[] message,
            int pointer)
Encode a double into a message buffer. 
 | 
void | 
encodeFloat(float v,
           byte[] message,
           int pointer)
Encode a float into a message buffer. 
 | 
void | 
encodeInt(int v,
         byte[] message,
         int pointer)
Encode a int into a message buffer. 
 | 
int | 
encodeLong(long v,
          byte[] message,
          int pointer)
Encode a long into a message buffer. 
 | 
int | 
encodeShort(short v,
           byte[] message,
           int pointer)
Encode a short into a message buffer. 
 | 
boolean | 
isBigEndian()
Report if this EndianUtil is bigEndian. 
 | 
static boolean | 
isPlatformBigEndian()
Report whether this platform is bigEndian, or littleEndian. 
 | 
static EndianUtil | 
littleEndian()
Construct an EndianUtil object that uses littleEndian encoding. 
 | 
String | 
toString()  | 
public static final EndianUtil BIG_ENDIAN
public static final EndianUtil LITTLE_ENDIAN
public static boolean isPlatformBigEndian()
public static EndianUtil bigEndian()
public static EndianUtil littleEndian()
public boolean isBigEndian()
public short decodeShort(byte[] message,
                         int pointer)
message - the ZeroMQ byte array to decodepointer - the first byte to considerpublic int decodeInt(byte[] message,
                     int pointer)
message - the ZeroMQ byte array to decodepointer - the first byte to considerpublic long decodeLong(byte[] message,
                       int pointer)
message - the ZeroMQ byte array to decodepointer - the first byte to considerpublic float decodeFloat(byte[] message,
                         int pointer)
message - the ZeroMQ byte array to decodepointer - the first byte to considerpublic double decodeDouble(byte[] message,
                           int pointer)
message - the ZeroMQ byte array to decodepointer - the first byte to considerpublic char decodeChar(byte[] message,
                       int pointer)
message - the ZeroMQ byte array to decodepointer - the first byte to considerpublic String decodeUTF8String(byte[] message, int pointer) throws SerializationException
message - the message byte arraypointer - the start position in the arraySerializationException - when the bytes cannot be parsed as UTF8public String decodeUTF16String(byte[] message, int pointer)
message - the message byte arraypointer - the start position in the arraypublic 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 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 void 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 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 void 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 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 writingCopyright © 2018–2019 Delft University of Technology. All rights reserved.