Class LEB128
java.lang.Object
com.pnfsoftware.jeb.util.encoding.LEB128
Decoding methods for LEB128-encoded integers
from byte arrays. All methods raise a
BadEncodingException on error.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDecoded value along with the encoded length in bytes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LEB128.Valueread_int16(byte[] data, int pos) Read a signed 16-bit LEB128 value.static LEB128.Valueread_int32(byte[] data, int pos) Read a signed 32-bit LEB128 value.static LEB128.Valueread_int64(byte[] data, int pos) Read a signed 64-bit LEB128 value.static LEB128.Valueread_int7(byte[] data, int pos) Read a signed 7-bit LEB128 value.static LEB128.Valueread_uint1(byte[] data, int pos) Read an unsigned 1-bit LEB128 value.static LEB128.Valueread_uint16(byte[] data, int pos) Read an unsigned 16-bit LEB128 value.static LEB128.Valueread_uint32(byte[] data, int pos) Read an unsigned 32-bit LEB128 value.static LEB128.Valueread_uint64(byte[] data, int pos) Read an unsigned 64-bit LEB128 value.static LEB128.Valueread_uint7(byte[] data, int pos) Read an unsigned 7-bit LEB128 value.
-
Constructor Details
-
LEB128
public LEB128()
-
-
Method Details
-
read_int7
Read a signed 7-bit LEB128 value.- Parameters:
data- input bytespos- offset of the encoded value- Returns:
- decoded value and encoded byte length
- Throws:
BadEncodingException- if the value is malformed or out of range
-
read_int16
Read a signed 16-bit LEB128 value.- Parameters:
data- input bytespos- offset of the encoded value- Returns:
- decoded value and encoded byte length
- Throws:
BadEncodingException- if the value is malformed or out of range
-
read_int32
Read a signed 32-bit LEB128 value.- Parameters:
data- input bytespos- offset of the encoded value- Returns:
- decoded value and encoded byte length
- Throws:
BadEncodingException- if the value is malformed or out of range
-
read_int64
Read a signed 64-bit LEB128 value.- Parameters:
data- input bytespos- offset of the encoded value- Returns:
- decoded value and encoded byte length
- Throws:
BadEncodingException- if the value is malformed
-
read_uint1
Read an unsigned 1-bit LEB128 value.- Parameters:
data- input bytespos- offset of the encoded value- Returns:
- decoded value and encoded byte length
- Throws:
BadEncodingException- if the value is malformed or out of range
-
read_uint7
Read an unsigned 7-bit LEB128 value.- Parameters:
data- input bytespos- offset of the encoded value- Returns:
- decoded value and encoded byte length
- Throws:
BadEncodingException- if the value is malformed or out of range
-
read_uint16
Read an unsigned 16-bit LEB128 value.- Parameters:
data- input bytespos- offset of the encoded value- Returns:
- decoded value and encoded byte length
- Throws:
BadEncodingException- if the value is malformed or out of range
-
read_uint32
Read an unsigned 32-bit LEB128 value.- Parameters:
data- input bytespos- offset of the encoded value- Returns:
- decoded value and encoded byte length
- Throws:
BadEncodingException- if the value is malformed or out of range
-
read_uint64
Read an unsigned 64-bit LEB128 value.- Parameters:
data- input bytespos- offset of the encoded value- Returns:
- decoded value and encoded byte length
- Throws:
BadEncodingException- if the value is malformed
-