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 2016/04/09 19:08:23 UTC
[3/7] commons-compress git commit: Add final modifier to method
parameters.
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
index 65d6bad..873de5c 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
@@ -266,7 +266,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* Creates a new ZIP OutputStream filtering the underlying stream.
* @param out the outputstream to zip
*/
- public ZipArchiveOutputStream(OutputStream out) {
+ public ZipArchiveOutputStream(final OutputStream out) {
this.out = out;
this.raf = null;
def = new Deflater(level, true);
@@ -279,7 +279,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param file the file to zip to
* @throws IOException on error
*/
- public ZipArchiveOutputStream(File file) throws IOException {
+ public ZipArchiveOutputStream(final File file) throws IOException {
OutputStream o = null;
RandomAccessFile _raf = null;
try {
@@ -344,7 +344,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param b whether to set the language encoding flag if the file
* name encoding is UTF-8
*/
- public void setUseLanguageEncodingFlag(boolean b) {
+ public void setUseLanguageEncodingFlag(final boolean b) {
useUTF8Flag = b && ZipEncodingHelper.isUTF8(encoding);
}
@@ -355,7 +355,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
*
* @param b whether to create Unicode Extra Fields.
*/
- public void setCreateUnicodeExtraFields(UnicodeExtraFieldPolicy b) {
+ public void setCreateUnicodeExtraFields(final UnicodeExtraFieldPolicy b) {
createUnicodeExtraFields = b;
}
@@ -369,7 +369,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* flag if the file name cannot be encoded using the specified
* encoding.
*/
- public void setFallbackToUTF8(boolean b) {
+ public void setFallbackToUTF8(final boolean b) {
fallbackToUTF8 = b;
}
@@ -418,7 +418,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @since 1.3
* @param mode Whether Zip64 extensions will be used.
*/
- public void setUseZip64(Zip64Mode mode) {
+ public void setUseZip64(final Zip64Mode mode) {
zip64Mode = mode;
}
@@ -497,7 +497,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param phased This entry is second phase of a 2-phase zip creation, size, compressed size and crc
* are known in ZipArchiveEntry
*/
- private void closeCopiedEntry(boolean phased) throws IOException {
+ private void closeCopiedEntry(final boolean phased) throws IOException {
preClose();
entry.bytesRead = entry.entry.getSize();
Zip64Mode effectiveMode = getEffectiveZip64Mode(entry.entry);
@@ -505,7 +505,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
closeEntry(actuallyNeedsZip64, phased);
}
- private void closeEntry(boolean actuallyNeedsZip64, boolean phased) throws IOException {
+ private void closeEntry(final boolean actuallyNeedsZip64, final boolean phased) throws IOException {
if (!phased && raf != null) {
rewriteSizesAndCrc(actuallyNeedsZip64);
}
@@ -541,7 +541,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param rawStream The raw input stream of a different entry. May be compressed/encrypted.
* @throws IOException If copying fails
*/
- public void addRawArchiveEntry(ZipArchiveEntry entry, InputStream rawStream)
+ public void addRawArchiveEntry(final ZipArchiveEntry entry, final InputStream rawStream)
throws IOException {
ZipArchiveEntry ae = new ZipArchiveEntry(entry);
if (hasZip64Extra(ae)) {
@@ -573,8 +573,8 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* Zip64Mode.Never case and returns whether the entry would
* require a Zip64 extra field.
*/
- private boolean handleSizesAndCrc(long bytesWritten, long crc,
- Zip64Mode effectiveMode)
+ private boolean handleSizesAndCrc(final long bytesWritten, final long crc,
+ final Zip64Mode effectiveMode)
throws ZipException {
if (entry.entry.getMethod() == DEFLATED) {
/* It turns out def.getBytesRead() returns wrong values if
@@ -616,7 +616,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* Zip64Mode.Never case and returns whether the entry would
* require a Zip64 extra field.
*/
- private boolean checkIfNeedsZip64(Zip64Mode effectiveMode)
+ private boolean checkIfNeedsZip64(final Zip64Mode effectiveMode)
throws ZipException {
final boolean actuallyNeedsZip64 = isZip64Required(entry.entry, effectiveMode);
if (actuallyNeedsZip64 && effectiveMode == Zip64Mode.Never) {
@@ -625,11 +625,11 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
return actuallyNeedsZip64;
}
- private boolean isZip64Required(ZipArchiveEntry entry1, Zip64Mode requestedMode) {
+ private boolean isZip64Required(final ZipArchiveEntry entry1, final Zip64Mode requestedMode) {
return requestedMode == Zip64Mode.Always || isTooLageForZip32(entry1);
}
- private boolean isTooLageForZip32(ZipArchiveEntry zipArchiveEntry){
+ private boolean isTooLageForZip32(final ZipArchiveEntry zipArchiveEntry){
return zipArchiveEntry.getSize() >= ZIP64_MAGIC || zipArchiveEntry.getCompressedSize() >= ZIP64_MAGIC;
}
@@ -638,7 +638,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* and potentiall the ZIP64 extra containing the correct CRC and
* compressed/uncompressed sizes.
*/
- private void rewriteSizesAndCrc(boolean actuallyNeedsZip64)
+ private void rewriteSizesAndCrc(final boolean actuallyNeedsZip64)
throws IOException {
long save = raf.getFilePointer();
@@ -693,7 +693,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* is {@link Zip64Mode#Never}.
*/
@Override
- public void putArchiveEntry(ArchiveEntry archiveEntry) throws IOException {
+ public void putArchiveEntry(final ArchiveEntry archiveEntry) throws IOException {
putArchiveEntry(archiveEntry, false);
}
@@ -709,7 +709,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* compressed size is known to exceed 4 GByte and {@link #setUseZip64}
* is {@link Zip64Mode#Never}.
*/
- private void putArchiveEntry(ArchiveEntry archiveEntry, boolean phased) throws IOException {
+ private void putArchiveEntry(final ArchiveEntry archiveEntry, final boolean phased) throws IOException {
if (finished) {
throw new IOException("Stream has already been finished");
}
@@ -759,7 +759,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* Provides default values for compression method and last
* modification time.
*/
- private void setDefaults(ZipArchiveEntry entry) {
+ private void setDefaults(final ZipArchiveEntry entry) {
if (entry.getMethod() == -1) { // not specified
entry.setMethod(method);
}
@@ -775,7 +775,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* big to be written without Zip64 extra but the mode has been set
* to Never.
*/
- private void validateSizeInformation(Zip64Mode effectiveMode)
+ private void validateSizeInformation(final Zip64Mode effectiveMode)
throws ZipException {
// Size/CRC not required if RandomAccessFile is used
if (entry.entry.getMethod() == STORED && raf == null) {
@@ -813,7 +813,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* usage</li>
* </ul>
*/
- private boolean shouldAddZip64Extra(ZipArchiveEntry entry, Zip64Mode mode) {
+ private boolean shouldAddZip64Extra(final ZipArchiveEntry entry, final Zip64Mode mode) {
return mode == Zip64Mode.Always
|| entry.getSize() >= ZIP64_MAGIC
|| entry.getCompressedSize() >= ZIP64_MAGIC
@@ -825,7 +825,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* Set the file comment.
* @param comment the comment
*/
- public void setComment(String comment) {
+ public void setComment(final String comment) {
this.comment = comment;
}
@@ -837,7 +837,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @throws IllegalArgumentException if an invalid compression
* level is specified.
*/
- public void setLevel(int level) {
+ public void setLevel(final int level) {
if (level < Deflater.DEFAULT_COMPRESSION
|| level > Deflater.BEST_COMPRESSION) {
throw new IllegalArgumentException("Invalid compression level: "
@@ -853,7 +853,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* <p>Default is DEFLATED.</p>
* @param method an <code>int</code> from java.util.zip.ZipEntry
*/
- public void setMethod(int method) {
+ public void setMethod(final int method) {
this.method = method;
}
@@ -865,7 +865,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @since 1.1
*/
@Override
- public boolean canWriteEntryData(ArchiveEntry ae) {
+ public boolean canWriteEntryData(final ArchiveEntry ae) {
if (ae instanceof ZipArchiveEntry) {
ZipArchiveEntry zae = (ZipArchiveEntry) ae;
return zae.getMethod() != ZipMethod.IMPLODING.getCode()
@@ -883,7 +883,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @throws IOException on error
*/
@Override
- public void write(byte[] b, int offset, int length) throws IOException {
+ public void write(final byte[] b, final int offset, final int length) throws IOException {
if (entry == null) {
throw new IllegalStateException("No current entry");
}
@@ -897,11 +897,11 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param data the byte array to write
* @throws IOException on error
*/
- private void writeCounted(byte[] data) throws IOException {
+ private void writeCounted(final byte[] data) throws IOException {
streamCompressor.writeCounted(data);
}
- private void copyFromZipInputStream(InputStream src) throws IOException {
+ private void copyFromZipInputStream(final InputStream src) throws IOException {
if (entry == null) {
throw new IllegalStateException("No current entry");
}
@@ -986,11 +986,11 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param ze the entry to write
* @throws IOException on error
*/
- protected void writeLocalFileHeader(ZipArchiveEntry ze) throws IOException {
+ protected void writeLocalFileHeader(final ZipArchiveEntry ze) throws IOException {
writeLocalFileHeader(ze, false);
}
- private void writeLocalFileHeader(ZipArchiveEntry ze, boolean phased) throws IOException {
+ private void writeLocalFileHeader(final ZipArchiveEntry ze, final boolean phased) throws IOException {
boolean encodable = zipEncoding.canEncode(ze.getName());
ByteBuffer name = getName(ze);
@@ -1007,8 +1007,8 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
}
- private byte[] createLocalFileHeader(ZipArchiveEntry ze, ByteBuffer name, boolean encodable,
- boolean phased) {
+ private byte[] createLocalFileHeader(final ZipArchiveEntry ze, final ByteBuffer name, final boolean encodable,
+ final boolean phased) {
byte[] extra = ze.getLocalFileDataExtra();
final int nameLen = name.limit() - name.position();
int len= LFH_FILENAME_OFFSET + nameLen + extra.length;
@@ -1079,8 +1079,8 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* ALWAYS or the data cannot be encoded using the configured
* encoding.
*/
- private void addUnicodeExtraFields(ZipArchiveEntry ze, boolean encodable,
- ByteBuffer name)
+ private void addUnicodeExtraFields(final ZipArchiveEntry ze, final boolean encodable,
+ final ByteBuffer name)
throws IOException {
if (createUnicodeExtraFields == UnicodeExtraFieldPolicy.ALWAYS
|| !encodable) {
@@ -1114,7 +1114,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param ze the entry to write
* @throws IOException on error
*/
- protected void writeDataDescriptor(ZipArchiveEntry ze) throws IOException {
+ protected void writeDataDescriptor(final ZipArchiveEntry ze) throws IOException {
if (ze.getMethod() != DEFLATED || raf != null) {
return;
}
@@ -1137,12 +1137,12 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* GByte and {@link Zip64Mode #setUseZip64} is {@link
* Zip64Mode#Never}.
*/
- protected void writeCentralFileHeader(ZipArchiveEntry ze) throws IOException {
+ protected void writeCentralFileHeader(final ZipArchiveEntry ze) throws IOException {
byte[] centralFileHeader = createCentralFileHeader(ze);
writeCounted(centralFileHeader);
}
- private byte[] createCentralFileHeader(ZipArchiveEntry ze) throws IOException {
+ private byte[] createCentralFileHeader(final ZipArchiveEntry ze) throws IOException {
final long lfhOffset = offsets.get(ze);
final boolean needsZip64Extra = hasZip64Extra(ze)
@@ -1172,8 +1172,8 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param lfhOffset Local file header offset for this file
* @throws IOException on error
*/
- private byte[] createCentralFileHeader(ZipArchiveEntry ze, ByteBuffer name, long lfhOffset,
- boolean needsZip64Extra) throws IOException {
+ private byte[] createCentralFileHeader(final ZipArchiveEntry ze, final ByteBuffer name, final long lfhOffset,
+ final boolean needsZip64Extra) throws IOException {
byte[] extra = ze.getCentralDirectoryExtra();
// file comment length
@@ -1261,8 +1261,8 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* If the entry needs Zip64 extra information inside the central
* directory then configure its data.
*/
- private void handleZip64Extra(ZipArchiveEntry ze, long lfhOffset,
- boolean needsZip64Extra) {
+ private void handleZip64Extra(final ZipArchiveEntry ze, final long lfhOffset,
+ final boolean needsZip64Extra) {
if (needsZip64Extra) {
Zip64ExtendedInformationExtraField z64 = getZip64Extra(ze);
if (ze.getCompressedSize() >= ZIP64_MAGIC
@@ -1397,7 +1397,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param data the byte array to write
* @throws IOException on error
*/
- protected final void writeOut(byte[] data) throws IOException {
+ protected final void writeOut(final byte[] data) throws IOException {
streamCompressor.writeOut(data, 0, data.length);
}
@@ -1409,7 +1409,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @param length the number of bytes to write
* @throws IOException on error
*/
- protected final void writeOut(byte[] data, int offset, int length)
+ protected final void writeOut(final byte[] data, final int offset, final int length)
throws IOException {
streamCompressor.writeOut(data, offset, length);
}
@@ -1435,7 +1435,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
INITIAL_VERSION;
}
- private boolean isDeflatedToOutputStream(int zipMethod) {
+ private boolean isDeflatedToOutputStream(final int zipMethod) {
return zipMethod == DEFLATED && raf == null;
}
@@ -1452,7 +1452,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* <p>Must not be used if the stream has already been closed.</p>
*/
@Override
- public ArchiveEntry createArchiveEntry(File inputFile, String entryName)
+ public ArchiveEntry createArchiveEntry(final File inputFile, final String entryName)
throws IOException {
if (finished) {
throw new IOException("Stream has already been finished");
@@ -1467,7 +1467,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* @since 1.3
*/
private Zip64ExtendedInformationExtraField
- getZip64Extra(ZipArchiveEntry ze) {
+ getZip64Extra(final ZipArchiveEntry ze) {
if (entry != null) {
entry.causedUseOfZip64 = !hasUsedZip64;
}
@@ -1498,7 +1498,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
*
* @since 1.3
*/
- private boolean hasZip64Extra(ZipArchiveEntry ze) {
+ private boolean hasZip64Extra(final ZipArchiveEntry ze) {
return ze.getExtraField(Zip64ExtendedInformationExtraField
.HEADER_ID)
!= null;
@@ -1511,7 +1511,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
*
* @since 1.3
*/
- private Zip64Mode getEffectiveZip64Mode(ZipArchiveEntry ze) {
+ private Zip64Mode getEffectiveZip64Mode(final ZipArchiveEntry ze) {
if (zip64Mode != Zip64Mode.AsNeeded
|| raf != null
|| ze.getMethod() != DEFLATED
@@ -1521,13 +1521,13 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
return Zip64Mode.Never;
}
- private ZipEncoding getEntryEncoding(ZipArchiveEntry ze) {
+ private ZipEncoding getEntryEncoding(final ZipArchiveEntry ze) {
boolean encodable = zipEncoding.canEncode(ze.getName());
return !encodable && fallbackToUTF8
? ZipEncodingHelper.UTF8_ZIP_ENCODING : zipEncoding;
}
- private ByteBuffer getName(ZipArchiveEntry ze) throws IOException {
+ private ByteBuffer getName(final ZipArchiveEntry ze) throws IOException {
return getEntryEncoding(ze).encode(ze.getName());
}
@@ -1568,7 +1568,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
new UnicodeExtraFieldPolicy("not encodeable");
private final String name;
- private UnicodeExtraFieldPolicy(String n) {
+ private UnicodeExtraFieldPolicy(final String n) {
name = n;
}
@Override
@@ -1582,7 +1582,7 @@ public class ZipArchiveOutputStream extends ArchiveOutputStream {
* currently being written.
*/
private static final class CurrentEntry {
- private CurrentEntry(ZipArchiveEntry entry) {
+ private CurrentEntry(final ZipArchiveEntry entry) {
this.entry = entry;
}
/**
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
index 0803e65..baf99ea 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
@@ -71,7 +71,7 @@ public final class ZipEightByteInteger implements Serializable {
* Create instance from a number.
* @param value the long to store as a ZipEightByteInteger
*/
- public ZipEightByteInteger(long value) {
+ public ZipEightByteInteger(final long value) {
this(BigInteger.valueOf(value));
}
@@ -79,7 +79,7 @@ public final class ZipEightByteInteger implements Serializable {
* Create instance from a number.
* @param value the BigInteger to store as a ZipEightByteInteger
*/
- public ZipEightByteInteger(BigInteger value) {
+ public ZipEightByteInteger(final BigInteger value) {
this.value = value;
}
@@ -87,7 +87,7 @@ public final class ZipEightByteInteger implements Serializable {
* Create instance from bytes.
* @param bytes the bytes to store as a ZipEightByteInteger
*/
- public ZipEightByteInteger (byte[] bytes) {
+ public ZipEightByteInteger (final byte[] bytes) {
this(bytes, 0);
}
@@ -96,7 +96,7 @@ public final class ZipEightByteInteger implements Serializable {
* @param bytes the bytes to store as a ZipEightByteInteger
* @param offset the offset to start
*/
- public ZipEightByteInteger (byte[] bytes, int offset) {
+ public ZipEightByteInteger (final byte[] bytes, final int offset) {
value = ZipEightByteInteger.getValue(bytes, offset);
}
@@ -129,7 +129,7 @@ public final class ZipEightByteInteger implements Serializable {
* @param value the value to convert
* @return value as eight bytes in big endian byte order
*/
- public static byte[] getBytes(long value) {
+ public static byte[] getBytes(final long value) {
return getBytes(BigInteger.valueOf(value));
}
@@ -138,7 +138,7 @@ public final class ZipEightByteInteger implements Serializable {
* @param value the value to convert
* @return value as eight bytes in big endian byte order
*/
- public static byte[] getBytes(BigInteger value) {
+ public static byte[] getBytes(final BigInteger value) {
byte[] result = new byte[8];
long val = value.longValue();
result[0] = (byte) ((val & BYTE_MASK));
@@ -162,7 +162,7 @@ public final class ZipEightByteInteger implements Serializable {
* @param offset the offset to start
* @return the corresponding Java long value
*/
- public static long getLongValue(byte[] bytes, int offset) {
+ public static long getLongValue(final byte[] bytes, final int offset) {
return getValue(bytes, offset).longValue();
}
@@ -173,7 +173,7 @@ public final class ZipEightByteInteger implements Serializable {
* @param offset the offset to start
* @return the corresponding Java BigInteger value
*/
- public static BigInteger getValue(byte[] bytes, int offset) {
+ public static BigInteger getValue(final byte[] bytes, final int offset) {
long value = ((long) bytes[offset + BYTE_7] << BYTE_7_SHIFT) & BYTE_7_MASK;
value += ((long) bytes[offset + BYTE_6] << BYTE_6_SHIFT) & BYTE_6_MASK;
value += ((long) bytes[offset + BYTE_5] << BYTE_5_SHIFT) & BYTE_5_MASK;
@@ -192,7 +192,7 @@ public final class ZipEightByteInteger implements Serializable {
* @param bytes the array of bytes
* @return the corresponding Java long value
*/
- public static long getLongValue(byte[] bytes) {
+ public static long getLongValue(final byte[] bytes) {
return getLongValue(bytes, 0);
}
@@ -201,7 +201,7 @@ public final class ZipEightByteInteger implements Serializable {
* @param bytes the array of bytes
* @return the corresponding Java BigInteger value
*/
- public static BigInteger getValue(byte[] bytes) {
+ public static BigInteger getValue(final byte[] bytes) {
return getValue(bytes, 0);
}
@@ -211,7 +211,7 @@ public final class ZipEightByteInteger implements Serializable {
* @return true if the objects are equal
*/
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (o == null || !(o instanceof ZipEightByteInteger)) {
return false;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java
index a4f0f80..63af448 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEncodingHelper.java
@@ -49,7 +49,7 @@ public abstract class ZipEncodingHelper {
*
* @see Simple8BitZipEncoding#Simple8BitZipEncoding(char[])
*/
- SimpleEncodingHolder(char [] highChars) {
+ SimpleEncodingHolder(final char [] highChars) {
this.highChars = highChars;
}
@@ -149,7 +149,7 @@ public abstract class ZipEncodingHelper {
* of <code>r</code>.
*
*/
- static ByteBuffer growBuffer(ByteBuffer b, int newCapacity) {
+ static ByteBuffer growBuffer(final ByteBuffer b, final int newCapacity) {
b.limit(b.position());
b.rewind();
@@ -178,7 +178,7 @@ public abstract class ZipEncodingHelper {
* @param bb The byte buffer to write to.
* @param c The character to write.
*/
- static void appendSurrogate(ByteBuffer bb, char c) {
+ static void appendSurrogate(final ByteBuffer bb, final char c) {
bb.put((byte) '%');
bb.put((byte) 'U');
@@ -207,7 +207,7 @@ public abstract class ZipEncodingHelper {
* the platform's default encoding.
* @return A zip encoding for the given encoding name.
*/
- public static ZipEncoding getZipEncoding(String name) {
+ public static ZipEncoding getZipEncoding(final String name) {
// fallback encoding is good enough for UTF-8.
if (isUTF8(name)) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
index 95e8c4c..36fa63b 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
@@ -150,7 +150,7 @@ public class ZipFile implements Closeable {
*
* @throws IOException if an error occurs while reading the file.
*/
- public ZipFile(File f) throws IOException {
+ public ZipFile(final File f) throws IOException {
this(f, ZipEncodingHelper.UTF8);
}
@@ -161,7 +161,7 @@ public class ZipFile implements Closeable {
*
* @throws IOException if an error occurs while reading the file.
*/
- public ZipFile(String name) throws IOException {
+ public ZipFile(final String name) throws IOException {
this(new File(name), ZipEncodingHelper.UTF8);
}
@@ -175,7 +175,7 @@ public class ZipFile implements Closeable {
*
* @throws IOException if an error occurs while reading the file.
*/
- public ZipFile(String name, String encoding) throws IOException {
+ public ZipFile(final String name, final String encoding) throws IOException {
this(new File(name), encoding, true);
}
@@ -189,7 +189,7 @@ public class ZipFile implements Closeable {
*
* @throws IOException if an error occurs while reading the file.
*/
- public ZipFile(File f, String encoding) throws IOException {
+ public ZipFile(final File f, final String encoding) throws IOException {
this(f, encoding, true);
}
@@ -205,7 +205,7 @@ public class ZipFile implements Closeable {
*
* @throws IOException if an error occurs while reading the file.
*/
- public ZipFile(File f, String encoding, boolean useUnicodeExtraFields)
+ public ZipFile(final File f, final String encoding, final boolean useUnicodeExtraFields)
throws IOException {
this.archiveName = f.getAbsolutePath();
this.encoding = encoding;
@@ -254,7 +254,7 @@ public class ZipFile implements Closeable {
* on a null parameter
* @param zipfile file to close, can be null
*/
- public static void closeQuietly(ZipFile zipfile) {
+ public static void closeQuietly(final ZipFile zipfile) {
IOUtils.closeQuietly(zipfile);
}
@@ -298,7 +298,7 @@ public class ZipFile implements Closeable {
* @return the ZipArchiveEntry corresponding to the given name - or
* {@code null} if not present.
*/
- public ZipArchiveEntry getEntry(String name) {
+ public ZipArchiveEntry getEntry(final String name) {
LinkedList<ZipArchiveEntry> entriesOfThatName = nameMap.get(name);
return entriesOfThatName != null ? entriesOfThatName.getFirst() : null;
}
@@ -312,7 +312,7 @@ public class ZipFile implements Closeable {
* given name
* @since 1.6
*/
- public Iterable<ZipArchiveEntry> getEntries(String name) {
+ public Iterable<ZipArchiveEntry> getEntries(final String name) {
List<ZipArchiveEntry> entriesOfThatName = nameMap.get(name);
return entriesOfThatName != null ? entriesOfThatName
: Collections.<ZipArchiveEntry>emptyList();
@@ -327,7 +327,7 @@ public class ZipFile implements Closeable {
* given name
* @since 1.6
*/
- public Iterable<ZipArchiveEntry> getEntriesInPhysicalOrder(String name) {
+ public Iterable<ZipArchiveEntry> getEntriesInPhysicalOrder(final String name) {
ZipArchiveEntry[] entriesOfThatName = new ZipArchiveEntry[0];
if (nameMap.containsKey(name)) {
entriesOfThatName = nameMap.get(name).toArray(entriesOfThatName);
@@ -345,7 +345,7 @@ public class ZipFile implements Closeable {
* @param ze the entry
* @return whether this class is able to read the given entry.
*/
- public boolean canReadEntryData(ZipArchiveEntry ze) {
+ public boolean canReadEntryData(final ZipArchiveEntry ze) {
return ZipUtil.canHandleEntryData(ze);
}
@@ -359,7 +359,7 @@ public class ZipFile implements Closeable {
* @return The raw input stream containing (possibly) compressed data.
* @since 1.11
*/
- public InputStream getRawInputStream(ZipArchiveEntry ze) {
+ public InputStream getRawInputStream(final ZipArchiveEntry ze) {
if (!(ze instanceof Entry)) {
return null;
}
@@ -378,7 +378,7 @@ public class ZipFile implements Closeable {
* @param predicate A predicate that selects which entries to write
* @throws IOException on error
*/
- public void copyRawEntries(ZipArchiveOutputStream target, ZipArchiveEntryPredicate predicate)
+ public void copyRawEntries(final ZipArchiveOutputStream target, final ZipArchiveEntryPredicate predicate)
throws IOException {
Enumeration<ZipArchiveEntry> src = getEntriesInPhysicalOrder();
while (src.hasMoreElements()) {
@@ -397,7 +397,7 @@ public class ZipFile implements Closeable {
* @throws IOException if unable to create an input stream from the zipentry
* @throws ZipException if the zipentry uses an unsupported feature
*/
- public InputStream getInputStream(ZipArchiveEntry ze)
+ public InputStream getInputStream(final ZipArchiveEntry ze)
throws IOException, ZipException {
if (!(ze instanceof Entry)) {
return null;
@@ -464,7 +464,7 @@ public class ZipFile implements Closeable {
* @throws IOException problem with content's input stream
* @since 1.5
*/
- public String getUnixSymlink(ZipArchiveEntry entry) throws IOException {
+ public String getUnixSymlink(final ZipArchiveEntry entry) throws IOException {
if (entry != null && entry.isUnixSymlink()) {
InputStream in = null;
try {
@@ -567,7 +567,7 @@ public class ZipFile implements Closeable {
* added to this map.
*/
private void
- readCentralDirectoryEntry(Map<ZipArchiveEntry, NameAndComment> noUTF8Flag)
+ readCentralDirectoryEntry(final Map<ZipArchiveEntry, NameAndComment> noUTF8Flag)
throws IOException {
archive.readFully(CFH_BUF);
int off = 0;
@@ -662,9 +662,9 @@ public class ZipFile implements Closeable {
* even if they are never used - and here a field with only one
* size would be invalid.</p>
*/
- private void setSizesAndOffsetFromZip64Extra(ZipArchiveEntry ze,
- OffsetEntry offset,
- int diskStart)
+ private void setSizesAndOffsetFromZip64Extra(final ZipArchiveEntry ze,
+ final OffsetEntry offset,
+ final int diskStart)
throws IOException {
Zip64ExtendedInformationExtraField z64 =
(Zip64ExtendedInformationExtraField)
@@ -877,9 +877,9 @@ public class ZipFile implements Closeable {
* for the given signature, positions the RandomaccessFile right
* at the signature if it has been found.
*/
- private boolean tryToLocateSignature(long minDistanceFromEnd,
- long maxDistanceFromEnd,
- byte[] sig) throws IOException {
+ private boolean tryToLocateSignature(final long minDistanceFromEnd,
+ final long maxDistanceFromEnd,
+ final byte[] sig) throws IOException {
boolean found = false;
long off = archive.length() - minDistanceFromEnd;
final long stopSearching =
@@ -949,7 +949,7 @@ public class ZipFile implements Closeable {
* <p>Also records the offsets for the data to read from the
* entries.</p>
*/
- private void resolveLocalFileHeaderData(Map<ZipArchiveEntry, NameAndComment>
+ private void resolveLocalFileHeaderData(final Map<ZipArchiveEntry, NameAndComment>
entriesWithoutUTF8Flag)
throws IOException {
for (ZipArchiveEntry zipArchiveEntry : entries) {
@@ -1014,7 +1014,7 @@ public class ZipFile implements Closeable {
private long loc;
private boolean addDummyByte = false;
- BoundedInputStream(long start, long remaining) {
+ BoundedInputStream(final long start, final long remaining) {
this.remaining = remaining;
loc = start;
}
@@ -1035,7 +1035,7 @@ public class ZipFile implements Closeable {
}
@Override
- public int read(byte[] b, int off, int len) throws IOException {
+ public int read(final byte[] b, final int off, int len) throws IOException {
if (remaining <= 0) {
if (addDummyByte) {
addDummyByte = false;
@@ -1076,7 +1076,7 @@ public class ZipFile implements Closeable {
private static final class NameAndComment {
private final byte[] name;
private final byte[] comment;
- private NameAndComment(byte[] name, byte[] comment) {
+ private NameAndComment(final byte[] name, final byte[] comment) {
this.name = name;
this.comment = comment;
}
@@ -1093,7 +1093,7 @@ public class ZipFile implements Closeable {
private final Comparator<ZipArchiveEntry> OFFSET_COMPARATOR =
new Comparator<ZipArchiveEntry>() {
@Override
- public int compare(ZipArchiveEntry e1, ZipArchiveEntry e2) {
+ public int compare(final ZipArchiveEntry e1, final ZipArchiveEntry e2) {
if (e1 == e2) {
return 0;
}
@@ -1119,7 +1119,7 @@ public class ZipFile implements Closeable {
private final OffsetEntry offsetEntry;
- Entry(OffsetEntry offset) {
+ Entry(final OffsetEntry offset) {
this.offsetEntry = offset;
}
@@ -1134,7 +1134,7 @@ public class ZipFile implements Closeable {
}
@Override
- public boolean equals(Object other) {
+ public boolean equals(final Object other) {
if (super.equals(other)) {
// super.equals would return false if other were not an Entry
Entry otherEntry = (Entry) other;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ZipLong.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipLong.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipLong.java
index bf717fc..3b2e278 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipLong.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipLong.java
@@ -90,7 +90,7 @@ public final class ZipLong implements Cloneable, Serializable {
* Create instance from a number.
* @param value the long to store as a ZipLong
*/
- public ZipLong(long value) {
+ public ZipLong(final long value) {
this.value = value;
}
@@ -98,7 +98,7 @@ public final class ZipLong implements Cloneable, Serializable {
* Create instance from bytes.
* @param bytes the bytes to store as a ZipLong
*/
- public ZipLong (byte[] bytes) {
+ public ZipLong (final byte[] bytes) {
this(bytes, 0);
}
@@ -107,7 +107,7 @@ public final class ZipLong implements Cloneable, Serializable {
* @param bytes the bytes to store as a ZipLong
* @param offset the offset to start
*/
- public ZipLong (byte[] bytes, int offset) {
+ public ZipLong (final byte[] bytes, final int offset) {
value = ZipLong.getValue(bytes, offset);
}
@@ -132,7 +132,7 @@ public final class ZipLong implements Cloneable, Serializable {
* @param value the value to convert
* @return value as four bytes in big endian byte order
*/
- public static byte[] getBytes(long value) {
+ public static byte[] getBytes(final long value) {
byte[] result = new byte[WORD];
putLong(value, result, 0);
return result;
@@ -147,14 +147,14 @@ public final class ZipLong implements Cloneable, Serializable {
* must be non-negative and no larger than <tt>buf.length-4</tt>
*/
- public static void putLong(long value, byte[] buf, int offset) {
+ public static void putLong(final long value, final byte[] buf, int offset) {
buf[offset++] = (byte) ((value & BYTE_MASK));
buf[offset++] = (byte) ((value & BYTE_1_MASK) >> BYTE_1_SHIFT);
buf[offset++] = (byte) ((value & BYTE_2_MASK) >> BYTE_2_SHIFT);
buf[offset] = (byte) ((value & BYTE_3_MASK) >> BYTE_3_SHIFT);
}
- public void putLong(byte[] buf, int offset) {
+ public void putLong(final byte[] buf, final int offset) {
putLong(value, buf, offset);
}
@@ -164,7 +164,7 @@ public final class ZipLong implements Cloneable, Serializable {
* @param offset the offset to start
* @return the corresponding Java long value
*/
- public static long getValue(byte[] bytes, int offset) {
+ public static long getValue(final byte[] bytes, final int offset) {
long value = (bytes[offset + BYTE_3] << BYTE_3_SHIFT) & BYTE_3_MASK;
value += (bytes[offset + BYTE_2] << BYTE_2_SHIFT) & BYTE_2_MASK;
value += (bytes[offset + BYTE_1] << BYTE_1_SHIFT) & BYTE_1_MASK;
@@ -177,7 +177,7 @@ public final class ZipLong implements Cloneable, Serializable {
* @param bytes the array of bytes
* @return the corresponding Java long value
*/
- public static long getValue(byte[] bytes) {
+ public static long getValue(final byte[] bytes) {
return getValue(bytes, 0);
}
@@ -187,7 +187,7 @@ public final class ZipLong implements Cloneable, Serializable {
* @return true if the objects are equal
*/
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (o == null || !(o instanceof ZipLong)) {
return false;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ZipMethod.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipMethod.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipMethod.java
index efe59e4..8848370 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipMethod.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipMethod.java
@@ -187,7 +187,7 @@ public enum ZipMethod {
/**
* private constructor for enum style class.
*/
- ZipMethod(int code) {
+ ZipMethod(final int code) {
this.code = code;
}
@@ -210,7 +210,7 @@ public enum ZipMethod {
* @return the {@link ZipMethod} for the given code or null if the
* method is not known.
*/
- public static ZipMethod getMethodByCode(int code) {
+ public static ZipMethod getMethodByCode(final int code) {
return codeToEnum.get(code);
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ZipShort.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipShort.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipShort.java
index 53d6c98..39f5274 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipShort.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipShort.java
@@ -38,7 +38,7 @@ public final class ZipShort implements Cloneable, Serializable {
* Create instance from a number.
* @param value the int to store as a ZipShort
*/
- public ZipShort (int value) {
+ public ZipShort (final int value) {
this.value = value;
}
@@ -46,7 +46,7 @@ public final class ZipShort implements Cloneable, Serializable {
* Create instance from bytes.
* @param bytes the bytes to store as a ZipShort
*/
- public ZipShort (byte[] bytes) {
+ public ZipShort (final byte[] bytes) {
this(bytes, 0);
}
@@ -55,7 +55,7 @@ public final class ZipShort implements Cloneable, Serializable {
* @param bytes the bytes to store as a ZipShort
* @param offset the offset to start
*/
- public ZipShort (byte[] bytes, int offset) {
+ public ZipShort (final byte[] bytes, final int offset) {
value = ZipShort.getValue(bytes, offset);
}
@@ -83,7 +83,7 @@ public final class ZipShort implements Cloneable, Serializable {
* @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) {
+ public static byte[] getBytes(final int value) {
byte[] result = new byte[2];
putShort(value, result, 0);
return result;
@@ -97,7 +97,7 @@ public final class ZipShort implements Cloneable, Serializable {
* The offset within the output buffer of the first byte to be written.
* must be non-negative and no larger than <tt>buf.length-2</tt>
*/
- public static void putShort(int value, byte[] buf, int offset) {
+ public static void putShort(final int value, final byte[] buf, final int offset) {
buf[offset] = (byte) (value & BYTE_MASK);
buf[offset+1] = (byte) ((value & BYTE_1_MASK) >> BYTE_1_SHIFT);
}
@@ -108,7 +108,7 @@ public final class ZipShort implements Cloneable, Serializable {
* @param offset the offset to start
* @return the corresponding java int value
*/
- public static int getValue(byte[] bytes, int offset) {
+ public static int getValue(final byte[] bytes, final int offset) {
int value = (bytes[offset + 1] << BYTE_1_SHIFT) & BYTE_1_MASK;
value += (bytes[offset] & BYTE_MASK);
return value;
@@ -119,7 +119,7 @@ public final class ZipShort implements Cloneable, Serializable {
* @param bytes the array of bytes
* @return the corresponding java int value
*/
- public static int getValue(byte[] bytes) {
+ public static int getValue(final byte[] bytes) {
return getValue(bytes, 0);
}
@@ -129,7 +129,7 @@ public final class ZipShort implements Cloneable, Serializable {
* @return true if the objects are equal
*/
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (o == null || !(o instanceof ZipShort)) {
return false;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
----------------------------------------------------------------------
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 757967d..847678f 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
@@ -39,7 +39,7 @@ public abstract class ZipUtil {
* @param time the <code>Date</code> to convert
* @return the date as a <code>ZipLong</code>
*/
- public static ZipLong toDosTime(Date time) {
+ public static ZipLong toDosTime(final Date time) {
return new ZipLong(toDosTime(time.getTime()));
}
@@ -50,7 +50,7 @@ public abstract class ZipUtil {
* @param t number of milliseconds since the epoch
* @return the date as a byte array
*/
- public static byte[] toDosTime(long t) {
+ public static byte[] toDosTime(final long t) {
byte[] result = new byte[4];
toDosTime(t, result, 0);
return result;
@@ -66,11 +66,11 @@ public abstract class ZipUtil {
* The offset within the output buffer of the first byte to be written.
* must be non-negative and no larger than <tt>buf.length-4</tt>
*/
- public static void toDosTime(long t, byte[] buf, int offset) {
+ public static void toDosTime(final long t, final byte[] buf, final int offset) {
toDosTime(Calendar.getInstance(), t, buf, offset);
}
- static void toDosTime(Calendar c, long t, byte[] buf, int offset) {
+ static void toDosTime(final Calendar c, final long t, final byte[] buf, final int offset) {
c.setTimeInMillis(t);
int year = c.get(Calendar.YEAR);
@@ -96,7 +96,7 @@ public abstract class ZipUtil {
* @param i the value to treat as unsigned int.
* @return the unsigned int as a long.
*/
- public static long adjustToLong(int i) {
+ public static long adjustToLong(final int i) {
if (i < 0) {
return 2 * ((long) Integer.MAX_VALUE) + 2 + i;
}
@@ -131,7 +131,7 @@ public abstract class ZipUtil {
* @param big BigInteger to convert.
* @return long representation of the BigInteger.
*/
- static long bigToLong(BigInteger big) {
+ static long bigToLong(final BigInteger big) {
if (big.bitLength() <= 63) { // bitLength() doesn't count the sign bit.
return big.longValue();
}
@@ -168,7 +168,7 @@ public abstract class ZipUtil {
* @return int representation of the provided byte
* @since 1.5
*/
- public static int signedByteToUnsignedInt(byte b) {
+ public static int signedByteToUnsignedInt(final byte b) {
if (b >= 0) {
return b;
}
@@ -183,7 +183,7 @@ public abstract class ZipUtil {
* @throws IllegalArgumentException if the provided integer is not inside the range [0,255].
* @since 1.5
*/
- public static byte unsignedIntToSignedByte(int i) {
+ public static byte unsignedIntToSignedByte(final int i) {
if (i > 255 || i < 0) {
throw new IllegalArgumentException("Can only convert non-negative integers between [0,255] to byte: [" + i + "]");
}
@@ -199,7 +199,7 @@ public abstract class ZipUtil {
* @param zipDosTime contains the stored DOS time.
* @return a Date instance corresponding to the given time.
*/
- public static Date fromDosTime(ZipLong zipDosTime) {
+ public static Date fromDosTime(final ZipLong zipDosTime) {
long dosTime = zipDosTime.getValue();
return new Date(dosToJavaTime(dosTime));
}
@@ -210,7 +210,7 @@ public abstract class ZipUtil {
* @param dosTime time to convert
* @return converted time
*/
- public static long dosToJavaTime(long dosTime) {
+ public static long dosToJavaTime(final long dosTime) {
Calendar cal = Calendar.getInstance();
// CheckStyle:MagicNumberCheck OFF - no point
cal.set(Calendar.YEAR, (int) ((dosTime >> 25) & 0x7f) + 1980);
@@ -229,9 +229,9 @@ public abstract class ZipUtil {
* names/comments match those of the extra fields, transfer the
* known Unicode values from the extra field.
*/
- static void setNameAndCommentFromExtraFields(ZipArchiveEntry ze,
- byte[] originalNameBytes,
- byte[] commentBytes) {
+ static void setNameAndCommentFromExtraFields(final ZipArchiveEntry ze,
+ final byte[] originalNameBytes,
+ final byte[] commentBytes) {
UnicodePathExtraField name = (UnicodePathExtraField)
ze.getExtraField(UnicodePathExtraField.UPATH_ID);
String originalName = ze.getName();
@@ -260,8 +260,8 @@ public abstract class ZipUtil {
* instead.</p>
*/
private static
- String getUnicodeStringIfOriginalMatches(AbstractUnicodeExtraField f,
- byte[] orig) {
+ String getUnicodeStringIfOriginalMatches(final AbstractUnicodeExtraField f,
+ final byte[] orig) {
if (f != null) {
CRC32 crc32 = new CRC32();
crc32.update(orig);
@@ -287,7 +287,7 @@ public abstract class ZipUtil {
* Create a copy of the given array - or return null if the
* argument is null.
*/
- static byte[] copy(byte[] from) {
+ static byte[] copy(final byte[] from) {
if (from != null) {
byte[] to = new byte[from.length];
System.arraycopy(from, 0, to, 0, to.length);
@@ -295,7 +295,7 @@ public abstract class ZipUtil {
}
return null;
}
- static void copy(byte[] from, byte[] to, int offset) {
+ static void copy(final byte[] from, final byte[] to, final int offset) {
if (from != null) {
System.arraycopy(from, 0, to, offset, from.length);
}
@@ -305,7 +305,7 @@ public abstract class ZipUtil {
/**
* Whether this library is able to read or write the given entry.
*/
- static boolean canHandleEntryData(ZipArchiveEntry entry) {
+ static boolean canHandleEntryData(final ZipArchiveEntry entry) {
return supportsEncryptionOf(entry) && supportsMethodOf(entry);
}
@@ -315,7 +315,7 @@ public abstract class ZipUtil {
*
* @return true if the entry isn't encrypted at all
*/
- private static boolean supportsEncryptionOf(ZipArchiveEntry entry) {
+ private static boolean supportsEncryptionOf(final ZipArchiveEntry entry) {
return !entry.getGeneralPurposeBit().usesEncryption();
}
@@ -325,7 +325,7 @@ public abstract class ZipUtil {
*
* @return true if the compression method is STORED or DEFLATED
*/
- private static boolean supportsMethodOf(ZipArchiveEntry entry) {
+ private static boolean supportsMethodOf(final ZipArchiveEntry entry) {
return entry.getMethod() == ZipEntry.STORED
|| entry.getMethod() == ZipMethod.UNSHRINKING.getCode()
|| entry.getMethod() == ZipMethod.IMPLODING.getCode()
@@ -337,7 +337,7 @@ public abstract class ZipUtil {
* Checks whether the entry requires features not (yet) supported
* by the library and throws an exception if it does.
*/
- static void checkRequestedFeatures(ZipArchiveEntry ze)
+ static void checkRequestedFeatures(final ZipArchiveEntry ze)
throws UnsupportedZipFeatureException {
if (!supportsEncryptionOf(ze)) {
throw
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/changes/Change.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/changes/Change.java b/src/main/java/org/apache/commons/compress/changes/Change.java
index c1b0a4c..8db217c 100644
--- a/src/main/java/org/apache/commons/compress/changes/Change.java
+++ b/src/main/java/org/apache/commons/compress/changes/Change.java
@@ -46,7 +46,7 @@ class Change {
* from the stream as argument.
* @param pFilename the filename of the file to delete
*/
- Change(final String pFilename, int type) {
+ Change(final String pFilename, final int type) {
if(pFilename == null) {
throw new NullPointerException();
}
@@ -63,7 +63,7 @@ class Change {
* @param pEntry the entry details
* @param pInput the InputStream for the entry data
*/
- Change(final ArchiveEntry pEntry, final InputStream pInput, boolean replace) {
+ Change(final ArchiveEntry pEntry, final InputStream pInput, final boolean replace) {
if(pEntry == null || pInput == null) {
throw new NullPointerException();
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/changes/ChangeSet.java b/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
index 72df166..7c899d0 100644
--- a/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
+++ b/src/main/java/org/apache/commons/compress/changes/ChangeSet.java
@@ -90,7 +90,7 @@ public final class ChangeSet {
* @param pChange
* the change which should result in an addition
*/
- private void addAddition(Change pChange) {
+ private void addAddition(final Change pChange) {
if (Change.TYPE_ADD != pChange.type() ||
pChange.getInput() == null) {
return;
@@ -124,7 +124,7 @@ public final class ChangeSet {
* @param pChange
* the change which should result in a deletion
*/
- private void addDeletion(Change pChange) {
+ private void addDeletion(final Change pChange) {
if ((Change.TYPE_DELETE != pChange.type() &&
Change.TYPE_DELETE_DIR != pChange.type()) ||
pChange.targetFile() == null) {
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java b/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
index 865fc09..46891d3 100644
--- a/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
+++ b/src/main/java/org/apache/commons/compress/changes/ChangeSetPerformer.java
@@ -67,7 +67,7 @@ public class ChangeSetPerformer {
* if an read/write error occurs
* @return the results of this operation
*/
- public ChangeSetResults perform(ArchiveInputStream in, ArchiveOutputStream out)
+ public ChangeSetResults perform(final ArchiveInputStream in, final ArchiveOutputStream out)
throws IOException {
return perform(new ArchiveInputStreamIterator(in), out);
}
@@ -88,7 +88,7 @@ public class ChangeSetPerformer {
* @return the results of this operation
* @since 1.5
*/
- public ChangeSetResults perform(ZipFile in, ArchiveOutputStream out)
+ public ChangeSetResults perform(final ZipFile in, final ArchiveOutputStream out)
throws IOException {
return perform(new ZipFileIterator(in), out);
}
@@ -108,8 +108,8 @@ public class ChangeSetPerformer {
* if an read/write error occurs
* @return the results of this operation
*/
- private ChangeSetResults perform(ArchiveEntryIterator entryIterator,
- ArchiveOutputStream out)
+ private ChangeSetResults perform(final ArchiveEntryIterator entryIterator,
+ final ArchiveOutputStream out)
throws IOException {
ChangeSetResults results = new ChangeSetResults();
@@ -184,7 +184,7 @@ public class ChangeSetPerformer {
* the entry to check
* @return true, if this entry has an deletion change later, false otherwise
*/
- private boolean isDeletedLater(Set<Change> workingSet, ArchiveEntry entry) {
+ private boolean isDeletedLater(final Set<Change> workingSet, final ArchiveEntry entry) {
String source = entry.getName();
if (!workingSet.isEmpty()) {
@@ -215,8 +215,8 @@ public class ChangeSetPerformer {
* @throws IOException
* if data cannot be read or written
*/
- private void copyStream(InputStream in, ArchiveOutputStream out,
- ArchiveEntry entry) throws IOException {
+ private void copyStream(final InputStream in, final ArchiveOutputStream out,
+ final ArchiveEntry entry) throws IOException {
out.putArchiveEntry(entry);
IOUtils.copy(in, out);
out.closeArchiveEntry();
@@ -241,7 +241,7 @@ public class ChangeSetPerformer {
implements ArchiveEntryIterator {
private final ArchiveInputStream in;
private ArchiveEntry next;
- ArchiveInputStreamIterator(ArchiveInputStream in) {
+ ArchiveInputStreamIterator(final ArchiveInputStream in) {
this.in = in;
}
@Override
@@ -263,7 +263,7 @@ public class ChangeSetPerformer {
private final ZipFile in;
private final Enumeration<ZipArchiveEntry> nestedEnum;
private ZipArchiveEntry current;
- ZipFileIterator(ZipFile in) {
+ ZipFileIterator(final ZipFile in) {
this.in = in;
nestedEnum = in.getEntriesInPhysicalOrder();
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/changes/ChangeSetResults.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/changes/ChangeSetResults.java b/src/main/java/org/apache/commons/compress/changes/ChangeSetResults.java
index d4f4cc2..e3e4d49 100644
--- a/src/main/java/org/apache/commons/compress/changes/ChangeSetResults.java
+++ b/src/main/java/org/apache/commons/compress/changes/ChangeSetResults.java
@@ -33,7 +33,7 @@ public class ChangeSetResults {
* Adds the filename of a recently deleted file to the result list.
* @param fileName the file which has been deleted
*/
- void deleted(String fileName) {
+ void deleted(final String fileName) {
deleted.add(fileName);
}
@@ -42,7 +42,7 @@ public class ChangeSetResults {
* copied from the source stream to the target stream.
* @param fileName the file name which has been added from the original stream
*/
- void addedFromStream(String fileName) {
+ void addedFromStream(final String fileName) {
addedFromStream.add(fileName);
}
@@ -51,7 +51,7 @@ public class ChangeSetResults {
* copied from the changeset to the target stream
* @param fileName the name of the file
*/
- void addedFromChangeSet(String fileName) {
+ void addedFromChangeSet(final String fileName) {
addedFromChangeSet.add(fileName);
}
@@ -84,7 +84,7 @@ public class ChangeSetResults {
* @param filename the filename to check
* @return true, if this filename already has been added
*/
- boolean hasBeenAdded(String filename) {
+ boolean hasBeenAdded(final String filename) {
if(addedFromChangeSet.contains(filename) || addedFromStream.contains(filename)) {
return true;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/CompressorException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorException.java b/src/main/java/org/apache/commons/compress/compressors/CompressorException.java
index aea05b3..7c1a356 100644
--- a/src/main/java/org/apache/commons/compress/compressors/CompressorException.java
+++ b/src/main/java/org/apache/commons/compress/compressors/CompressorException.java
@@ -33,7 +33,7 @@ public class CompressorException extends Exception {
* @param message
* the detail message
*/
- public CompressorException(String message) {
+ public CompressorException(final String message) {
super(message);
}
@@ -45,7 +45,7 @@ public class CompressorException extends Exception {
* @param cause
* the cause
*/
- public CompressorException(String message, Throwable cause) {
+ public CompressorException(final String message, final Throwable cause) {
super(message, cause);
}
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/CompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/CompressorInputStream.java
index 52b161b..0b2be21 100644
--- a/src/main/java/org/apache/commons/compress/compressors/CompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/CompressorInputStream.java
@@ -31,7 +31,7 @@ public abstract class CompressorInputStream extends InputStream {
*
* @since 1.1
*/
- protected void count(int read) {
+ protected void count(final int read) {
count((long) read);
}
@@ -41,7 +41,7 @@ public abstract class CompressorInputStream extends InputStream {
*
* @param read the number of bytes read
*/
- protected void count(long read) {
+ protected void count(final long read) {
if (read != -1) {
bytesRead = bytesRead + read;
}
@@ -53,7 +53,7 @@ public abstract class CompressorInputStream extends InputStream {
* @param pushedBack the number of bytes pushed back.
* @since 1.7
*/
- protected void pushedBackBytes(long pushedBack) {
+ protected void pushedBackBytes(final long pushedBack) {
bytesRead -= pushedBack;
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
index 8f374f7..8f7e057 100644
--- a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
+++ b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java
@@ -160,7 +160,7 @@ public class CompressorStreamFactory {
* This setting applies to the gzip, bzip2 and xz formats only.
* @since 1.10
*/
- public CompressorStreamFactory(boolean decompressUntilEOF) {
+ public CompressorStreamFactory(final boolean decompressUntilEOF) {
this.decompressUntilEOF = Boolean.valueOf(decompressUntilEOF);
// Also copy to existing variable so can continue to use that as the current value
this.decompressConcatenated = decompressUntilEOF;
@@ -183,7 +183,7 @@ public class CompressorStreamFactory {
* was used to create the factory
*/
@Deprecated
- public void setDecompressConcatenated(boolean decompressConcatenated) {
+ public void setDecompressConcatenated(final boolean decompressConcatenated) {
if (this.decompressUntilEOF != null) {
throw new IllegalStateException("Cannot override the setting defined by the constructor");
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/FileNameUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/FileNameUtil.java b/src/main/java/org/apache/commons/compress/compressors/FileNameUtil.java
index 6accafd..44735b5 100644
--- a/src/main/java/org/apache/commons/compress/compressors/FileNameUtil.java
+++ b/src/main/java/org/apache/commons/compress/compressors/FileNameUtil.java
@@ -88,8 +88,8 @@ public class FileNameUtil {
*
* @param defaultExtension the format's default extension like ".gz"
*/
- public FileNameUtil(Map<String, String> uncompressSuffix,
- String defaultExtension) {
+ public FileNameUtil(final Map<String, String> uncompressSuffix,
+ final String defaultExtension) {
this.uncompressSuffix = Collections.unmodifiableMap(uncompressSuffix);
int lc = Integer.MIN_VALUE, sc = Integer.MAX_VALUE;
int lu = Integer.MIN_VALUE, su = Integer.MAX_VALUE;
@@ -130,7 +130,7 @@ public class FileNameUtil {
* @return {@code true} if the filename has a common format suffix,
* {@code false} otherwise
*/
- public boolean isCompressedFilename(String filename) {
+ public boolean isCompressedFilename(final String filename) {
final String lower = filename.toLowerCase(Locale.ENGLISH);
final int n = lower.length();
for (int i = shortestCompressedSuffix;
@@ -155,7 +155,7 @@ public class FileNameUtil {
* @param filename name of a file
* @return name of the corresponding uncompressed file
*/
- public String getUncompressedFilename(String filename) {
+ public String getUncompressedFilename(final String filename) {
final String lower = filename.toLowerCase(Locale.ENGLISH);
final int n = lower.length();
for (int i = shortestCompressedSuffix;
@@ -179,7 +179,7 @@ public class FileNameUtil {
* @param filename name of a file
* @return name of the corresponding compressed file
*/
- public String getCompressedFilename(String filename) {
+ public String getCompressedFilename(final String filename) {
final String lower = filename.toLowerCase(Locale.ENGLISH);
final int n = lower.length();
for (int i = shortestUncompressedSuffix;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
index b4c7d9d..9c7938a 100644
--- a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
@@ -227,7 +227,7 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
}
}
- private boolean init(boolean isFirstStream) throws IOException {
+ private boolean init(final boolean isFirstStream) throws IOException {
if (null == in) {
throw new IOException("No InputStream");
}
@@ -951,7 +951,7 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
// 4560782 byte
// ===============
- Data(int blockSize100k) {
+ Data(final int blockSize100k) {
this.ll8 = new byte[blockSize100k * BZip2Constants.BASEBLOCKSIZE];
}
@@ -962,7 +962,7 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
* I don't initialize it at construction time to avoid unneccessary
* memory allocation when compressing small files.
*/
- int[] initTT(int length) {
+ int[] initTT(final int length) {
int[] ttShadow = this.tt;
// tt.length should always be >= length, but theoretically
@@ -989,7 +989,7 @@ public class BZip2CompressorInputStream extends CompressorInputStream implements
*
* @since 1.1
*/
- public static boolean matches(byte[] signature, int length) {
+ public static boolean matches(final byte[] signature, final int length) {
if (length < 3) {
return false;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
index 486ae8d..315c6fe 100644
--- a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
@@ -335,7 +335,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
* The length of the data which will be compressed by
* {@code BZip2CompressorOutputStream}.
*/
- public static int chooseBlockSize(long inputLength) {
+ public static int chooseBlockSize(final long inputLength) {
return (inputLength > 0) ? (int) Math
.min((inputLength / 132000) + 1, 9) : MAX_BLOCKSIZE;
}
@@ -1318,7 +1318,7 @@ public class BZip2CompressorOutputStream extends CompressorOutputStream
*/
int origPtr;
- Data(int blockSize100k) {
+ Data(final int blockSize100k) {
final int n = blockSize100k * BZip2Constants.BASEBLOCKSIZE;
this.block = new byte[(n + 1 + NUM_OVERSHOOT_BYTES)];
this.fmap = new int[n];
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2Utils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2Utils.java b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2Utils.java
index e562835..2aed7e5 100644
--- a/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2Utils.java
+++ b/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2Utils.java
@@ -55,7 +55,7 @@ public abstract class BZip2Utils {
* @return {@code true} if the filename has a common bzip2 suffix,
* {@code false} otherwise
*/
- public static boolean isCompressedFilename(String filename) {
+ public static boolean isCompressedFilename(final String filename) {
return fileNameUtil.isCompressedFilename(filename);
}
@@ -72,7 +72,7 @@ public abstract class BZip2Utils {
* @param filename name of a file
* @return name of the corresponding uncompressed file
*/
- public static String getUncompressedFilename(String filename) {
+ public static String getUncompressedFilename(final String filename) {
return fileNameUtil.getUncompressedFilename(filename);
}
@@ -86,7 +86,7 @@ public abstract class BZip2Utils {
* @param filename name of a file
* @return name of the corresponding compressed file
*/
- public static String getCompressedFilename(String filename) {
+ public static String getCompressedFilename(final String filename) {
return fileNameUtil.getCompressedFilename(filename);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java b/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java
index bafa9e5..ffe77d4 100644
--- a/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java
+++ b/src/main/java/org/apache/commons/compress/compressors/bzip2/BlockSort.java
@@ -264,10 +264,10 @@ class BlockSort {
* @param lo lower boundary of the fmap-interval to be sorted
* @param hi upper boundary of the fmap-interval to be sorted
*/
- private void fallbackSimpleSort(int[] fmap,
- int[] eclass,
- int lo,
- int hi) {
+ private void fallbackSimpleSort(final int[] fmap,
+ final int[] eclass,
+ final int lo,
+ final int hi) {
if (lo == hi) {
return;
}
@@ -300,7 +300,7 @@ class BlockSort {
/**
* swaps two values in fmap
*/
- private void fswap(int[] fmap, int zz1, int zz2) {
+ private void fswap(final int[] fmap, final int zz1, final int zz2) {
int zztmp = fmap[zz1];
fmap[zz1] = fmap[zz2];
fmap[zz2] = zztmp;
@@ -309,23 +309,23 @@ class BlockSort {
/**
* swaps two intervals starting at yyp1 and yyp2 of length yyn inside fmap.
*/
- private void fvswap(int[] fmap, int yyp1, int yyp2, int yyn) {
+ private void fvswap(final int[] fmap, int yyp1, int yyp2, int yyn) {
while (yyn > 0) {
fswap(fmap, yyp1, yyp2);
yyp1++; yyp2++; yyn--;
}
}
- private int fmin(int a, int b) {
+ private int fmin(final int a, final int b) {
return a < b ? a : b;
}
- private void fpush(int sp, int lz, int hz) {
+ private void fpush(final int sp, final int lz, final int hz) {
stack_ll[sp] = lz;
stack_hh[sp] = hz;
}
- private int[] fpop(int sp) {
+ private int[] fpop(final int sp) {
return new int[] { stack_ll[sp], stack_hh[sp] };
}
@@ -339,10 +339,10 @@ class BlockSort {
* @param loSt lower boundary of the fmap-interval to be sorted
* @param hiSt upper boundary of the fmap-interval to be sorted
*/
- private void fallbackQSort3(int[] fmap,
- int[] eclass,
- int loSt,
- int hiSt) {
+ private void fallbackQSort3(final int[] fmap,
+ final int[] eclass,
+ final int loSt,
+ final int hiSt) {
int lo, unLo, ltLo, hi, unHi, gtHi, n;
long r = 0;
@@ -467,7 +467,7 @@ class BlockSort {
* @param nblock size of the block
* @param off offset of first byte to sort in block
*/
- final void fallbackSort(int[] fmap, byte[] block, int nblock) {
+ final void fallbackSort(final int[] fmap, final byte[] block, final int nblock) {
final int[] ftab = new int[257];
int H, i, j, k, l, r, cc, cc1;
int nNotDone;
@@ -780,7 +780,7 @@ class BlockSort {
Sedgewick and Jon L. Bentley.
--*/
- private static void vswap(int[] fmap, int p1, int p2, int n) {
+ private static void vswap(final int[] fmap, int p1, int p2, int n) {
n += p1;
while (p1 < n) {
int t = fmap[p1];
@@ -789,7 +789,7 @@ class BlockSort {
}
}
- private static byte med3(byte a, byte b, byte c) {
+ private static byte med3(final byte a, final byte b, final byte c) {
return (a < b) ? (b < c ? b : a < c ? c : a) : (b > c ? b : a > c ? c
: a);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/bzip2/CRC.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/bzip2/CRC.java b/src/main/java/org/apache/commons/compress/compressors/bzip2/CRC.java
index ec0502b..6631e46 100644
--- a/src/main/java/org/apache/commons/compress/compressors/bzip2/CRC.java
+++ b/src/main/java/org/apache/commons/compress/compressors/bzip2/CRC.java
@@ -107,11 +107,11 @@ class CRC {
return globalCrc;
}
- void setGlobalCRC(int newCrc) {
+ void setGlobalCRC(final int newCrc) {
globalCrc = newCrc;
}
- void updateCRC(int inCh) {
+ void updateCRC(final int inCh) {
int temp = (globalCrc >> 24) ^ inCh;
if (temp < 0) {
temp = 256 + temp;
@@ -119,7 +119,7 @@ class CRC {
globalCrc = (globalCrc << 8) ^ CRC.crc32Table[temp];
}
- void updateCRC(int inCh, int repeat) {
+ void updateCRC(final int inCh, int repeat) {
int globalCrcShadow = this.globalCrc;
while (repeat-- > 0) {
int temp = (globalCrcShadow >> 24) ^ inCh;
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/bzip2/Rand.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/bzip2/Rand.java b/src/main/java/org/apache/commons/compress/compressors/bzip2/Rand.java
index 0c08d1f..5358b3a 100644
--- a/src/main/java/org/apache/commons/compress/compressors/bzip2/Rand.java
+++ b/src/main/java/org/apache/commons/compress/compressors/bzip2/Rand.java
@@ -85,7 +85,7 @@ final class Rand {
* @param i the index
* @return the random number
*/
- static int rNums(int i){
+ static int rNums(final int i){
return RNUMS[i];
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java
index f7b8dd0..76a86d8 100644
--- a/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorInputStream.java
@@ -46,7 +46,7 @@ public class DeflateCompressorInputStream extends CompressorInputStream {
* @param inputStream where to read the compressed data
*
*/
- public DeflateCompressorInputStream(InputStream inputStream) {
+ public DeflateCompressorInputStream(final InputStream inputStream) {
this(inputStream, new DeflateParameters());
}
@@ -57,8 +57,8 @@ public class DeflateCompressorInputStream extends CompressorInputStream {
* @param inputStream where to read the compressed data
* @param parameters parameters
*/
- public DeflateCompressorInputStream(InputStream inputStream,
- DeflateParameters parameters) {
+ public DeflateCompressorInputStream(final InputStream inputStream,
+ final DeflateParameters parameters) {
inflater = new Inflater(!parameters.withZlibHeader());
in = new InflaterInputStream(inputStream, inflater);
}
@@ -73,7 +73,7 @@ public class DeflateCompressorInputStream extends CompressorInputStream {
/** {@inheritDoc} */
@Override
- public int read(byte[] buf, int off, int len) throws IOException {
+ public int read(final byte[] buf, final int off, final int len) throws IOException {
int ret = in.read(buf, off, len);
count(ret);
return ret;
@@ -81,7 +81,7 @@ public class DeflateCompressorInputStream extends CompressorInputStream {
/** {@inheritDoc} */
@Override
- public long skip(long n) throws IOException {
+ public long skip(final long n) throws IOException {
return in.skip(n);
}
@@ -114,7 +114,7 @@ public class DeflateCompressorInputStream extends CompressorInputStream {
*
* @since 1.10
*/
- public static boolean matches(byte[] signature, int length) {
+ public static boolean matches(final byte[] signature, final int length) {
return length > 3 && signature[0] == MAGIC_1 && (
signature[1] == (byte) MAGIC_2a ||
signature[1] == (byte) MAGIC_2b ||
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java b/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java
index 3e354d6..a315605 100644
--- a/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateCompressorOutputStream.java
@@ -38,7 +38,7 @@ public class DeflateCompressorOutputStream extends CompressorOutputStream {
* @param outputStream the stream to wrap
* @throws IOException on error
*/
- public DeflateCompressorOutputStream(OutputStream outputStream) throws IOException {
+ public DeflateCompressorOutputStream(final OutputStream outputStream) throws IOException {
this(outputStream, new DeflateParameters());
}
@@ -48,19 +48,19 @@ public class DeflateCompressorOutputStream extends CompressorOutputStream {
* @param parameters the deflate parameters to apply
* @throws IOException on error
*/
- public DeflateCompressorOutputStream(OutputStream outputStream,
- DeflateParameters parameters) throws IOException {
+ public DeflateCompressorOutputStream(final OutputStream outputStream,
+ final DeflateParameters parameters) throws IOException {
this.deflater = new Deflater(parameters.getCompressionLevel(), !parameters.withZlibHeader());
this.out = new DeflaterOutputStream(outputStream, deflater);
}
@Override
- public void write(int b) throws IOException {
+ public void write(final int b) throws IOException {
out.write(b);
}
@Override
- public void write(byte[] buf, int off, int len) throws IOException {
+ public void write(final byte[] buf, final int off, final int len) throws IOException {
out.write(buf, off, len);
}
http://git-wip-us.apache.org/repos/asf/commons-compress/blob/478bef36/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateParameters.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateParameters.java b/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateParameters.java
index 1d32f7e..7679942 100644
--- a/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateParameters.java
+++ b/src/main/java/org/apache/commons/compress/compressors/deflate/DeflateParameters.java
@@ -47,7 +47,7 @@ public class DeflateParameters {
*
* @param zlibHeader true if zlib header shall be written
*/
- public void setWithZlibHeader(boolean zlibHeader) {
+ public void setWithZlibHeader(final boolean zlibHeader) {
this.zlibHeader = zlibHeader;
}
@@ -69,7 +69,7 @@ public class DeflateParameters {
* @see Deflater#DEFAULT_COMPRESSION
* @see Deflater#BEST_COMPRESSION
*/
- public void setCompressionLevel(int compressionLevel) {
+ public void setCompressionLevel(final int compressionLevel) {
if (compressionLevel < -1 || compressionLevel > 9) {
throw new IllegalArgumentException("Invalid Deflate compression level: " + compressionLevel);
}