Class UnsignedNumeric


  • public class UnsignedNumeric
    extends java.lang.Object
    Helper to read and write unsigned numerics
    Since:
    4.0
    Author:
    Manik Surtani
    • Constructor Summary

      Constructors 
      Constructor Description
      UnsignedNumeric()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int readUnsignedInt​(byte[] bytes, int offset)
      Reads an int stored in variable-length format.
      static int readUnsignedInt​(java.io.InputStream in)  
      static int readUnsignedInt​(java.io.ObjectInput in)
      Reads an int stored in variable-length format.
      static int readUnsignedInt​(java.nio.ByteBuffer in)  
      static long readUnsignedLong​(byte[] bytes, int offset)
      Reads an int stored in variable-length format.
      static long readUnsignedLong​(java.io.InputStream in)  
      static long readUnsignedLong​(java.io.ObjectInput in)
      Reads a long stored in variable-length format.
      static long readUnsignedLong​(java.nio.ByteBuffer in)  
      static byte sizeUnsignedInt​(int i)  
      static int writeUnsignedInt​(byte[] bytes, int offset, int i)
      Writes an int in a variable-length format.
      static void writeUnsignedInt​(java.io.ObjectOutput out, int i)
      Writes an int in a variable-length format.
      static void writeUnsignedInt​(java.io.OutputStream out, int i)  
      static void writeUnsignedInt​(java.nio.ByteBuffer out, int i)  
      static void writeUnsignedLong​(byte[] bytes, int offset, long i)
      Writes an int in a variable-length format.
      static void writeUnsignedLong​(java.io.ObjectOutput out, long i)
      Writes a long in a variable-length format.
      static void writeUnsignedLong​(java.io.OutputStream out, long i)  
      static void writeUnsignedLong​(java.nio.ByteBuffer out, long i)  
      • Methods inherited from class java.lang.Object

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

      • UnsignedNumeric

        public UnsignedNumeric()
    • Method Detail

      • readUnsignedInt

        public static int readUnsignedInt​(java.io.ObjectInput in)
                                   throws java.io.IOException
        Reads an int stored in variable-length format. Reads between one and five bytes. Smaller values take fewer bytes. Negative numbers are not supported.
        Throws:
        java.io.IOException
      • readUnsignedInt

        public static int readUnsignedInt​(java.io.InputStream in)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • readUnsignedInt

        public static int readUnsignedInt​(java.nio.ByteBuffer in)
      • writeUnsignedInt

        public static void writeUnsignedInt​(java.io.ObjectOutput out,
                                            int i)
                                     throws java.io.IOException
        Writes an int in a variable-length format. Writes between one and five bytes. Smaller values take fewer bytes. Negative numbers are not supported.
        Parameters:
        i - int to write
        Throws:
        java.io.IOException
      • writeUnsignedInt

        public static void writeUnsignedInt​(java.io.OutputStream out,
                                            int i)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • sizeUnsignedInt

        public static byte sizeUnsignedInt​(int i)
      • writeUnsignedInt

        public static void writeUnsignedInt​(java.nio.ByteBuffer out,
                                            int i)
      • readUnsignedLong

        public static long readUnsignedLong​(java.io.ObjectInput in)
                                     throws java.io.IOException
        Reads a long stored in variable-length format. Reads between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.
        Throws:
        java.io.IOException
      • readUnsignedLong

        public static long readUnsignedLong​(java.io.InputStream in)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • readUnsignedLong

        public static long readUnsignedLong​(java.nio.ByteBuffer in)
      • writeUnsignedLong

        public static void writeUnsignedLong​(java.io.ObjectOutput out,
                                             long i)
                                      throws java.io.IOException
        Writes a long in a variable-length format. Writes between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.
        Parameters:
        i - int to write
        Throws:
        java.io.IOException
      • writeUnsignedLong

        public static void writeUnsignedLong​(java.io.OutputStream out,
                                             long i)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • writeUnsignedLong

        public static void writeUnsignedLong​(java.nio.ByteBuffer out,
                                             long i)
      • readUnsignedInt

        public static int readUnsignedInt​(byte[] bytes,
                                          int offset)
        Reads an int stored in variable-length format. Reads between one and five bytes. Smaller values take fewer bytes. Negative numbers are not supported.
      • writeUnsignedInt

        public static int writeUnsignedInt​(byte[] bytes,
                                           int offset,
                                           int i)
        Writes an int in a variable-length format. Writes between one and five bytes. Smaller values take fewer bytes. Negative numbers are not supported.
        Parameters:
        i - int to write
      • readUnsignedLong

        public static long readUnsignedLong​(byte[] bytes,
                                            int offset)
        Reads an int stored in variable-length format. Reads between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.
      • writeUnsignedLong

        public static void writeUnsignedLong​(byte[] bytes,
                                             int offset,
                                             long i)
        Writes an int in a variable-length format. Writes between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.
        Parameters:
        i - int to write