public final class Serializer extends Object
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
getBytes(int value)
Converts a signed int to a byte array.
|
static byte[] |
getBytes(long value)
Converts a signed long to a byte array.
|
static byte[] |
getBytes(short value)
Converts a signed short to a byte array.
|
static byte[] |
getFiveBytes(long value)
Converts the lowest five bytes of an unsigned long to a byte array.
|
static byte[] |
getVariableByteSigned(int value)
Converts a signed int to a variable length byte array.
|
static byte[] |
getVariableByteUnsigned(int value)
Converts an unsigned int to a variable length byte array.
|
public static byte[] getBytes(int value)
The byte order is big-endian.
value - the int value.public static byte[] getBytes(long value)
The byte order is big-endian.
value - the long value.public static byte[] getBytes(short value)
The byte order is big-endian.
value - the short value.public static byte[] getFiveBytes(long value)
The byte order is big-endian.
value - the long value, must not be negative.public static byte[] getVariableByteSigned(int value)
The first bit is for continuation info, the other six (last byte) or seven (all other bytes) bits for data. The second bit in the last byte indicates the sign of the number.
value - the int value.public static byte[] getVariableByteUnsigned(int value)
The first bit is for continuation info, the other seven bits for data.
value - the int value, must not be negative.Copyright © 2014 mapsforge.org