-
- All Implemented Interfaces:
-
java.io.Serializable,java.lang.Cloneable
public final class ZipShort implements Cloneable, Serializable
Utility class that represents a two byte integer with conversion rules for the little endian byte order of ZIP files.
-
-
Method Summary
Modifier and Type Method Description static intgetValue(Array<byte> bytes)Helper method to get the value as a java int from a two-byte array static intgetValue(Array<byte> bytes)Helper method to get the value as a java int from a two-byte array static Array<byte>getBytes(int value)Get value as two bytes in big endian byte order. static voidputShort(int value, Array<byte> buf, int offset)put the value as two bytes in big endian byte order. Objectclone()booleanequals(Object o)Override to make two instances with same value equal. Array<byte>getBytes()Get value as two bytes in big endian byte order. inthashCode()Override to make two instances with same value equal. StringtoString()-
-
Constructor Detail
-
ZipShort
ZipShort(Array<byte> bytes)
Create instance from bytes.- Parameters:
bytes- the bytes to store as a ZipShort
-
ZipShort
ZipShort(Array<byte> bytes, int offset)
Create instance from the two bytes starting at offset.- Parameters:
bytes- the bytes to store as a ZipShortoffset- the offset to start
-
ZipShort
ZipShort(int value)
Create instance from a number.- Parameters:
value- the int to store as a ZipShort
-
-
Method Detail
-
getValue
static int getValue(Array<byte> bytes)
Helper method to get the value as a java int from a two-byte array
- Parameters:
bytes- the array of bytes
-
getValue
static int getValue(Array<byte> bytes)
Helper method to get the value as a java int from a two-byte array
- Parameters:
bytes- the array of bytes
-
getBytes
static Array<byte> getBytes(int value)
Get value as two bytes in big endian byte order.
- Parameters:
value- the Java int to convert to bytes
-
putShort
static void putShort(int value, Array<byte> buf, int offset)
put the value as two bytes in big endian byte order.
- Parameters:
value- the Java int to convert to bytesbuf- the output bufferoffset- 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
-
hashCode
int hashCode()
Override to make two instances with same value equal.
-
-
-
-