Class LEB128

java.lang.Object
com.pnfsoftware.jeb.util.encoding.LEB128

public class LEB128 extends Object
Decoding methods for LEB128-encoded integers from byte arrays. All methods raise a BadEncodingException on error.
  • Constructor Details

    • LEB128

      public LEB128()
  • Method Details

    • read_int7

      public static LEB128.Value read_int7(byte[] data, int pos) throws BadEncodingException
      Read a signed 7-bit LEB128 value.
      Parameters:
      data - input bytes
      pos - 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

      public static LEB128.Value read_int16(byte[] data, int pos) throws BadEncodingException
      Read a signed 16-bit LEB128 value.
      Parameters:
      data - input bytes
      pos - 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

      public static LEB128.Value read_int32(byte[] data, int pos) throws BadEncodingException
      Read a signed 32-bit LEB128 value.
      Parameters:
      data - input bytes
      pos - 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

      public static LEB128.Value read_int64(byte[] data, int pos) throws BadEncodingException
      Read a signed 64-bit LEB128 value.
      Parameters:
      data - input bytes
      pos - offset of the encoded value
      Returns:
      decoded value and encoded byte length
      Throws:
      BadEncodingException - if the value is malformed
    • read_uint1

      public static LEB128.Value read_uint1(byte[] data, int pos) throws BadEncodingException
      Read an unsigned 1-bit LEB128 value.
      Parameters:
      data - input bytes
      pos - 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

      public static LEB128.Value read_uint7(byte[] data, int pos) throws BadEncodingException
      Read an unsigned 7-bit LEB128 value.
      Parameters:
      data - input bytes
      pos - 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

      public static LEB128.Value read_uint16(byte[] data, int pos) throws BadEncodingException
      Read an unsigned 16-bit LEB128 value.
      Parameters:
      data - input bytes
      pos - 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

      public static LEB128.Value read_uint32(byte[] data, int pos) throws BadEncodingException
      Read an unsigned 32-bit LEB128 value.
      Parameters:
      data - input bytes
      pos - 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

      public static LEB128.Value read_uint64(byte[] data, int pos) throws BadEncodingException
      Read an unsigned 64-bit LEB128 value.
      Parameters:
      data - input bytes
      pos - offset of the encoded value
      Returns:
      decoded value and encoded byte length
      Throws:
      BadEncodingException - if the value is malformed