Class NBitIntegerEncoder


  • public class NBitIntegerEncoder
    extends java.lang.Object
    Used to encode integers as described in RFC7541.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void encode​(java.nio.ByteBuffer buffer, int prefix, long value)  
      static int octetsNeeded​(int prefix, long value)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • octetsNeeded

        public static int octetsNeeded​(int prefix,
                                       long value)
        Parameters:
        prefix - the prefix used to encode this long.
        value - the integer to encode.
        Returns:
        the number of octets it would take to encode the long.
      • encode

        public static void encode​(java.nio.ByteBuffer buffer,
                                  int prefix,
                                  long value)
        Parameters:
        buffer - the buffer to encode into.
        prefix - the prefix used to encode this long.
        value - the long to encode into the buffer.