You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/01/01 13:28:31 UTC
[commons-compress] 03/04: Javadoc
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git
commit a789768e54aef4eb2db04c3ab57ed57332b9b68e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jan 1 08:27:06 2023 -0500
Javadoc
- Better parameter name
- Use ternary expression
---
.../archivers/zip/X5455_ExtendedTimestamp.java | 59 +++++++++++-----------
1 file changed, 30 insertions(+), 29 deletions(-)
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java b/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
index 2869cfc3..1e030268 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.java
@@ -138,17 +138,14 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
* @return ZipLong
*/
private static ZipLong fileTimeToZipLong(final FileTime time) {
- if (time == null) {
- return null;
- }
- return unixTimeToZipLong(TimeUtils.toUnixTime(time));
+ return time == null ? null : unixTimeToZipLong(TimeUtils.toUnixTime(time));
}
- private static ZipLong unixTimeToZipLong(final long l) {
- if (!TimeUtils.isUnixTime(l)) {
- throw new IllegalArgumentException("X5455 timestamps must fit in a signed 32 bit integer: " + l);
+ private static ZipLong unixTimeToZipLong(final long unixTime) {
+ if (!TimeUtils.isUnixTime(unixTime)) {
+ throw new IllegalArgumentException("X5455 timestamps must fit in a signed 32 bit integer: " + unixTime);
}
- return new ZipLong(l);
+ return new ZipLong(unixTime);
}
private static Date zipLongToDate(final ZipLong unixTime) {
@@ -203,7 +200,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
}
/**
- * Returns the access time as a java.util.Date
+ * Gets the access time as a java.util.Date
* of this zip entry, or null if no such timestamp exists in the zip entry.
* The milliseconds are always zeroed out, since the underlying data
* offers only per-second precision.
@@ -215,7 +212,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
}
/**
- * Returns the access time as a {@link FileTime}
+ * Gets the access time as a {@link FileTime}
* of this zip entry, or null if no such timestamp exists in the zip entry.
* The milliseconds are always zeroed out, since the underlying data
* offers only per-second precision.
@@ -228,7 +225,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
}
/**
- * Returns the access time (seconds since epoch) of this zip entry
+ * Gets the access time (seconds since epoch) of this zip entry
* as a ZipLong object, or null if no such timestamp exists in the
* zip entry.
*
@@ -239,7 +236,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
}
/**
- * The actual data to put into central directory data - without Header-ID
+ * Gets the actual data to put into central directory data - without Header-ID
* or length specifier.
*
* @return the central directory data
@@ -252,7 +249,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
}
/**
- * Length of the extra field in the local file data - without
+ * Gets the length of the extra field in the local file data - without
* Header-ID or length specifier.
*
* <p>For X5455 the central length is often smaller than the
@@ -268,15 +265,17 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
/**
* <p>
- * Returns the create time as a a java.util.Date
+ * Gets the create time as a a java.util.Date
* of this zip entry, or null if no such timestamp exists in the zip entry.
* The milliseconds are always zeroed out, since the underlying data
* offers only per-second precision.
- * </p><p>
+ * </p>
+ * <p>
* Note: modern linux file systems (e.g., ext2)
* do not appear to store a "create time" value, and so
* it's usually omitted altogether in the zip extra
- * field. Perhaps other unix systems track this.
+ * field. Perhaps other unix systems track this.
+ * </p>
*
* @return create time as java.util.Date or null.
*/
@@ -285,7 +284,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
}
/**
- * Returns the create time as a {@link FileTime}
+ * Gets the create time as a {@link FileTime}
* of this zip entry, or null if no such timestamp exists in the zip entry.
* The milliseconds are always zeroed out, since the underlying data
* offers only per-second precision.
@@ -299,14 +298,16 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
/**
* <p>
- * Returns the create time (seconds since epoch) of this zip entry
+ * Gets the create time (seconds since epoch) of this zip entry
* as a ZipLong object, or null if no such timestamp exists in the
* zip entry.
- * </p><p>
+ * </p>
+ * <p>
* Note: modern linux file systems (e.g., ext2)
* do not appear to store a "create time" value, and so
* it's usually omitted altogether in the zip extra
- * field. Perhaps other unix systems track this.
+ * field. Perhaps other unix systems track this.
+ * </p>
*
* @return create time (seconds since epoch) or null.
*/
@@ -331,7 +332,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
public byte getFlags() { return flags; }
/**
- * The Header-ID.
+ * Gets the Header-ID.
*
* @return the value for the header id for this extrafield
*/
@@ -341,7 +342,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
}
/**
- * The actual data to put into local file data - without Header-ID
+ * Gets the actual data to put into local file data - without Header-ID
* or length specifier.
*
* @return get the data
@@ -370,7 +371,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
}
/**
- * Length of the extra field in the local file data - without
+ * Gets the length of the extra field in the local file data - without
* Header-ID or length specifier.
*
* @return a {@code ZipShort} for the length of the data of this extra field
@@ -385,7 +386,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
}
/**
- * Returns the modify time as a java.util.Date
+ * Gets the modify time as a java.util.Date
* of this zip entry, or null if no such timestamp exists in the zip entry.
* The milliseconds are always zeroed out, since the underlying data
* offers only per-second precision.
@@ -397,7 +398,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
}
/**
- * Returns the modify time as a {@link FileTime}
+ * Gets the modify time as a {@link FileTime}
* of this zip entry, or null if no such timestamp exists in the zip entry.
* The milliseconds are always zeroed out, since the underlying data
* offers only per-second precision.
@@ -410,7 +411,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
}
/**
- * Returns the modify time (seconds since epoch) of this zip entry
+ * Gets the modify time (seconds since epoch) of this zip entry
* as a ZipLong object, or null if no such timestamp exists in the
* zip entry.
*
@@ -436,7 +437,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
}
/**
- * Returns whether bit0 of the flags byte is set or not,
+ * Tests whether bit0 of the flags byte is set or not,
* which should correspond to the presence or absence of
* a modify timestamp in this particular zip entry.
*
@@ -447,7 +448,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
}
/**
- * Returns whether bit1 of the flags byte is set or not,
+ * Tests whether bit1 of the flags byte is set or not,
* which should correspond to the presence or absence of
* a "last access" timestamp in this particular zip entry.
*
@@ -458,7 +459,7 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial
}
/**
- * Returns whether bit2 of the flags byte is set or not,
+ * Tests whether bit2 of the flags byte is set or not,
* which should correspond to the presence or absence of
* a create timestamp in this particular zip entry.
*