Package fr.dyade.aaa.common.encoding
Interface Encoder
-
- All Known Implementing Classes:
ByteBufferEncoder
public interface Encoder
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidencode16(short s)Encodes a signed short integer.voidencode32(int i)Encodes a signed integer.voidencode64(long l)Encodes a signed long integer.voidencodeBoolean(boolean bool)Encodes a boolean.voidencodeByte(byte b)Encodes a byte.voidencodeByteArray(byte[] b)Encodes a byte array that cannot be null.voidencodeByteArray(byte[] b, int offset, int length)Encodes a byte array that cannot be null.voidencodeDouble(double d)Encodes a double.voidencodeFloat(float f)Encodes a float.voidencodeNullableByteArray(byte[] b)Encodes a byte array that can be null.voidencodeNullableByteArray(byte[] b, int offset, int length)Encodes a byte array that can be null.voidencodeNullableString(String str)Encodes a string that can be null.voidencodeSignedInt(int i)Encodes a signed integer.voidencodeSignedLong(long l)Encodes a signed long integer.voidencodeSignedShort(short s)Encodes a signed short integer.voidencodeString(String str)Encodes a string that cannot be null.voidencodeUnsignedInt(int i)Encodes an unsigned integer.voidencodeUnsignedLong(long l)Encodes an unsigned long integer.voidencodeUnsignedShort(short s)Encodes an unsigned short integer.
-
-
-
Method Detail
-
encodeBoolean
void encodeBoolean(boolean bool) throws ExceptionEncodes a boolean.- Parameters:
bool- the value to encode- Throws:
Exception- if an error occurs during encoding
-
encodeByte
void encodeByte(byte b) throws ExceptionEncodes a byte.- Parameters:
b- the value to encode- Throws:
Exception- if an error occurs during encoding
-
encodeSignedShort
void encodeSignedShort(short s) throws ExceptionEncodes a signed short integer. The encoding format depends on the implementation.- Parameters:
s- the value to encode- Throws:
Exception- if an error occurs during encoding
-
encodeUnsignedShort
void encodeUnsignedShort(short s) throws ExceptionEncodes an unsigned short integer. The encoding format depends on the implementation.- Parameters:
s- the value to encode- Throws:
Exception- if an error occurs during encoding
-
encode16
void encode16(short s) throws ExceptionEncodes a signed short integer. The encoding format is the 2's complement representation encoded in 2 bytes.- Parameters:
s- the value to encode- Throws:
Exception- if an error occurs during encoding
-
encodeSignedInt
void encodeSignedInt(int i) throws ExceptionEncodes a signed integer. The encoding format depends on the implementation.- Parameters:
i- the value to encode- Throws:
Exception- if an error occurs during encoding
-
encodeUnsignedInt
void encodeUnsignedInt(int i) throws ExceptionEncodes an unsigned integer. The encoding format depends on the implementation.- Parameters:
i- the value to encode- Throws:
Exception- if an error occurs during encoding
-
encode32
void encode32(int i) throws ExceptionEncodes a signed integer. The encoding format is the 2's complement representation encoded in 4 bytes.- Parameters:
i- the value to encode- Throws:
Exception- if an error occurs during encoding
-
encodeSignedLong
void encodeSignedLong(long l) throws ExceptionEncodes a signed long integer. The encoding format depends on the implementation.- Parameters:
l- the value to encode- Throws:
Exception- if an error occurs during encoding
-
encodeUnsignedLong
void encodeUnsignedLong(long l) throws ExceptionEncodes an unsigned long integer. The encoding format depends on the implementation.- Parameters:
l- the value to encode- Throws:
Exception- if an error occurs during encoding
-
encode64
void encode64(long l) throws ExceptionEncodes a signed long integer. The encoding format is the 2's complement representation encoded in 8 bytes.- Parameters:
l- the value to encode- Throws:
Exception- if an error occurs during encoding
-
encodeNullableString
void encodeNullableString(String str) throws Exception
Encodes a string that can be null. Be careful, since Joram 5.19, by default String are encoded using UTF-8.- Parameters:
str- the value to encode- Throws:
Exception- if an error occurs during encoding
-
encodeString
void encodeString(String str) throws Exception
Encodes a string that cannot be null. Be careful, since Joram 5.19, by default String are encoded using UTF-8.- Parameters:
str- the value to encode- Throws:
Exception- if an error occurs during encoding
-
encodeNullableByteArray
void encodeNullableByteArray(byte[] b) throws ExceptionEncodes a byte array that can be null.- Parameters:
b- the value to encode- Throws:
Exception- if an error occurs during encoding
-
encodeByteArray
void encodeByteArray(byte[] b) throws ExceptionEncodes a byte array that cannot be null.- Parameters:
b- the value to encode- Throws:
Exception- if an error occurs during encoding
-
encodeNullableByteArray
void encodeNullableByteArray(byte[] b, int offset, int length) throws ExceptionEncodes a byte array that can be null.- Parameters:
b- the value to encodeoffset- the starting index in array blength- the number of bytes to be encoded- Throws:
Exception- if an error occurs during encoding
-
encodeByteArray
void encodeByteArray(byte[] b, int offset, int length) throws ExceptionEncodes a byte array that cannot be null.- Parameters:
b- the value to encodeoffset- the starting index in array blength- the number of bytes to be encoded- Throws:
Exception- if an error occurs during encoding
-
encodeFloat
void encodeFloat(float f) throws ExceptionEncodes a float.- Parameters:
f- the value to encode- Throws:
Exception- if an error occurs during encoding
-
-