Class IntegerLEB128
java.lang.Object
com.pnfsoftware.jeb.util.encoding.IntegerLEB128
Read and write LEB128-encoded integers. A 4-byte integer is encoded on 1 to 5 bytes.
For decoding only on byte arrays, use the highest-level utility methods in LEB128.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDecoded value along with the encoded length in bytes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic IntegerLEB128.DecodedIntdecodeULEB128(InputStream input) Read an unsigned LEB128-encoded 32-bit integer and its encoded size.static intreadULEB128(InputStream input) Read an unsigned LEB128-encoded 32-bit integer.static voidwriteSLEB128(OutputStream out, int v) Write a signed LEB128-encoded 32-bit integer.static voidwriteULEB128(OutputStream out, int v) Write an unsigned LEB128-encoded 32-bit integer.
-
Constructor Details
-
IntegerLEB128
public IntegerLEB128()
-
-
Method Details
-
writeULEB128
Write an unsigned LEB128-encoded 32-bit integer.- Parameters:
out- output streamv- value to encode- Throws:
IOException- if the output stream cannot be written
-
readULEB128
Read an unsigned LEB128-encoded 32-bit integer.- Parameters:
input- input stream positioned at the encoded value- Returns:
- decoded value
- Throws:
IOException- if the value is malformed or cannot be fully read
-
decodeULEB128
Read an unsigned LEB128-encoded 32-bit integer and its encoded size.- Parameters:
input- input stream positioned at the encoded value- Returns:
- decoded value and encoded byte length
- Throws:
IOException- if the value is malformed or cannot be fully read
-
writeSLEB128
Write a signed LEB128-encoded 32-bit integer.- Parameters:
out- output streamv- value to encode- Throws:
IOException- if the output stream cannot be written
-