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
The following commit(s) were added to refs/heads/master by this push: new 8593fee0c Javadoc: English, not Latin 8593fee0c is described below commit 8593fee0ced89c4c37ddd60b90356fdac8d3e038 Author: Gary D. Gregory <garydgreg...@gmail.com> AuthorDate: Tue Dec 31 08:49:49 2024 -0500 Javadoc: English, not Latin Use longer lines --- .../compress/archivers/cpio/CpioArchiveEntry.java | 4 +- .../archivers/cpio/CpioArchiveOutputStream.java | 2 +- .../archivers/dump/DumpArchiveSummary.java | 4 +- .../commons/compress/archivers/sevenz/Folder.java | 2 +- .../archivers/tar/TarArchiveOutputStream.java | 2 +- .../archivers/zip/X5455_ExtendedTimestamp.java | 25 +++++------- .../compress/archivers/zip/X7875_NewUnix.java | 7 ++-- .../zip/ZipSplitReadOnlySeekableByteChannel.java | 44 +++++++--------------- .../commons/compress/archivers/zip/ZipUtil.java | 8 ++-- .../commons/compress/harmony/pack200/BandSet.java | 6 +-- .../compress/harmony/pack200/NewAttribute.java | 26 ++++--------- .../harmony/pack200/NewAttributeBands.java | 4 +- .../compress/harmony/pack200/PackingOptions.java | 2 +- .../compress/harmony/unpack200/ClassBands.java | 2 +- .../compress/harmony/unpack200/CpBands.java | 4 +- .../compress/harmony/unpack200/Segment.java | 2 +- .../utils/MultiReadOnlySeekableByteChannel.java | 2 +- 17 files changed, 55 insertions(+), 91 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveEntry.java index a68f405b5..2a1ac1f86 100644 --- a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveEntry.java +++ b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveEntry.java @@ -593,7 +593,7 @@ public class CpioArchiveEntry implements CpioConstants, ArchiveEntry { } /** - * Gets the mode of this entry (e.g. directory, regular file). + * Gets the mode of this entry (for example directory, regular file). * * @return the mode. */ @@ -829,7 +829,7 @@ public class CpioArchiveEntry implements CpioConstants, ArchiveEntry { } /** - * Sets the mode of this entry (e.g. directory, regular file). + * Sets the mode of this entry (for example directory, regular file). * * @param mode The mode to set. */ diff --git a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java index 0bd5b4b06..6287de6e4 100644 --- a/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java +++ b/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java @@ -48,7 +48,7 @@ import org.apache.commons.compress.archivers.zip.ZipEncodingHelper; * String contents = "12345"; * entry.setFileSize(contents.length()); * entry.setMode(CpioConstants.C_ISREG); // regular file - * ... set other attributes, e.g. time, number of links + * ... set other attributes, for example time, number of links * out.putArchiveEntry(entry); * out.write(testContents.getBytes()); * out.close(); diff --git a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveSummary.java b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveSummary.java index fef90ce0e..76966cf50 100644 --- a/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveSummary.java +++ b/src/main/java/org/apache/commons/compress/archivers/dump/DumpArchiveSummary.java @@ -74,7 +74,7 @@ public class DumpArchiveSummary { } /** - * Gets the device name, e.g., /dev/sda3 or /dev/mapper/vg0-home. + * Gets the device name, for example, /dev/sda3 or /dev/mapper/vg0-home. * * @return device name */ @@ -92,7 +92,7 @@ public class DumpArchiveSummary { } /** - * Gets the last mountpoint, e.g., /home. + * Gets the last mountpoint, for example, /home. * * @return last mountpoint */ diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/Folder.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/Folder.java index 99c7e8d11..6e7304728 100644 --- a/src/main/java/org/apache/commons/compress/archivers/sevenz/Folder.java +++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/Folder.java @@ -29,7 +29,7 @@ final class Folder { static final Folder[] EMPTY_FOLDER_ARRAY = {}; - /** List of coders used in this folder, e.g. one for compression, one for encryption. */ + /** List of coders used in this folder, for example one for compression, one for encryption. */ Coder[] coders; /** diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java index 5081f7add..975038a29 100644 --- a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java +++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java @@ -80,7 +80,7 @@ public class TarArchiveOutputStream extends ArchiveOutputStream<TarArchiveEntry> public static final int LONGFILE_POSIX = 3; /** - * Fail if a big number (e.g. size > 8GiB) is required in the archive. + * Fail if a big number (for example size > 8GiB) is required in the archive. */ public static final int BIGNUMBER_ERROR = 0; 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 4af4c1b2d..41b199fd1 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 @@ -41,10 +41,11 @@ import org.apache.commons.io.file.attribute.FileTimes; * <ul> * <li><strong>modifyTime:</strong> most recent time of file/directory modification (or file/dir creation if the entry has not been modified since it was * created).</li> - * <li><strong>accessTime:</strong> most recent time file/directory was opened (e.g., read from disk). Many people disable their operating systems from updating - * this value using the NOATIME mount option to optimize disk behavior, and thus it's not always reliable. In those cases it's always equal to modifyTime.</li> - * <li><strong>*createTime:</strong> modern Linux file systems (e.g., ext2 and newer) do not appear to store a value like this, and so it's usually omitted - * altogether in the ZIP extra field. Perhaps other Unix systems track this.</li> + * <li><strong>accessTime:</strong> most recent time file/directory was opened (for example, read from disk). Many people disable their operating systems from + * updating this value using the NOATIME mount option to optimize disk behavior, and thus it's not always reliable. In those cases it's always equal to + * modifyTime.</li> + * <li><strong>*createTime:</strong> modern Linux file systems (for example, ext2 and newer) do not appear to store a value like this, and so it's usually + * omitted altogether in the ZIP extra field. Perhaps other Unix systems track this.</li> * </ul> * <p> * We're using the field definition given in Info-Zip's source archive: zip-3.0.tar.gz/proginfo/extrafld.txt @@ -74,14 +75,12 @@ import org.apache.commons.io.file.attribute.FileTimes; */ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serializable { private static final long serialVersionUID = 1L; - /** * The header ID for this extra field. * * @since 1.23 */ public static final ZipShort HEADER_ID = new ZipShort(0x5455); - /** * The bit set inside the flags by when the last modification time is present in this extra field. */ @@ -146,13 +145,9 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial // != null and length checks. private boolean bit0_modifyTimePresent; private boolean bit1_accessTimePresent; - private boolean bit2_createTimePresent; - private ZipLong modifyTime; - private ZipLong accessTime; - private ZipLong createTime; /** @@ -170,7 +165,6 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial public boolean equals(final Object o) { if (o instanceof X5455_ExtendedTimestamp) { final X5455_ExtendedTimestamp xf = (X5455_ExtendedTimestamp) o; - // The ZipLong==ZipLong clauses handle the cases where both are null. // and only last 3 bits of flags matter. return (flags & 0x07) == (xf.flags & 0x07) && Objects.equals(modifyTime, xf.modifyTime) && Objects.equals(accessTime, xf.accessTime) @@ -252,8 +246,8 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial * since the underlying data offers only per-second precision. * </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. + * Note: modern Linux file systems (for example, 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. * </p> * * @return create time as java.util.Date or null. @@ -267,8 +261,8 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial * 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> - * 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. + * Note: modern Linux file systems (for example, 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. * </p> * * @return create time (seconds since epoch) or null. @@ -663,5 +657,4 @@ public class X5455_ExtendedTimestamp implements ZipExtraField, Cloneable, Serial } return buf.toString(); } - } diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/X7875_NewUnix.java b/src/main/java/org/apache/commons/compress/archivers/zip/X7875_NewUnix.java index e743fbdd2..deada8565 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/X7875_NewUnix.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/X7875_NewUnix.java @@ -82,7 +82,6 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable { } /* - * * I agonized over my choice of MIN_LENGTH=1. Here's the situation: InfoZip (the tool I am using to test interop) always sets these to length=4. And so * a UID of 0 (typically root) for example is encoded as {4,0,0,0,0} (len=4, 32 bits of zero), when it could just as easily be encoded as {1,0} (len=1, * 8 bits of zero) according to the spec. @@ -93,8 +92,8 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable { * * 2.) Fundamentally, ZIP files are about shrinking things, so let's save a few bytes per entry while we can. * - * 3.) Of all the people creating ZIP files using commons- compress, how many care about Unix UID/GID attributes of the files they store? (e.g., I am - * probably thinking way too hard about this and no one cares!) + * 3.) Of all the people creating ZIP files using commons- compress, how many care about Unix UID/GID attributes of the files they store? (for example, + * I am probably thinking way too hard about this and no one cares!) * * 4.) InfoZip's tool, even though it carefully stores every UID/GID for every file zipped on a Unix machine (by default) currently appears unable to * ever restore UID/GID. unzip -X has no effect on my machine, even when run as root!!!! @@ -197,7 +196,7 @@ public class X7875_NewUnix implements ZipExtraField, Cloneable, Serializable { byte[] gidBytes = gid.toByteArray(); // BigInteger might prepend a leading-zero to force a positive representation - // (e.g., so that the sign-bit is set to zero). We need to remove that + // (for example, so that the sign-bit is set to zero). We need to remove that // before sending the number over the wire. uidBytes = trimLeadingZeroesForceMinLength(uidBytes); final int uidBytesLen = uidBytes != null ? uidBytes.length : 0; diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipSplitReadOnlySeekableByteChannel.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipSplitReadOnlySeekableByteChannel.java index 0a2557af8..dcb4b7152 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipSplitReadOnlySeekableByteChannel.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipSplitReadOnlySeekableByteChannel.java @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - package org.apache.commons.compress.archivers.zip; import java.io.File; @@ -50,7 +49,6 @@ import org.apache.commons.compress.utils.MultiReadOnlySeekableByteChannel; * @since 1.20 */ public class ZipSplitReadOnlySeekableByteChannel extends MultiReadOnlySeekableByteChannel { - private static final class ZipSplitSegmentComparator implements Comparator<Path>, Serializable { private static final long serialVersionUID = 20200123L; @@ -58,18 +56,14 @@ public class ZipSplitReadOnlySeekableByteChannel extends MultiReadOnlySeekableBy public int compare(final Path file1, final Path file2) { final String extension1 = FileNameUtils.getExtension(file1); final String extension2 = FileNameUtils.getExtension(file2); - if (!extension1.startsWith("z")) { return -1; } - if (!extension2.startsWith("z")) { return 1; } - final Integer splitSegmentNumber1 = Integer.parseInt(extension1.substring(1)); final Integer splitSegmentNumber2 = Integer.parseInt(extension2.substring(1)); - return splitSegmentNumber1.compareTo(splitSegmentNumber2); } } @@ -103,18 +97,15 @@ public class ZipSplitReadOnlySeekableByteChannel extends MultiReadOnlySeekableBy if (!extension.equalsIgnoreCase(ArchiveStreamFactory.ZIP)) { throw new IllegalArgumentException("The extension of last ZIP split segment should be .zip"); } - final Path parent = Objects.nonNull(lastSegmentPath.getParent()) ? lastSegmentPath.getParent() : lastSegmentPath.getFileSystem().getPath("."); final String fileBaseName = FileNameUtils.getBaseName(lastSegmentPath); final ArrayList<Path> splitZipSegments; - // ZIP split segments should be like z01,z02....z(n-1) based on the ZIP specification final Pattern pattern = Pattern.compile(Pattern.quote(fileBaseName) + ".[zZ][0-9]+"); try (Stream<Path> walk = Files.walk(parent, 1)) { splitZipSegments = walk.filter(Files::isRegularFile).filter(path -> pattern.matcher(path.getFileName().toString()).matches()) .sorted(new ZipSplitSegmentComparator()).collect(Collectors.toCollection(ArrayList::new)); } - return forPaths(lastSegmentPath, splitZipSegments); } @@ -122,7 +113,7 @@ public class ZipSplitReadOnlySeekableByteChannel extends MultiReadOnlySeekableBy * Concatenates the given files. * * @param files the files to concatenate, note that the LAST FILE of files should be the LAST SEGMENT(.zip) and these files should be added in correct order - * (e.g. .z01, .z02... .z99, .zip) + * (for example .z01, .z02... .z99, .zip) * @return SeekableByteChannel that concatenates all provided files * @throws NullPointerException if files is null * @throws IOException if opening a channel for one of the files fails @@ -133,7 +124,6 @@ public class ZipSplitReadOnlySeekableByteChannel extends MultiReadOnlySeekableBy for (final File f : Objects.requireNonNull(files, "files")) { paths.add(f.toPath()); } - return forPaths(paths.toArray(EMPTY_PATH_ARRAY)); } @@ -141,7 +131,8 @@ public class ZipSplitReadOnlySeekableByteChannel extends MultiReadOnlySeekableBy * Concatenates the given files. * * @param lastSegmentFile the last segment of split ZIP segments, its extension should be .zip - * @param files the files to concatenate except for the last segment, note these files should be added in correct order (e.g. .z01, .z02... .z99) + * @param files the files to concatenate except for the last segment, note these files should be added in correct order (for example .z01, .z02... + * .z99) * @return SeekableByteChannel that concatenates all provided files * @throws IOException if the first channel doesn't seem to hold the beginning of a split archive * @throws NullPointerException if files or lastSegmentFile is null @@ -149,10 +140,8 @@ public class ZipSplitReadOnlySeekableByteChannel extends MultiReadOnlySeekableBy public static SeekableByteChannel forFiles(final File lastSegmentFile, final Iterable<File> files) throws IOException { Objects.requireNonNull(files, "files"); Objects.requireNonNull(lastSegmentFile, "lastSegmentFile"); - final List<Path> filesList = new ArrayList<>(); files.forEach(f -> filesList.add(f.toPath())); - return forPaths(lastSegmentFile.toPath(), filesList); } @@ -160,7 +149,7 @@ public class ZipSplitReadOnlySeekableByteChannel extends MultiReadOnlySeekableBy * Concatenates the given channels. * * @param channels the channels to concatenate, note that the LAST CHANNEL of channels should be the LAST SEGMENT(.zip) and these channels should be added - * in correct order (e.g. .z01, .z02... .z99, .zip) + * in correct order (for example .z01, .z02... .z99, .zip) * @return SeekableByteChannel that concatenates all provided channels * @throws NullPointerException if channels is null * @throws IOException if reading channels fails @@ -176,8 +165,8 @@ public class ZipSplitReadOnlySeekableByteChannel extends MultiReadOnlySeekableBy * Concatenates the given channels. * * @param lastSegmentChannel channel of the last segment of split ZIP segments, its extension should be .zip - * @param channels the channels to concatenate except for the last segment, note these channels should be added in correct order (e.g. .z01, - * .z02... .z99) + * @param channels the channels to concatenate except for the last segment, note these channels should be added in correct order (for example + * .z01, .z02... .z99) * @return SeekableByteChannel that concatenates all provided channels * @throws NullPointerException if lastSegmentChannel or channels is null * @throws IOException if the first channel doesn't seem to hold the beginning of a split archive @@ -186,19 +175,17 @@ public class ZipSplitReadOnlySeekableByteChannel extends MultiReadOnlySeekableBy throws IOException { Objects.requireNonNull(channels, "channels"); Objects.requireNonNull(lastSegmentChannel, "lastSegmentChannel"); - final List<SeekableByteChannel> channelsList = new ArrayList<>(); channels.forEach(channelsList::add); channelsList.add(lastSegmentChannel); - return forOrderedSeekableByteChannels(channelsList.toArray(new SeekableByteChannel[0])); } /** * Concatenates the given file paths. * - * @param paths the file paths to concatenate, note that the LAST FILE of files should be the LAST SEGMENT(.zip) and these files should be added in correct - * order (e.g.: .z01, .z02... .z99, .zip) + * @param paths the file paths to concatenate, note that the LAST FILE of files should be the LAST SEGMENT(.zip) and these files should be added in + * correct order (for example: .z01, .z02... .z99, .zip) * @param openOptions the options to open paths (shared by all paths). * @return SeekableByteChannel that concatenates all provided files * @throws NullPointerException if files is null @@ -221,7 +208,7 @@ public class ZipSplitReadOnlySeekableByteChannel extends MultiReadOnlySeekableBy * Concatenates the given file paths. * * @param paths the file paths to concatenate, note that the LAST FILE of files should be the LAST SEGMENT(.zip) and these files should be added in correct - * order (e.g.: .z01, .z02... .z99, .zip) + * order (for example: .z01, .z02... .z99, .zip) * @return SeekableByteChannel that concatenates all provided files * @throws NullPointerException if files is null * @throws IOException if opening a channel for one of the files fails @@ -236,8 +223,8 @@ public class ZipSplitReadOnlySeekableByteChannel extends MultiReadOnlySeekableBy * Concatenates the given file paths. * * @param lastSegmentPath the last segment path of split ZIP segments, its extension must be .zip - * @param paths the file paths to concatenate except for the last segment, note these files should be added in correct order (e.g.: .z01, .z02... - * .z99) + * @param paths the file paths to concatenate except for the last segment, note these files should be added in correct order (for example: .z01, + * .z02... .z99) * @return SeekableByteChannel that concatenates all provided files * @throws IOException if the first channel doesn't seem to hold the beginning of a split archive * @throws NullPointerException if files or lastSegmentPath is null @@ -246,11 +233,9 @@ public class ZipSplitReadOnlySeekableByteChannel extends MultiReadOnlySeekableBy public static SeekableByteChannel forPaths(final Path lastSegmentPath, final Iterable<Path> paths) throws IOException { Objects.requireNonNull(paths, "paths"); Objects.requireNonNull(lastSegmentPath, "lastSegmentPath"); - final List<Path> filesList = new ArrayList<>(); paths.forEach(filesList::add); filesList.add(lastSegmentPath); - return forPaths(filesList.toArray(EMPTY_PATH_ARRAY)); } @@ -260,8 +245,8 @@ public class ZipSplitReadOnlySeekableByteChannel extends MultiReadOnlySeekableBy * Concatenates the given channels. * * <p> - * The channels should be add in ascending order, e.g. z01, z02, ... z99, ZIP please note that the .zip file is the last segment and should be added as the - * last one in the channels + * The channels should be add in ascending order, for example z01, z02, ... z99, ZIP please note that the .zip file is the last segment and should be added + * as the last one in the channels * </p> * * @param channels the channels to concatenate @@ -270,7 +255,6 @@ public class ZipSplitReadOnlySeekableByteChannel extends MultiReadOnlySeekableBy */ public ZipSplitReadOnlySeekableByteChannel(final List<SeekableByteChannel> channels) throws IOException { super(channels); - // the first split ZIP segment should begin with ZIP split signature assertSplitSignature(channels); } @@ -294,7 +278,6 @@ public class ZipSplitReadOnlySeekableByteChannel extends MultiReadOnlySeekableBy final SeekableByteChannel channel = channels.get(0); // the ZIP split file signature is at the beginning of the first split segment channel.position(0L); - zipSplitSignatureByteBuffer.rewind(); channel.read(zipSplitSignatureByteBuffer); final ZipLong signature = new ZipLong(zipSplitSignatureByteBuffer.array()); @@ -302,7 +285,6 @@ public class ZipSplitReadOnlySeekableByteChannel extends MultiReadOnlySeekableBy channel.position(0L); throw new IOException("The first ZIP split segment does not begin with split ZIP file signature"); } - channel.position(0L); } } diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java index cd98430ed..83a4b25c9 100644 --- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java +++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java @@ -243,8 +243,8 @@ public abstract class ZipUtil { /** * <p> - * Converts a long into a BigInteger. Negative numbers between -1 and -2^31 are treated as unsigned 32 bit (e.g., positive) integers. Negative numbers below - * -2^31 cause an IllegalArgumentException to be thrown. + * Converts a long into a BigInteger. Negative numbers between -1 and -2^31 are treated as unsigned 32 bit (for example, positive) integers. Negative + * numbers below -2^31 cause an IllegalArgumentException to be thrown. * </p> * * @param l long to convert to BigInteger. @@ -304,7 +304,7 @@ public abstract class ZipUtil { } /** - * Converts a signed byte into an unsigned integer representation (e.g., -1 becomes 255). + * Converts a signed byte into an unsigned integer representation (for example, -1 becomes 255). * * @param b byte to convert to int * @return int representation of the provided byte @@ -392,7 +392,7 @@ public abstract class ZipUtil { } /** - * Converts an unsigned integer to a signed byte (e.g., 255 becomes -1). + * Converts an unsigned integer to a signed byte (for example, 255 becomes -1). * * @param i integer to convert to byte * @return byte representation of the provided int diff --git a/src/main/java/org/apache/commons/compress/harmony/pack200/BandSet.java b/src/main/java/org/apache/commons/compress/harmony/pack200/BandSet.java index 1ac544429..b115953eb 100644 --- a/src/main/java/org/apache/commons/compress/harmony/pack200/BandSet.java +++ b/src/main/java/org/apache/commons/compress/harmony/pack200/BandSet.java @@ -57,8 +57,8 @@ public abstract class BandSet { } /** - * BandData represents information about a band, e.g. largest value etc and is used in the heuristics that calculate whether an alternative Codec could make - * the encoded band smaller. + * BandData represents information about a band, for example largest value etc and is used in the heuristics that calculate whether an alternative Codec + * could make the encoded band smaller. */ public class BandData { @@ -714,7 +714,7 @@ public abstract class BandSet { return results.numCodecsTried >= effort * 2; } return results.numCodecsTried >= effort; - // May want to also check how much we've saved if performance needs improving, e.g. saved more than effort*2 % + // May want to also check how much we've saved if performance needs improving, for example saved more than effort*2 % // || (float) results.saved/(float) results.encodedBand.length > (float) effort * 2/100; } diff --git a/src/main/java/org/apache/commons/compress/harmony/pack200/NewAttribute.java b/src/main/java/org/apache/commons/compress/harmony/pack200/NewAttribute.java index 74515a2e2..03af1fea7 100644 --- a/src/main/java/org/apache/commons/compress/harmony/pack200/NewAttribute.java +++ b/src/main/java/org/apache/commons/compress/harmony/pack200/NewAttribute.java @@ -23,17 +23,15 @@ import org.objectweb.asm.ClassReader; import org.objectweb.asm.Label; /** - * NewAttribute extends {@code Attribute} and manages unknown attributes encountered by ASM that have had a layout definition given to pack200 (e.g. via one of - * the -C, -M, -F or -D command line options) + * NewAttribute extends {@code Attribute} and manages unknown attributes encountered by ASM that have had a layout definition given to pack200 (for example via + * one of the -C, -M, -F or -D command line options) */ public class NewAttribute extends Attribute { - /** - * ErrorAttribute extends {@code NewAttribute} and manages attributes encountered by ASM that have had an error action specified to pack200 (e.g. via one of - * the -C, -M, -F or -D command line options such as -Cattribute-name=error) + * ErrorAttribute extends {@code NewAttribute} and manages attributes encountered by ASM that have had an error action specified to pack200 (for example via + * one of the -C, -M, -F or -D command line options such as -Cattribute-name=error) */ public static class ErrorAttribute extends NewAttribute { - public ErrorAttribute(final String type, final int context) { super(type, "", context); } @@ -42,15 +40,13 @@ public class NewAttribute extends Attribute { protected Attribute read(final ClassReader cr, final int off, final int len, final char[] buf, final int codeOff, final Label[] labels) { throw new Error("Attribute " + type + " was found"); } - } /** - * PassAttribute extends {@code NewAttribute} and manages attributes encountered by ASM that have had a pass action specified to pack200 (e.g. via one of - * the -C, -M, -F or -D command line options such as -Cattribute-name=pass) + * PassAttribute extends {@code NewAttribute} and manages attributes encountered by ASM that have had a pass action specified to pack200 (for example via + * one of the -C, -M, -F or -D command line options such as -Cattribute-name=pass) */ public static class PassAttribute extends NewAttribute { - public PassAttribute(final String type, final int context) { super(type, "", context); } @@ -59,15 +55,13 @@ public class NewAttribute extends Attribute { protected Attribute read(final ClassReader cr, final int off, final int len, final char[] buf, final int codeOff, final Label[] labels) { throw new Segment.PassException(); } - } /** - * StripAttribute extends {@code NewAttribute} and manages attributes encountered by ASM that have had a strip action specified to pack200 (e.g. via one of - * the -C, -M, -F or -D command line options such as -Cattribute-name=strip) + * StripAttribute extends {@code NewAttribute} and manages attributes encountered by ASM that have had a strip action specified to pack200 (for example via + * one of the -C, -M, -F or -D command line options such as -Cattribute-name=strip) */ public static class StripAttribute extends NewAttribute { - public StripAttribute(final String type, final int context) { super(type, "", context); } @@ -80,18 +74,14 @@ public class NewAttribute extends Attribute { } private boolean contextClass; - private boolean contextMethod; private boolean contextField; private boolean contextCode; private final String layout; private byte[] contents; private int codeOff; - private Label[] labels; - private ClassReader classReader; - private char[] buf; public NewAttribute(final ClassReader classReader, final String type, final String layout, final byte[] contents, final char[] buf, final int codeOff, diff --git a/src/main/java/org/apache/commons/compress/harmony/pack200/NewAttributeBands.java b/src/main/java/org/apache/commons/compress/harmony/pack200/NewAttributeBands.java index 22bc53c93..736481e1a 100644 --- a/src/main/java/org/apache/commons/compress/harmony/pack200/NewAttributeBands.java +++ b/src/main/java/org/apache/commons/compress/harmony/pack200/NewAttributeBands.java @@ -34,8 +34,8 @@ import org.apache.commons.compress.utils.ParsingUtils; import org.objectweb.asm.Label; /** - * Sets of bands relating to a non-predefined attribute that has had a layout definition given to pack200 (e.g. via one of the -C, -M, -F or -D command line - * options) + * Sets of bands relating to a non-predefined attribute that has had a layout definition given to pack200 (for example via one of the -C, -M, -F or -D command + * line options) */ public class NewAttributeBands extends BandSet { diff --git a/src/main/java/org/apache/commons/compress/harmony/pack200/PackingOptions.java b/src/main/java/org/apache/commons/compress/harmony/pack200/PackingOptions.java index 2d31eff94..627abbda5 100644 --- a/src/main/java/org/apache/commons/compress/harmony/pack200/PackingOptions.java +++ b/src/main/java/org/apache/commons/compress/harmony/pack200/PackingOptions.java @@ -202,7 +202,7 @@ public class PackingOptions { if (!pass.endsWith(".class")) { // a whole directory is // passed if (!pass.endsWith("/")) { - // Make sure we don't get any false positives (e.g. + // Make sure we don't get any false positives (for example // exclude "org/apache/harmony/pack" should not match // files under "org/apache/harmony/pack200/") pass += "/"; diff --git a/src/main/java/org/apache/commons/compress/harmony/unpack200/ClassBands.java b/src/main/java/org/apache/commons/compress/harmony/unpack200/ClassBands.java index 6cbfd41e9..3ac63c131 100644 --- a/src/main/java/org/apache/commons/compress/harmony/unpack200/ClassBands.java +++ b/src/main/java/org/apache/commons/compress/harmony/unpack200/ClassBands.java @@ -1041,7 +1041,7 @@ public class ClassBands extends BandSet { final int colon = desc.indexOf(':'); String type = desc.substring(colon + 1); // TODO Got to get better at this ... in any case, it should - // be e.g. KIB or KIH + // be for example KIB or KIH if (type.equals("B") || type.equals("H")) { type = "I"; } diff --git a/src/main/java/org/apache/commons/compress/harmony/unpack200/CpBands.java b/src/main/java/org/apache/commons/compress/harmony/unpack200/CpBands.java index 7c485db2f..7ce798851 100644 --- a/src/main/java/org/apache/commons/compress/harmony/unpack200/CpBands.java +++ b/src/main/java/org/apache/commons/compress/harmony/unpack200/CpBands.java @@ -312,7 +312,7 @@ public class CpBands extends BandSet { /** * Parses the constant pool descriptor definitions, using {@link #cpDescriptorCount} to populate {@link #cpDescriptor}. For ease of use, the cpDescriptor is - * stored as a string of the form <em>name:type</em>, largely to make it easier for representing field and method descriptors (e.g. + * stored as a string of the form <em>name:type</em>, largely to make it easier for representing field and method descriptors (for example * {@code out:java.lang.PrintStream}) in a way that is compatible with passing String arrays. * * @param in the input stream to read from @@ -422,7 +422,7 @@ public class CpBands extends BandSet { * representation of a class; Z for boolean, I for int, [ for array etc. However, although classes are started with L, the class name does not follow the * form; instead, there is a separate array of classes. So an array corresponding to {@code public static void main(String args[])} has a form of * {@code [L(V)} and a classes array of {@code [java.lang.String]}. The {@link #cpSignature} is a string representation identical to the bytecode equivalent - * {@code [Ljava/lang/String;(V)} TODO Check that the form is as above and update other types e.g. J + * {@code [Ljava/lang/String;(V)} TODO Check that the form is as above and update other types for example J * * @param in the input stream to read from * @throws IOException if a problem occurs during reading from the underlying stream diff --git a/src/main/java/org/apache/commons/compress/harmony/unpack200/Segment.java b/src/main/java/org/apache/commons/compress/harmony/unpack200/Segment.java index 48ed6a43b..3d502d808 100644 --- a/src/main/java/org/apache/commons/compress/harmony/unpack200/Segment.java +++ b/src/main/java/org/apache/commons/compress/harmony/unpack200/Segment.java @@ -513,7 +513,7 @@ public class Segment { /** * Writes the segment to an output stream. The output stream should be pre-buffered for efficiency. Also takes the same input stream for reading, since the * file bits may not be loaded and thus just copied from one stream to another. Doesn't close the output stream when finished, in case there are more - * entries (e.g. further segments) to be written. + * entries (for example further segments) to be written. * * @param out the JarOutputStream to write data to * @throws IOException if an error occurs while reading or writing to the streams diff --git a/src/main/java/org/apache/commons/compress/utils/MultiReadOnlySeekableByteChannel.java b/src/main/java/org/apache/commons/compress/utils/MultiReadOnlySeekableByteChannel.java index 6cc103c9a..82e5e8591 100644 --- a/src/main/java/org/apache/commons/compress/utils/MultiReadOnlySeekableByteChannel.java +++ b/src/main/java/org/apache/commons/compress/utils/MultiReadOnlySeekableByteChannel.java @@ -69,7 +69,7 @@ public class MultiReadOnlySeekableByteChannel implements SeekableByteChannel { * Concatenates the given file paths. * * @param paths the file paths to concatenate, note that the LAST FILE of files should be the LAST SEGMENT(.zip) and these files should be added in correct - * order (e.g.: .z01, .z02... .z99, .zip) + * order (for example: .z01, .z02... .z99, .zip) * @return SeekableByteChannel that concatenates all provided files * @throws NullPointerException if files is null * @throws IOException if opening a channel for one of the files fails