Package 

Class ZipLong

  • All Implemented Interfaces:
    java.io.Serializable , java.lang.Cloneable

    
    public final class ZipLong
     implements Cloneable, Serializable
                        

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

    • Constructor Summary

      Constructors 
      Constructor Description
      ZipLong(Array<byte> bytes) Create instance from bytes.
      ZipLong(Array<byte> bytes, int offset) Create instance from the four bytes starting at offset.
      ZipLong(int value) create instance from a java int.
      ZipLong(long value) Create instance from a number.
    • Method Summary

      Modifier and Type Method Description
      static long getValue(Array<byte> bytes) Helper method to get the value as a Java long from a four-byte array
      static long getValue(Array<byte> bytes) Helper method to get the value as a Java long from a four-byte array
      static Array<byte> getBytes(long value) Get value as four bytes in big endian byte order.
      static void putLong(long value, Array<byte> buf, int offset) put the value as four bytes in big endian byte order.
      Object clone()
      boolean equals(Object o) Override to make two instances with same value equal.
      Array<byte> getBytes() Get value as four bytes in big endian byte order.
      int getIntValue() Get value as a (signed) java int
      int hashCode() Override to make two instances with same value equal.
      void putLong(Array<byte> buf, int offset)
      String toString()
      • Methods inherited from class java.lang.Object

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

      • ZipLong

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

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

        ZipLong(int value)
        create instance from a java int.
        Parameters:
        value - the int to store as a ZipLong
      • ZipLong

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

      • getValue

         static long getValue(Array<byte> bytes)

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

        Parameters:
        bytes - the array of bytes
      • getValue

         static long getValue(Array<byte> bytes)

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

        Parameters:
        bytes - the array of bytes
      • getBytes

         static Array<byte> getBytes(long value)

        Get value as four bytes in big endian byte order.

        Parameters:
        value - the value to convert
      • putLong

         static void putLong(long value, Array<byte> buf, int offset)

        put the value as four bytes in big endian byte order.

        Parameters:
        value - the Java long to convert to bytes
        buf - the output buffer
        offset - The offset within the output buffer of the first byte to be written.
      • 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 four bytes in big endian byte order.

      • getIntValue

         int getIntValue()

        Get value as a (signed) java int

      • hashCode

         int hashCode()

        Override to make two instances with same value equal.