Browse Source

Minor corrections plus added @param and @return where missing

Obtained from: Kevin Jackson


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277123 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 21 years ago
parent
commit
6cb33f75ab
2 changed files with 23 additions and 10 deletions
  1. +13
    -7
      src/main/org/apache/tools/zip/ZipLong.java
  2. +10
    -3
      src/main/org/apache/tools/zip/ZipShort.java

+ 13
- 7
src/main/org/apache/tools/zip/ZipLong.java View File

@@ -29,6 +29,7 @@ public final class ZipLong implements Cloneable {

/**
* Create instance from a number.
* @param value the long to store as a ZipLong
* @since 1.1
*/
public ZipLong(long value) {
@@ -37,6 +38,7 @@ public final class ZipLong implements Cloneable {

/**
* Create instance from bytes.
* @param bytes the bytes to store as a ZipLong
* @since 1.1
*/
public ZipLong (byte[] bytes) {
@@ -45,6 +47,8 @@ public final class ZipLong implements Cloneable {

/**
* Create instance from the four bytes starting at offset.
* @param bytes the bytes to store as a ZipLong
* @param offset the offset to start
* @since 1.1
*/
public ZipLong (byte[] bytes, int offset) {
@@ -54,14 +58,16 @@ public final class ZipLong implements Cloneable {
/**
* Get value as four bytes in big endian byte order.
* @since 1.1
* @return value as four bytes in big endian order
*/
public byte[] getBytes() {
return ZipLong.getBytes(value);
}

/**
* Get value as Java int.
* Get value as Java long.
* @since 1.1
* @return value as a long
*/
public long getValue() {
return value;
@@ -82,10 +88,10 @@ public final class ZipLong implements Cloneable {
}

/**
* Helper method to get the value as a java long from four bytes starting at given array offset
* Helper method to get the value as a Java long from four bytes starting at given array offset
* @param bytes the array of bytes
* @param offset the offset to start
* @return the correspondanding java int value
* @return the correspondanding Java long value
*/
public static long getValue(byte[] bytes, int offset){
long value = (bytes[offset + 3] << 24) & 0xFF000000L;
@@ -96,9 +102,9 @@ public final class ZipLong implements Cloneable {
}

/**
* Helper method to get the value as a java long from a four-byte array
* Helper method to get the value as a Java long from a four-byte array
* @param bytes the array of bytes
* @return the correspondanding java long value
* @return the correspondanding Java long value
*/
public static long getValue(byte[] bytes){
return getValue(bytes, 0);
@@ -106,7 +112,7 @@ public final class ZipLong implements Cloneable {

/**
* Override to make two instances with same value equal.
*
* @param o an object to compare
* @since 1.1
*/
public boolean equals(Object o) {
@@ -118,7 +124,7 @@ public final class ZipLong implements Cloneable {

/**
* Override to make two instances with same value equal.
*
* @return the value stored in the ZipLong
* @since 1.1
*/
public int hashCode() {


+ 10
- 3
src/main/org/apache/tools/zip/ZipShort.java View File

@@ -29,7 +29,7 @@ public final class ZipShort implements Cloneable {

/**
* Create instance from a number.
*
* @param value the int to store as a ZipShort
* @since 1.1
*/
public ZipShort (int value) {
@@ -38,6 +38,7 @@ public final class ZipShort implements Cloneable {

/**
* Create instance from bytes.
* @param bytes the bytes to store as a ZipShort
* @since 1.1
*/
public ZipShort (byte[] bytes) {
@@ -46,6 +47,8 @@ public final class ZipShort implements Cloneable {

/**
* 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) {
@@ -54,6 +57,7 @@ public final class ZipShort implements Cloneable {

/**
* 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() {
@@ -65,6 +69,7 @@ public final class ZipShort implements Cloneable {

/**
* Get value as Java int.
* @return value as a Java int
* @since 1.1
*/
public int getValue() {
@@ -73,6 +78,8 @@ public final class ZipShort implements Cloneable {

/**
* 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];
@@ -104,7 +111,7 @@ public final class ZipShort implements Cloneable {

/**
* Override to make two instances with same value equal.
*
* @param o an object to compare
* @since 1.1
*/
public boolean equals(Object o) {
@@ -116,7 +123,7 @@ public final class ZipShort implements Cloneable {

/**
* Override to make two instances with same value equal.
*
* @return the value stored in the ZipShort
* @since 1.1
*/
public int hashCode() {


Loading…
Cancel
Save