Package org.apache.tools.zip
Class ZipEightByteInteger
- java.lang.Object
- 
- org.apache.tools.zip.ZipEightByteInteger
 
- 
 public final class ZipEightByteInteger extends java.lang.ObjectUtility class that represents an eight byte integer with conversion rules for the big endian byte order of ZIP files.
- 
- 
Field SummaryFields Modifier and Type Field Description static ZipEightByteIntegerZERO
 - 
Constructor SummaryConstructors Constructor Description ZipEightByteInteger(byte[] bytes)Create instance from bytes.ZipEightByteInteger(byte[] bytes, int offset)Create instance from the eight bytes starting at offset.ZipEightByteInteger(long value)Create instance from a number.ZipEightByteInteger(java.math.BigInteger value)Create instance from a number.
 - 
Method SummaryModifier and Type Method Description booleanequals(java.lang.Object o)Override to make two instances with same value equal.byte[]getBytes()Get value as eight bytes in big endian byte order.static byte[]getBytes(long value)Get value as eight bytes in big endian byte order.static byte[]getBytes(java.math.BigInteger value)Get value as eight bytes in big endian byte order.longgetLongValue()Get value as Java long.static longgetLongValue(byte[] bytes)Helper method to get the value as a Java long from an eight-byte arraystatic longgetLongValue(byte[] bytes, int offset)Helper method to get the value as a Java long from eight bytes starting at given array offsetjava.math.BigIntegergetValue()Get value as Java long.static java.math.BigIntegergetValue(byte[] bytes)Helper method to get the value as a Java long from an eight-byte arraystatic java.math.BigIntegergetValue(byte[] bytes, int offset)Helper method to get the value as a Java BigInteger from eight bytes starting at given array offsetinthashCode()Override to make two instances with same value equal.java.lang.StringtoString()
 
- 
- 
- 
Field Detail- 
ZEROpublic static final ZipEightByteInteger ZERO 
 
- 
 - 
Constructor Detail- 
ZipEightByteIntegerpublic ZipEightByteInteger(long value) Create instance from a number.- Parameters:
- value- the long to store as a ZipEightByteInteger
 
 - 
ZipEightByteIntegerpublic ZipEightByteInteger(java.math.BigInteger value) Create instance from a number.- Parameters:
- value- the BigInteger to store as a ZipEightByteInteger
 
 - 
ZipEightByteIntegerpublic ZipEightByteInteger(byte[] bytes) Create instance from bytes.- Parameters:
- bytes- the bytes to store as a ZipEightByteInteger
 
 - 
ZipEightByteIntegerpublic ZipEightByteInteger(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
 
 
- 
 - 
Method Detail- 
getBytespublic byte[] getBytes() Get value as eight bytes in big endian byte order.- Returns:
- value as eight bytes in big endian order
 
 - 
getLongValuepublic long getLongValue() Get value as Java long.- Returns:
- value as a long
 
 - 
getValuepublic java.math.BigInteger getValue() Get value as Java long.- Returns:
- value as a long
 
 - 
getBytespublic static byte[] getBytes(long value) Get value as eight bytes in big endian byte order.- Parameters:
- value- the value to convert
- Returns:
- value as eight bytes in big endian byte order
 
 - 
getBytespublic static byte[] getBytes(java.math.BigInteger value) Get value as eight bytes in big endian byte order.- Parameters:
- value- the value to convert
- Returns:
- value as eight bytes in big endian byte order
 
 - 
getLongValuepublic static long getLongValue(byte[] bytes, int offset)Helper method to get the value as a Java long from eight bytes starting at given array offset- Parameters:
- bytes- the array of bytes
- offset- the offset to start
- Returns:
- the corresponding Java long value
 
 - 
getValuepublic static java.math.BigInteger getValue(byte[] bytes, int offset)Helper method to get the value as a Java BigInteger from eight bytes starting at given array offset- Parameters:
- bytes- the array of bytes
- offset- the offset to start
- Returns:
- the corresponding Java BigInteger value
 
 - 
getLongValuepublic static long getLongValue(byte[] bytes) Helper method to get the value as a Java long from an eight-byte array- Parameters:
- bytes- the array of bytes
- Returns:
- the corresponding Java long value
 
 - 
getValuepublic static java.math.BigInteger getValue(byte[] bytes) Helper method to get the value as a Java long from an eight-byte array- Parameters:
- bytes- the array of bytes
- Returns:
- the corresponding Java BigInteger value
 
 - 
equalspublic boolean equals(java.lang.Object o) Override to make two instances with same value equal.- Overrides:
- equalsin class- java.lang.Object
- Parameters:
- o- an object to compare
- Returns:
- true if the objects are equal
 
 - 
hashCodepublic int hashCode() Override to make two instances with same value equal.- Overrides:
- hashCodein class- java.lang.Object
- Returns:
- the hashCode of the value stored in the ZipEightByteInteger
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-