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-codec.git
commit 5fcf0987924255f93445cbb6b0babad6109b608c Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Mon Dec 30 19:30:23 2019 -0500 Some Checkstyle fixes. --- .../java/org/apache/commons/codec/Charsets.java | 48 +++++++++++----------- .../org/apache/commons/codec/binary/Base32.java | 12 +++--- .../commons/codec/binary/Base32InputStream.java | 6 +-- .../commons/codec/binary/Base32OutputStream.java | 6 +-- .../codec/binary/BaseNCodecInputStream.java | 4 +- .../codec/binary/BaseNCodecOutputStream.java | 6 +-- 6 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/main/java/org/apache/commons/codec/Charsets.java b/src/main/java/org/apache/commons/codec/Charsets.java index 4a6c42f..8c7d1f5 100644 --- a/src/main/java/org/apache/commons/codec/Charsets.java +++ b/src/main/java/org/apache/commons/codec/Charsets.java @@ -64,30 +64,6 @@ public class Charsets { // /** - * Returns the given Charset or the default Charset if the given Charset is null. - * - * @param charset - * A charset or null. - * @return the given Charset or the default Charset if the given Charset is null - */ - public static Charset toCharset(final Charset charset) { - return charset == null ? Charset.defaultCharset() : charset; - } - - /** - * Returns a Charset for the named charset. If the name is null, return the default Charset. - * - * @param charset - * The name of the requested charset, may be null. - * @return a Charset for the named charset - * @throws java.nio.charset.UnsupportedCharsetException - * If the named charset is unavailable - */ - public static Charset toCharset(final String charset) { - return charset == null ? Charset.defaultCharset() : Charset.forName(charset); - } - - /** * CharEncodingISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1. * <p> * Every implementation of the Java platform is required to support this character encoding. @@ -159,4 +135,28 @@ public class Charsets { */ @Deprecated public static final Charset UTF_8 = StandardCharsets.UTF_8; + + /** + * Returns the given Charset or the default Charset if the given Charset is null. + * + * @param charset + * A charset or null. + * @return the given Charset or the default Charset if the given Charset is null + */ + public static Charset toCharset(final Charset charset) { + return charset == null ? Charset.defaultCharset() : charset; + } + + /** + * Returns a Charset for the named charset. If the name is null, return the default Charset. + * + * @param charset + * The name of the requested charset, may be null. + * @return a Charset for the named charset + * @throws java.nio.charset.UnsupportedCharsetException + * If the named charset is unavailable + */ + public static Charset toCharset(final String charset) { + return charset == null ? Charset.defaultCharset() : Charset.forName(charset); + } } diff --git a/src/main/java/org/apache/commons/codec/binary/Base32.java b/src/main/java/org/apache/commons/codec/binary/Base32.java index bdea48e..99b4b19 100644 --- a/src/main/java/org/apache/commons/codec/binary/Base32.java +++ b/src/main/java/org/apache/commons/codec/binary/Base32.java @@ -343,14 +343,14 @@ public class Base32 extends BaseNCodec { * octets, using {@link org.apache.commons.codec.binary.BaseNCodec.Context#pos Context#pos} as the buffer position * </p> * - * @param in byte[] array of ascii data to Base32 decode. + * @param input byte[] array of ascii data to Base32 decode. * @param inPos Position to start reading data from. * @param inAvail Amount of bytes available from input for decoding. * @param context the context to be used * */ @Override - void decode(final byte[] in, int inPos, final int inAvail, final Context context) { + void decode(final byte[] input, int inPos, final int inAvail, final Context context) { // package protected for access from I/O streams if (context.eof) { @@ -360,7 +360,7 @@ public class Base32 extends BaseNCodec { context.eof = true; } for (int i = 0; i < inAvail; i++) { - final byte b = in[inPos++]; + final byte b = input[inPos++]; if (b == pad) { // We're done. context.eof = true; @@ -442,7 +442,7 @@ public class Base32 extends BaseNCodec { * remaining bytes (if not multiple of 5). * </p> * - * @param in + * @param input * byte[] array of binary data to Base32 encode. * @param inPos * Position to start reading data from. @@ -451,7 +451,7 @@ public class Base32 extends BaseNCodec { * @param context the context to be used */ @Override - void encode(final byte[] in, int inPos, final int inAvail, final Context context) { + void encode(final byte[] input, int inPos, final int inAvail, final Context context) { // package protected for access from I/O streams if (context.eof) { @@ -522,7 +522,7 @@ public class Base32 extends BaseNCodec { for (int i = 0; i < inAvail; i++) { final byte[] buffer = ensureBufferSize(encodeSize, context); context.modulus = (context.modulus+1) % BYTES_PER_UNENCODED_BLOCK; - int b = in[inPos++]; + int b = input[inPos++]; if (b < 0) { b += 256; } diff --git a/src/main/java/org/apache/commons/codec/binary/Base32InputStream.java b/src/main/java/org/apache/commons/codec/binary/Base32InputStream.java index f6cd1ce..90be691 100644 --- a/src/main/java/org/apache/commons/codec/binary/Base32InputStream.java +++ b/src/main/java/org/apache/commons/codec/binary/Base32InputStream.java @@ -64,7 +64,7 @@ public class Base32InputStream extends BaseNCodecInputStream { * Creates a Base32InputStream such that all data read is either Base32-encoded or Base32-decoded from the original * provided InputStream. * - * @param in + * @param input * InputStream to wrap. * @param doEncode * true if we should encode all data read from us, false if we should decode. @@ -76,9 +76,9 @@ public class Base32InputStream extends BaseNCodecInputStream { * If doEncode is true, each line of encoded data will be terminated with this byte sequence (e.g. \r\n). * If lineLength <= 0, the lineSeparator is not used. If doEncode is false lineSeparator is ignored. */ - public Base32InputStream(final InputStream in, final boolean doEncode, + public Base32InputStream(final InputStream input, final boolean doEncode, final int lineLength, final byte[] lineSeparator) { - super(in, new Base32(lineLength, lineSeparator), doEncode); + super(input, new Base32(lineLength, lineSeparator), doEncode); } } diff --git a/src/main/java/org/apache/commons/codec/binary/Base32OutputStream.java b/src/main/java/org/apache/commons/codec/binary/Base32OutputStream.java index 9aa3058..d66f92a 100644 --- a/src/main/java/org/apache/commons/codec/binary/Base32OutputStream.java +++ b/src/main/java/org/apache/commons/codec/binary/Base32OutputStream.java @@ -68,7 +68,7 @@ public class Base32OutputStream extends BaseNCodecOutputStream { * Creates a Base32OutputStream such that all data written is either Base32-encoded or Base32-decoded to the * original provided OutputStream. * - * @param out + * @param ouput * OutputStream to wrap. * @param doEncode * true if we should encode all data written to us, false if we should decode. @@ -80,9 +80,9 @@ public class Base32OutputStream extends BaseNCodecOutputStream { * If doEncode is true, each line of encoded data will be terminated with this byte sequence (e.g. \r\n). * If lineLength <= 0, the lineSeparator is not used. If doEncode is false lineSeparator is ignored. */ - public Base32OutputStream(final OutputStream out, final boolean doEncode, + public Base32OutputStream(final OutputStream ouput, final boolean doEncode, final int lineLength, final byte[] lineSeparator) { - super(out, new Base32(lineLength, lineSeparator), doEncode); + super(ouput, new Base32(lineLength, lineSeparator), doEncode); } } diff --git a/src/main/java/org/apache/commons/codec/binary/BaseNCodecInputStream.java b/src/main/java/org/apache/commons/codec/binary/BaseNCodecInputStream.java index 19d5a77..58f21fe 100644 --- a/src/main/java/org/apache/commons/codec/binary/BaseNCodecInputStream.java +++ b/src/main/java/org/apache/commons/codec/binary/BaseNCodecInputStream.java @@ -41,8 +41,8 @@ public class BaseNCodecInputStream extends FilterInputStream { private final Context context = new Context(); - protected BaseNCodecInputStream(final InputStream in, final BaseNCodec baseNCodec, final boolean doEncode) { - super(in); + protected BaseNCodecInputStream(final InputStream input, final BaseNCodec baseNCodec, final boolean doEncode) { + super(input); this.doEncode = doEncode; this.baseNCodec = baseNCodec; } diff --git a/src/main/java/org/apache/commons/codec/binary/BaseNCodecOutputStream.java b/src/main/java/org/apache/commons/codec/binary/BaseNCodecOutputStream.java index 5c686ab..e6580d9 100644 --- a/src/main/java/org/apache/commons/codec/binary/BaseNCodecOutputStream.java +++ b/src/main/java/org/apache/commons/codec/binary/BaseNCodecOutputStream.java @@ -50,12 +50,12 @@ public class BaseNCodecOutputStream extends FilterOutputStream { /** * TODO should this be protected? * - * @param out the underlying output or null. + * @param output the underlying output or null. * @param basedCodec a BaseNCodec. * @param doEncode true to encode, false to decode, TODO should be an enum? */ - public BaseNCodecOutputStream(final OutputStream out, final BaseNCodec basedCodec, final boolean doEncode) { - super(out); + public BaseNCodecOutputStream(final OutputStream output, final BaseNCodec basedCodec, final boolean doEncode) { + super(output); this.baseNCodec = basedCodec; this.doEncode = doEncode; }