Package 

Class ZipEightByteInteger

  • All Implemented Interfaces:
    java.io.Serializable

    
    public final class ZipEightByteInteger
     implements Serializable
                        

    Utility class that represents an eight byte integer with conversion rules for the little endian byte order of ZIP files.

    • Method Summary

      Modifier and Type Method Description
      static BigInteger getValue(Array<byte> bytes) Helper method to get the value as a Java long from an eight-byte array
      static BigInteger getValue(Array<byte> bytes) Helper method to get the value as a Java long from an eight-byte array
      static Array<byte> getBytes(BigInteger value) Get value as eight bytes in big endian byte order.
      static Array<byte> getBytes(long value) Get value as eight bytes in big endian byte order.
      static long getLongValue(Array<byte> bytes) Helper method to get the value as a Java long from an eight-byte array
      static long getLongValue(Array<byte> bytes, int offset) Helper method to get the value as a Java long from eight bytesstarting at given array offset
      boolean equals(Object o) Override to make two instances with same value equal.
      Array<byte> getBytes() Get value as eight bytes in big endian byte order.
      long getLongValue() Get value as Java long.
      int hashCode() Override to make two instances with same value equal.
      String toString()
      • Methods inherited from class java.lang.Object

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

      • ZipEightByteInteger

        ZipEightByteInteger(BigInteger value)
        Create instance from a number.
        Parameters:
        value - the BigInteger to store as a ZipEightByteInteger
      • ZipEightByteInteger

        ZipEightByteInteger(Array<byte> bytes)
        Create instance from bytes.
        Parameters:
        bytes - the bytes to store as a ZipEightByteInteger
      • ZipEightByteInteger

        ZipEightByteInteger(Array<byte> bytes, int offset)
        Create instance from the eight bytes starting at offset.
        Parameters:
        bytes - the bytes to store as a ZipEightByteInteger
        offset - the offset to start
      • ZipEightByteInteger

        ZipEightByteInteger(long value)
        Create instance from a number.
        Parameters:
        value - the long to store as a ZipEightByteInteger
    • Method Detail

      • getValue

         static BigInteger getValue(Array<byte> bytes)

        Helper method to get the value as a Java long from an eight-byte array

        Parameters:
        bytes - the array of bytes
      • getValue

         static BigInteger getValue(Array<byte> bytes)

        Helper method to get the value as a Java long from an eight-byte array

        Parameters:
        bytes - the array of bytes
      • getBytes

         static Array<byte> getBytes(BigInteger value)

        Get value as eight bytes in big endian byte order.

        Parameters:
        value - the value to convert
      • getBytes

         static Array<byte> getBytes(long value)

        Get value as eight bytes in big endian byte order.

        Parameters:
        value - the value to convert
      • getLongValue

         static long getLongValue(Array<byte> bytes)

        Helper method to get the value as a Java long from an eight-byte array

        Parameters:
        bytes - the array of bytes
      • getLongValue

         static long getLongValue(Array<byte> bytes, int offset)

        Helper method to get the value as a Java long from eight bytesstarting at given array offset

        Parameters:
        bytes - the array of bytes
        offset - the offset to start
      • equals

         boolean equals(Object o)

        Override to make two instances with same value equal.

        Parameters:
        o - an object to compare
      • getBytes

         Array<byte> getBytes()

        Get value as eight bytes in big endian byte order.

      • hashCode

         int hashCode()

        Override to make two instances with same value equal.