Skip to content

Commit 4fd068a

Browse files
committed
Fix PMD issues and Javadoc
- Avoid unnecessary constructors - the compiler will generate these for you - Use conventional internal names - No final in abstract method - Use underscores for some literal numbers - Avoid short names, "in" -> "inputStream"
1 parent 785cf3e commit 4fd068a

23 files changed

Lines changed: 125 additions & 158 deletions

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ limitations under the License.
2424
<parent>
2525
<groupId>org.apache.commons</groupId>
2626
<artifactId>commons-parent</artifactId>
27-
<version>54-SNAPSHOT</version>
27+
<version>53</version>
2828
</parent>
2929
<groupId>commons-codec</groupId>
3030
<artifactId>commons-codec</artifactId>

src/main/java/org/apache/commons/codec/binary/Base16InputStream.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,47 +35,47 @@ public class Base16InputStream extends BaseNCodecInputStream {
3535
/**
3636
* Creates a Base16InputStream such that all data read is Base16-decoded from the original provided InputStream.
3737
*
38-
* @param in InputStream to wrap.
38+
* @param inputStream InputStream to wrap.
3939
*/
40-
public Base16InputStream(final InputStream in) {
41-
this(in, false);
40+
public Base16InputStream(final InputStream inputStream) {
41+
this(inputStream, false);
4242
}
4343

4444
/**
4545
* Creates a Base16InputStream such that all data read is either Base16-encoded or Base16-decoded from the original
4646
* provided InputStream.
4747
*
48-
* @param in InputStream to wrap.
48+
* @param inputStream InputStream to wrap.
4949
* @param doEncode true if we should encode all data read from us, false if we should decode.
5050
*/
51-
public Base16InputStream(final InputStream in, final boolean doEncode) {
52-
this(in, doEncode, false);
51+
public Base16InputStream(final InputStream inputStream, final boolean doEncode) {
52+
this(inputStream, doEncode, false);
5353
}
5454

5555
/**
5656
* Creates a Base16InputStream such that all data read is either Base16-encoded or Base16-decoded from the original
5757
* provided InputStream.
5858
*
59-
* @param in InputStream to wrap.
59+
* @param inputStream InputStream to wrap.
6060
* @param doEncode true if we should encode all data read from us, false if we should decode.
6161
* @param lowerCase if {@code true} then use a lower-case Base16 alphabet.
6262
*/
63-
public Base16InputStream(final InputStream in, final boolean doEncode,
63+
public Base16InputStream(final InputStream inputStream, final boolean doEncode,
6464
final boolean lowerCase) {
65-
this(in, doEncode, lowerCase, CodecPolicy.LENIENT);
65+
this(inputStream, doEncode, lowerCase, CodecPolicy.LENIENT);
6666
}
6767

6868
/**
6969
* Creates a Base16InputStream such that all data read is either Base16-encoded or Base16-decoded from the original
7070
* provided InputStream.
7171
*
72-
* @param in InputStream to wrap.
72+
* @param inputStream InputStream to wrap.
7373
* @param doEncode true if we should encode all data read from us, false if we should decode.
7474
* @param lowerCase if {@code true} then use a lower-case Base16 alphabet.
7575
* @param decodingPolicy Decoding policy.
7676
*/
77-
public Base16InputStream(final InputStream in, final boolean doEncode,
77+
public Base16InputStream(final InputStream inputStream, final boolean doEncode,
7878
final boolean lowerCase, final CodecPolicy decodingPolicy) {
79-
super(in, new Base16(lowerCase, decodingPolicy), doEncode);
79+
super(inputStream, new Base16(lowerCase, decodingPolicy), doEncode);
8080
}
8181
}

src/main/java/org/apache/commons/codec/binary/Base16OutputStream.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,47 +35,45 @@ public class Base16OutputStream extends BaseNCodecOutputStream {
3535
/**
3636
* Creates a Base16OutputStream such that all data written is Hex-encoded to the original provided OutputStream.
3737
*
38-
* @param out OutputStream to wrap.
38+
* @param outputStream OutputStream to wrap.
3939
*/
40-
public Base16OutputStream(final OutputStream out) {
41-
this(out, true);
40+
public Base16OutputStream(final OutputStream outputStream) {
41+
this(outputStream, true);
4242
}
4343

4444
/**
4545
* Creates a Base16OutputStream such that all data written is either Hex-encoded or Hex-decoded to the
4646
* original provided OutputStream.
4747
*
48-
* @param out OutputStream to wrap.
48+
* @param outputStream OutputStream to wrap.
4949
* @param doEncode true if we should encode all data written to us, false if we should decode.
5050
*/
51-
public Base16OutputStream(final OutputStream out, final boolean doEncode) {
52-
this(out, doEncode, false);
51+
public Base16OutputStream(final OutputStream outputStream, final boolean doEncode) {
52+
this(outputStream, doEncode, false);
5353
}
5454

5555
/**
5656
* Creates a Base16OutputStream such that all data written is either Hex-encoded or Hex-decoded to the
5757
* original provided OutputStream.
5858
*
59-
* @param out OutputStream to wrap.
59+
* @param outputStream OutputStream to wrap.
6060
* @param doEncode true if we should encode all data written to us, false if we should decode.
6161
* @param lowerCase if {@code true} then use a lower-case Base16 alphabet.
6262
*/
63-
public Base16OutputStream(final OutputStream out, final boolean doEncode,
64-
final boolean lowerCase) {
65-
this(out, doEncode, lowerCase, CodecPolicy.LENIENT);
63+
public Base16OutputStream(final OutputStream outputStream, final boolean doEncode, final boolean lowerCase) {
64+
this(outputStream, doEncode, lowerCase, CodecPolicy.LENIENT);
6665
}
6766

6867
/**
6968
* Creates a Base16OutputStream such that all data written is either Hex-encoded or Hex-decoded to the
7069
* original provided OutputStream.
7170
*
72-
* @param out OutputStream to wrap.
71+
* @param outputStream OutputStream to wrap.
7372
* @param doEncode true if we should encode all data written to us, false if we should decode.
7473
* @param lowerCase if {@code true} then use a lower-case Base16 alphabet.
7574
* @param decodingPolicy Decoding policy.
7675
*/
77-
public Base16OutputStream(final OutputStream out, final boolean doEncode,
78-
final boolean lowerCase, final CodecPolicy decodingPolicy) {
79-
super(out, new Base16(lowerCase, decodingPolicy), doEncode);
76+
public Base16OutputStream(final OutputStream outputStream, final boolean doEncode, final boolean lowerCase, final CodecPolicy decodingPolicy) {
77+
super(outputStream, new Base16(lowerCase, decodingPolicy), doEncode);
8078
}
8179
}

src/main/java/org/apache/commons/codec/binary/Base32.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ public Base32(final int lineLength, final byte[] lineSeparator, final boolean us
356356
* octets, using {@link org.apache.commons.codec.binary.BaseNCodec.Context#pos Context#pos} as the buffer position
357357
* </p>
358358
*
359-
* @param input byte[] array of ascii data to Base32 decode.
359+
* @param input byte[] array of ASCII data to Base32 decode.
360360
* @param inPos Position to start reading data from.
361361
* @param inAvail Amount of bytes available from input for decoding.
362362
* @param context the context to be used

src/main/java/org/apache/commons/codec/binary/Base32InputStream.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,31 +57,31 @@ public class Base32InputStream extends BaseNCodecInputStream {
5757
/**
5858
* Creates a Base32InputStream such that all data read is Base32-decoded from the original provided InputStream.
5959
*
60-
* @param in
60+
* @param inputStream
6161
* InputStream to wrap.
6262
*/
63-
public Base32InputStream(final InputStream in) {
64-
this(in, false);
63+
public Base32InputStream(final InputStream inputStream) {
64+
this(inputStream, false);
6565
}
6666

6767
/**
6868
* Creates a Base32InputStream such that all data read is either Base32-encoded or Base32-decoded from the original
6969
* provided InputStream.
7070
*
71-
* @param in
71+
* @param inputStream
7272
* InputStream to wrap.
7373
* @param doEncode
7474
* true if we should encode all data read from us, false if we should decode.
7575
*/
76-
public Base32InputStream(final InputStream in, final boolean doEncode) {
77-
super(in, new Base32(false), doEncode);
76+
public Base32InputStream(final InputStream inputStream, final boolean doEncode) {
77+
super(inputStream, new Base32(false), doEncode);
7878
}
7979

8080
/**
8181
* Creates a Base32InputStream such that all data read is either Base32-encoded or Base32-decoded from the original
8282
* provided InputStream.
8383
*
84-
* @param input
84+
* @param inputStream
8585
* InputStream to wrap.
8686
* @param doEncode
8787
* true if we should encode all data read from us, false if we should decode.
@@ -93,16 +93,15 @@ public Base32InputStream(final InputStream in, final boolean doEncode) {
9393
* If doEncode is true, each line of encoded data will be terminated with this byte sequence (e.g. \r\n).
9494
* If lineLength &lt;= 0, the lineSeparator is not used. If doEncode is false lineSeparator is ignored.
9595
*/
96-
public Base32InputStream(final InputStream input, final boolean doEncode,
97-
final int lineLength, final byte[] lineSeparator) {
98-
super(input, new Base32(lineLength, lineSeparator), doEncode);
96+
public Base32InputStream(final InputStream inputStream, final boolean doEncode, final int lineLength, final byte[] lineSeparator) {
97+
super(inputStream, new Base32(lineLength, lineSeparator), doEncode);
9998
}
10099

101100
/**
102101
* Creates a Base32InputStream such that all data read is either Base32-encoded or Base32-decoded from the original
103102
* provided InputStream.
104103
*
105-
* @param input
104+
* @param inputStream
106105
* InputStream to wrap.
107106
* @param doEncode
108107
* true if we should encode all data read from us, false if we should decode.
@@ -117,9 +116,9 @@ public Base32InputStream(final InputStream input, final boolean doEncode,
117116
* The decoding policy.
118117
* @since 1.15
119118
*/
120-
public Base32InputStream(final InputStream input, final boolean doEncode,
121-
final int lineLength, final byte[] lineSeparator, final CodecPolicy decodingPolicy) {
122-
super(input, new Base32(lineLength, lineSeparator, false, BaseNCodec.PAD_DEFAULT, decodingPolicy), doEncode);
119+
public Base32InputStream(final InputStream inputStream, final boolean doEncode, final int lineLength, final byte[] lineSeparator,
120+
final CodecPolicy decodingPolicy) {
121+
super(inputStream, new Base32(lineLength, lineSeparator, false, BaseNCodec.PAD_DEFAULT, decodingPolicy), doEncode);
123122
}
124123

125124
}

src/main/java/org/apache/commons/codec/binary/Base32OutputStream.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,31 +61,31 @@ public class Base32OutputStream extends BaseNCodecOutputStream {
6161
/**
6262
* Creates a Base32OutputStream such that all data written is Base32-encoded to the original provided OutputStream.
6363
*
64-
* @param out
64+
* @param outputStream
6565
* OutputStream to wrap.
6666
*/
67-
public Base32OutputStream(final OutputStream out) {
68-
this(out, true);
67+
public Base32OutputStream(final OutputStream outputStream) {
68+
this(outputStream, true);
6969
}
7070

7171
/**
7272
* Creates a Base32OutputStream such that all data written is either Base32-encoded or Base32-decoded to the
7373
* original provided OutputStream.
7474
*
75-
* @param out
75+
* @param outputStream
7676
* OutputStream to wrap.
7777
* @param doEncode
7878
* true if we should encode all data written to us, false if we should decode.
7979
*/
80-
public Base32OutputStream(final OutputStream out, final boolean doEncode) {
81-
super(out, new Base32(false), doEncode);
80+
public Base32OutputStream(final OutputStream outputStream, final boolean doEncode) {
81+
super(outputStream, new Base32(false), doEncode);
8282
}
8383

8484
/**
8585
* Creates a Base32OutputStream such that all data written is either Base32-encoded or Base32-decoded to the
8686
* original provided OutputStream.
8787
*
88-
* @param output
88+
* @param outputStream
8989
* OutputStream to wrap.
9090
* @param doEncode
9191
* true if we should encode all data written to us, false if we should decode.
@@ -97,16 +97,15 @@ public Base32OutputStream(final OutputStream out, final boolean doEncode) {
9797
* If doEncode is true, each line of encoded data will be terminated with this byte sequence (e.g. \r\n).
9898
* If lineLength &lt;= 0, the lineSeparator is not used. If doEncode is false lineSeparator is ignored.
9999
*/
100-
public Base32OutputStream(final OutputStream output, final boolean doEncode,
101-
final int lineLength, final byte[] lineSeparator) {
102-
super(output, new Base32(lineLength, lineSeparator), doEncode);
100+
public Base32OutputStream(final OutputStream outputStream, final boolean doEncode, final int lineLength, final byte[] lineSeparator) {
101+
super(outputStream, new Base32(lineLength, lineSeparator), doEncode);
103102
}
104103

105104
/**
106105
* Creates a Base32OutputStream such that all data written is either Base32-encoded or Base32-decoded to the
107106
* original provided OutputStream.
108107
*
109-
* @param output
108+
* @param outputStream
110109
* OutputStream to wrap.
111110
* @param doEncode
112111
* true if we should encode all data written to us, false if we should decode.
@@ -120,9 +119,9 @@ public Base32OutputStream(final OutputStream output, final boolean doEncode,
120119
* @param decodingPolicy The decoding policy.
121120
* @since 1.15
122121
*/
123-
public Base32OutputStream(final OutputStream output, final boolean doEncode,
124-
final int lineLength, final byte[] lineSeparator, final CodecPolicy decodingPolicy) {
125-
super(output, new Base32(lineLength, lineSeparator, false, BaseNCodec.PAD_DEFAULT, decodingPolicy), doEncode);
122+
public Base32OutputStream(final OutputStream outputStream, final boolean doEncode, final int lineLength, final byte[] lineSeparator,
123+
final CodecPolicy decodingPolicy) {
124+
super(outputStream, new Base32(lineLength, lineSeparator, false, BaseNCodec.PAD_DEFAULT, decodingPolicy), doEncode);
126125
}
127126

128127
}

src/main/java/org/apache/commons/codec/binary/Base64.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,8 @@ public Base64(final int lineLength, final byte[] lineSeparator, final boolean ur
627627
* http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/util/
628628
* </p>
629629
*
630-
* @param in
631-
* byte[] array of ascii data to base64 decode.
630+
* @param input
631+
* byte[] array of ASCII data to base64 decode.
632632
* @param inPos
633633
* Position to start reading data from.
634634
* @param inAvail
@@ -637,7 +637,7 @@ public Base64(final int lineLength, final byte[] lineSeparator, final boolean ur
637637
* the context to be used
638638
*/
639639
@Override
640-
void decode(final byte[] in, int inPos, final int inAvail, final Context context) {
640+
void decode(final byte[] input, int inPos, final int inAvail, final Context context) {
641641
if (context.eof) {
642642
return;
643643
}
@@ -646,7 +646,7 @@ void decode(final byte[] in, int inPos, final int inAvail, final Context context
646646
}
647647
for (int i = 0; i < inAvail; i++) {
648648
final byte[] buffer = ensureBufferSize(decodeSize, context);
649-
final byte b = in[inPos++];
649+
final byte b = input[inPos++];
650650
if (b == pad) {
651651
// We're done.
652652
context.eof = true;

src/main/java/org/apache/commons/codec/binary/Base64InputStream.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,31 +61,31 @@ public class Base64InputStream extends BaseNCodecInputStream {
6161
/**
6262
* Creates a Base64InputStream such that all data read is Base64-decoded from the original provided InputStream.
6363
*
64-
* @param in
64+
* @param inputStream
6565
* InputStream to wrap.
6666
*/
67-
public Base64InputStream(final InputStream in) {
68-
this(in, false);
67+
public Base64InputStream(final InputStream inputStream) {
68+
this(inputStream, false);
6969
}
7070

7171
/**
7272
* Creates a Base64InputStream such that all data read is either Base64-encoded or Base64-decoded from the original
7373
* provided InputStream.
7474
*
75-
* @param in
75+
* @param inputStream
7676
* InputStream to wrap.
7777
* @param doEncode
7878
* true if we should encode all data read from us, false if we should decode.
7979
*/
80-
public Base64InputStream(final InputStream in, final boolean doEncode) {
81-
super(in, new Base64(false), doEncode);
80+
public Base64InputStream(final InputStream inputStream, final boolean doEncode) {
81+
super(inputStream, new Base64(false), doEncode);
8282
}
8383

8484
/**
8585
* Creates a Base64InputStream such that all data read is either Base64-encoded or Base64-decoded from the original
8686
* provided InputStream.
8787
*
88-
* @param in
88+
* @param inputStream
8989
* InputStream to wrap.
9090
* @param doEncode
9191
* true if we should encode all data read from us, false if we should decode.
@@ -97,16 +97,15 @@ public Base64InputStream(final InputStream in, final boolean doEncode) {
9797
* If doEncode is true, each line of encoded data will be terminated with this byte sequence (e.g. \r\n).
9898
* If lineLength &lt;= 0, the lineSeparator is not used. If doEncode is false lineSeparator is ignored.
9999
*/
100-
public Base64InputStream(final InputStream in, final boolean doEncode,
101-
final int lineLength, final byte[] lineSeparator) {
102-
super(in, new Base64(lineLength, lineSeparator), doEncode);
100+
public Base64InputStream(final InputStream inputStream, final boolean doEncode, final int lineLength, final byte[] lineSeparator) {
101+
super(inputStream, new Base64(lineLength, lineSeparator), doEncode);
103102
}
104103

105104
/**
106105
* Creates a Base64InputStream such that all data read is either Base64-encoded or Base64-decoded from the original
107106
* provided InputStream.
108107
*
109-
* @param in
108+
* @param inputStream
110109
* InputStream to wrap.
111110
* @param doEncode
112111
* true if we should encode all data read from us, false if we should decode.
@@ -120,8 +119,8 @@ public Base64InputStream(final InputStream in, final boolean doEncode,
120119
* @param decodingPolicy The decoding policy.
121120
* @since 1.15
122121
*/
123-
public Base64InputStream(final InputStream in, final boolean doEncode,
124-
final int lineLength, final byte[] lineSeparator, final CodecPolicy decodingPolicy) {
125-
super(in, new Base64(lineLength, lineSeparator, false, decodingPolicy), doEncode);
122+
public Base64InputStream(final InputStream inputStream, final boolean doEncode, final int lineLength, final byte[] lineSeparator,
123+
final CodecPolicy decodingPolicy) {
124+
super(inputStream, new Base64(lineLength, lineSeparator, false, decodingPolicy), doEncode);
126125
}
127126
}

0 commit comments

Comments
 (0)