Class LongLEB128

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

public class LongLEB128 extends Object
Read and write LEB128-encoded longs. An 8-byte long is encoded on 1 to 10 bytes.

For decoding only on byte arrays, use the highest-level utility methods in LEB128.

  • Constructor Details

    • LongLEB128

      public LongLEB128()
  • Method Details

    • writeULEB128

      public static void writeULEB128(OutputStream out, long v) throws IOException
      Write an unsigned LEB128-encoded 64-bit integer.
      Parameters:
      out - output stream
      v - value to encode
      Throws:
      IOException - if the output stream cannot be written
    • readULEB128

      public static long readULEB128(InputStream input) throws IOException
      Read an unsigned LEB128-encoded 64-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

      public static LongLEB128.DecodedLong decodeULEB128(InputStream input) throws IOException
      Read an unsigned LEB128-encoded 64-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

      public static void writeSLEB128(OutputStream out, long v) throws IOException
      Write a signed LEB128-encoded 64-bit integer.
      Parameters:
      out - output stream
      v - value to encode
      Throws:
      IOException - if the output stream cannot be written