X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Forg%2Fapache%2Ftools%2Fzip%2FZipShort.java;fp=src%2Forg%2Fapache%2Ftools%2Fzip%2FZipShort.java;h=6f4ba388635ff278a82084adb6aafcf809411dd6;hb=844ccad5a3fcbedec17b2af66d460f31abc7cff1;hp=97bb03fd7183c54ea1a61ef87de45250cf9d4f79;hpb=6f33f705957d674dc2ab6c994a6ea87f7a91f40f;p=vamsas.git diff --git a/src/org/apache/tools/zip/ZipShort.java b/src/org/apache/tools/zip/ZipShort.java index 97bb03f..6f4ba38 100644 --- a/src/org/apache/tools/zip/ZipShort.java +++ b/src/org/apache/tools/zip/ZipShort.java @@ -19,115 +19,135 @@ package org.apache.tools.zip; /** - * Utility class that represents a two byte integer with conversion - * rules for the big endian byte order of ZIP files. - * + * Utility class that represents a two byte integer with conversion rules for + * the big endian byte order of ZIP files. + * */ public final class ZipShort implements Cloneable { - private int value; + private int value; - /** - * Create instance from a number. - * @param value the int to store as a ZipShort - * @since 1.1 - */ - public ZipShort (int value) { - this.value = value; - } + /** + * Create instance from a number. + * + * @param value + * the int to store as a ZipShort + * @since 1.1 + */ + public ZipShort(int value) { + this.value = value; + } - /** - * Create instance from bytes. - * @param bytes the bytes to store as a ZipShort - * @since 1.1 - */ - public ZipShort (byte[] bytes) { - this(bytes, 0); - } + /** + * Create instance from bytes. + * + * @param bytes + * the bytes to store as a ZipShort + * @since 1.1 + */ + public ZipShort(byte[] bytes) { + this(bytes, 0); + } - /** - * Create instance from the two bytes starting at offset. - * @param bytes the bytes to store as a ZipShort - * @param offset the offset to start - * @since 1.1 - */ - public ZipShort (byte[] bytes, int offset) { - value = ZipShort.getValue(bytes, offset); - } + /** + * Create instance from the two bytes starting at offset. + * + * @param bytes + * the bytes to store as a ZipShort + * @param offset + * the offset to start + * @since 1.1 + */ + public ZipShort(byte[] bytes, int offset) { + value = ZipShort.getValue(bytes, offset); + } - /** - * Get value as two bytes in big endian byte order. - * @return the value as a a two byte array in big endian byte order - * @since 1.1 - */ - public byte[] getBytes() { - byte[] result = new byte[2]; - result[0] = (byte) (value & 0xFF); - result[1] = (byte) ((value & 0xFF00) >> 8); - return result; - } + /** + * Get value as two bytes in big endian byte order. + * + * @return the value as a a two byte array in big endian byte order + * @since 1.1 + */ + public byte[] getBytes() { + byte[] result = new byte[2]; + result[0] = (byte) (value & 0xFF); + result[1] = (byte) ((value & 0xFF00) >> 8); + return result; + } - /** - * Get value as Java int. - * @return value as a Java int - * @since 1.1 - */ - public int getValue() { - return value; - } + /** + * Get value as Java int. + * + * @return value as a Java int + * @since 1.1 + */ + public int getValue() { + return value; + } - /** - * Get value as two bytes in big endian byte order. - * @param value the Java int to convert to bytes - * @return the converted int as a byte array in big endian byte order - */ - public static byte[] getBytes(int value) { - byte[] result = new byte[2]; - result[0] = (byte) (value & 0xFF); - result[1] = (byte) ((value & 0xFF00) >> 8); - return result; - } + /** + * Get value as two bytes in big endian byte order. + * + * @param value + * the Java int to convert to bytes + * @return the converted int as a byte array in big endian byte order + */ + public static byte[] getBytes(int value) { + byte[] result = new byte[2]; + result[0] = (byte) (value & 0xFF); + result[1] = (byte) ((value & 0xFF00) >> 8); + return result; + } - /** - * Helper method to get the value as a java int from two bytes starting at given array offset - * @param bytes the array of bytes - * @param offset the offset to start - * @return the correspondanding java int value - */ - public static int getValue(byte[] bytes, int offset) { - int value = (bytes[offset + 1] << 8) & 0xFF00; - value += (bytes[offset] & 0xFF); - return value; - } + /** + * Helper method to get the value as a java int from two bytes starting at + * given array offset + * + * @param bytes + * the array of bytes + * @param offset + * the offset to start + * @return the correspondanding java int value + */ + public static int getValue(byte[] bytes, int offset) { + int value = (bytes[offset + 1] << 8) & 0xFF00; + value += (bytes[offset] & 0xFF); + return value; + } - /** - * Helper method to get the value as a java int from a two-byte array - * @param bytes the array of bytes - * @return the correspondanding java int value - */ - public static int getValue(byte[] bytes) { - return getValue(bytes, 0); - } + /** + * Helper method to get the value as a java int from a two-byte array + * + * @param bytes + * the array of bytes + * @return the correspondanding java int value + */ + public static int getValue(byte[] bytes) { + return getValue(bytes, 0); + } - /** - * Override to make two instances with same value equal. - * @param o an object to compare - * @return true if the objects are equal - * @since 1.1 - */ - public boolean equals(Object o) { - if (o == null || !(o instanceof ZipShort)) { - return false; - } - return value == ((ZipShort) o).getValue(); + /** + * Override to make two instances with same value equal. + * + * @param o + * an object to compare + * @return true if the objects are equal + * @since 1.1 + */ + public boolean equals(Object o) { + if (o == null || !(o instanceof ZipShort)) { + return false; } + return value == ((ZipShort) o).getValue(); + } - /** - * Override to make two instances with same value equal. - * @return the value stored in the ZipShort - * @since 1.1 - */ - public int hashCode() { - return value; - } + /** + * Override to make two instances with same value equal. + * + * @return the value stored in the ZipShort + * @since 1.1 + */ + public int hashCode() { + return value; + } }