Top Description Fields Constructors Methods
org.apache.tools.zip

public final Class ZipEightByteInteger

extends Object
Class Inheritance
Static Imports
org.apache.tools.zip.ZipConstants.BYTE_MASK

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

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final long
private static final int
private static final int
private static final long
private static final int
private static final int
private static final long
private static final int
private static final int
private static final long
private static final int
private static final int
private static final long
private static final int
private static final byte
private static final int
private final BigInteger
public static final ZipEightByteInteger

Constructor Summary

AccessConstructor and Description
public
ZipEightByteInteger(long
the long to store as a ZipEightByteInteger
value
)

Create instance from a number.

public
ZipEightByteInteger(BigInteger
the BigInteger to store as a ZipEightByteInteger
value
)

Create instance from a number.

public
ZipEightByteInteger(byte[]
the bytes to store as a ZipEightByteInteger
bytes
)

Create instance from bytes.

public
ZipEightByteInteger(byte[]
the bytes to store as a ZipEightByteInteger
bytes
,
int
the offset to start
offset
)

Create instance from the eight bytes starting at offset.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the objects are equal
equals
(Object
an object to compare
o
)

Overrides java.lang.Object.equals.

Override to make two instances with same value equal.
public byte[]

Returns:

value as eight bytes in big endian order
getBytes
()

Get value as eight bytes in big endian byte order.

public static byte[]

Returns:

value as eight bytes in big endian byte order
getBytes
(long
the value to convert
value
)

Get value as eight bytes in big endian byte order.

public static byte[]

Returns:

value as eight bytes in big endian byte order
getBytes
(BigInteger
the value to convert
value
)

Get value as eight bytes in big endian byte order.

public long

Returns:

value as a long
getLongValue
()

Get value as Java long.

public static long

Returns:

the corresponding Java long value
getLongValue
(byte[]
the array of bytes
bytes
,
int
the offset to start
offset
)

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

public static long

Returns:

the corresponding Java long value
getLongValue
(byte[]
the array of bytes
bytes
)

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

public BigInteger

Returns:

value as a long
getValue
()

Get value as Java long.

public static BigInteger

Returns:

the corresponding Java BigInteger value
getValue
(byte[]
the array of bytes
bytes
,
int
the offset to start
offset
)

Helper method to get the value as a Java BigInteger from eight bytes starting at given array offset

public static BigInteger

Returns:

the corresponding Java BigInteger value
getValue
(byte[]
the array of bytes
bytes
)

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

public int

Returns:

the hashCode of the value stored in the ZipEightByteInteger
hashCode
()

Overrides java.lang.Object.hashCode.

Override to make two instances with same value equal.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

BYTE_1back to summary
private static final int BYTE_1
BYTE_1_MASKback to summary
private static final int BYTE_1_MASK
BYTE_1_SHIFTback to summary
private static final int BYTE_1_SHIFT
BYTE_2back to summary
private static final int BYTE_2
BYTE_2_MASKback to summary
private static final int BYTE_2_MASK
BYTE_2_SHIFTback to summary
private static final int BYTE_2_SHIFT
BYTE_3back to summary
private static final int BYTE_3
BYTE_3_MASKback to summary
private static final long BYTE_3_MASK
BYTE_3_SHIFTback to summary
private static final int BYTE_3_SHIFT
BYTE_4back to summary
private static final int BYTE_4
BYTE_4_MASKback to summary
private static final long BYTE_4_MASK
BYTE_4_SHIFTback to summary
private static final int BYTE_4_SHIFT
BYTE_5back to summary
private static final int BYTE_5
BYTE_5_MASKback to summary
private static final long BYTE_5_MASK
BYTE_5_SHIFTback to summary
private static final int BYTE_5_SHIFT
BYTE_6back to summary
private static final int BYTE_6
BYTE_6_MASKback to summary
private static final long BYTE_6_MASK
BYTE_6_SHIFTback to summary
private static final int BYTE_6_SHIFT
BYTE_7back to summary
private static final int BYTE_7
BYTE_7_MASKback to summary
private static final long BYTE_7_MASK
BYTE_7_SHIFTback to summary
private static final int BYTE_7_SHIFT
LEFTMOST_BITback to summary
private static final byte LEFTMOST_BIT
LEFTMOST_BIT_SHIFTback to summary
private static final int LEFTMOST_BIT_SHIFT
valueback to summary
private final BigInteger value
ZEROback to summary
public static final ZipEightByteInteger ZERO

Constructor Detail

ZipEightByteIntegerback to summary
public ZipEightByteInteger(long value)

Create instance from a number.

Parameters
value:long

the long to store as a ZipEightByteInteger

ZipEightByteIntegerback to summary
public ZipEightByteInteger(BigInteger value)

Create instance from a number.

Parameters
value:BigInteger

the BigInteger to store as a ZipEightByteInteger

ZipEightByteIntegerback to summary
public ZipEightByteInteger(byte[] bytes)

Create instance from bytes.

Parameters
bytes:byte[]

the bytes to store as a ZipEightByteInteger

ZipEightByteIntegerback to summary
public ZipEightByteInteger(byte[] bytes, int offset)

Create instance from the eight bytes starting at offset.

Parameters
bytes:byte[]

the bytes to store as a ZipEightByteInteger

offset:int

the offset to start

Method Detail

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Override to make two instances with same value equal.

Parameters
o:Object

an object to compare

Returns:boolean

true if the objects are equal

Annotations
@Override
getBytesback to summary
public byte[] getBytes()

Get value as eight bytes in big endian byte order.

Returns:byte[]

value as eight bytes in big endian order

getBytesback to summary
public static byte[] getBytes(long value)

Get value as eight bytes in big endian byte order.

Parameters
value:long

the value to convert

Returns:byte[]

value as eight bytes in big endian byte order

getBytesback to summary
public static byte[] getBytes(BigInteger value)

Get value as eight bytes in big endian byte order.

Parameters
value:BigInteger

the value to convert

Returns:byte[]

value as eight bytes in big endian byte order

getLongValueback to summary
public long getLongValue()

Get value as Java long.

Returns:long

value as a long

getLongValueback to summary
public 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:byte[]

the array of bytes

offset:int

the offset to start

Returns:long

the corresponding Java long value

getLongValueback to summary
public static long getLongValue(byte[] bytes)

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

Parameters
bytes:byte[]

the array of bytes

Returns:long

the corresponding Java long value

getValueback to summary
public BigInteger getValue()

Get value as Java long.

Returns:BigInteger

value as a long

getValueback to summary
public static 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:byte[]

the array of bytes

offset:int

the offset to start

Returns:BigInteger

the corresponding Java BigInteger value

getValueback to summary
public static BigInteger getValue(byte[] bytes)

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

Parameters
bytes:byte[]

the array of bytes

Returns:BigInteger

the corresponding Java BigInteger value

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Override to make two instances with same value equal.

Returns:int

the hashCode of the value stored in the ZipEightByteInteger

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override