Skip to content

Commit ee664f0

Browse files
committed
Javadoc and normalize param names. Line-lengths to 120.
1 parent c14b996 commit ee664f0

2 files changed

Lines changed: 37 additions & 27 deletions

File tree

src/main/java/org/apache/commons/io/input/MessageDigestCalculatingInputStream.java

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,57 +35,64 @@ public class MessageDigestCalculatingInputStream extends ObservableInputStream {
3535
* Maintains the message digest.
3636
*/
3737
public static class MessageDigestMaintainingObserver extends Observer {
38-
private final MessageDigest md;
38+
private final MessageDigest messageDigest;
3939

4040
/**
4141
* Creates an MessageDigestMaintainingObserver for the given MessageDigest.
42-
* @param pMd the message digest to use
42+
* @param messageDigest the message digest to use
4343
*/
44-
public MessageDigestMaintainingObserver(final MessageDigest pMd) {
45-
md = pMd;
44+
public MessageDigestMaintainingObserver(final MessageDigest messageDigest) {
45+
this.messageDigest = messageDigest;
4646
}
4747

4848
@Override
49-
public void data(final int pByte) throws IOException {
50-
md.update((byte) pByte);
49+
public void data(final int input) throws IOException {
50+
messageDigest.update((byte) input);
5151
}
5252

5353
@Override
54-
public void data(final byte[] pBuffer, final int pOffset, final int pLength) throws IOException {
55-
md.update(pBuffer, pOffset, pLength);
54+
public void data(final byte[] input, final int offset, final int length) throws IOException {
55+
messageDigest.update(input, offset, length);
5656
}
5757
}
5858

5959
private final MessageDigest messageDigest;
6060

6161
/** Creates a new instance, which calculates a signature on the given stream,
6262
* using the given {@link MessageDigest}.
63-
* @param pStream the stream to calculate the message digest for
64-
* @param pDigest the message digest to use
63+
* @param inputStream the stream to calculate the message digest for
64+
* @param MessageDigest the message digest to use
6565
*/
66-
public MessageDigestCalculatingInputStream(final InputStream pStream, final MessageDigest pDigest) {
67-
super(pStream);
68-
messageDigest = pDigest;
69-
add(new MessageDigestMaintainingObserver(pDigest));
66+
public MessageDigestCalculatingInputStream(final InputStream inputStream, final MessageDigest MessageDigest) {
67+
super(inputStream);
68+
this.messageDigest = MessageDigest;
69+
add(new MessageDigestMaintainingObserver(MessageDigest));
7070
}
7171

72-
/** Creates a new instance, which calculates a signature on the given stream,
73-
* using a {@link MessageDigest} with the given algorithm.
74-
* @param pStream the stream to calculate the message digest for
75-
* @param pAlgorithm the name of the algorithm to use
76-
* @throws NoSuchAlgorithmException if no Provider supports a MessageDigestSpi implementation for the specified algorithm.
72+
/**
73+
* Creates a new instance, which calculates a signature on the given stream, using a {@link MessageDigest} with the
74+
* given algorithm.
75+
*
76+
* @param inputStream the stream to calculate the message digest for
77+
* @param algorithm the name of the algorithm to use
78+
* @throws NoSuchAlgorithmException if no Provider supports a MessageDigestSpi implementation for the specified
79+
* algorithm.
7780
*/
78-
public MessageDigestCalculatingInputStream(final InputStream pStream, final String pAlgorithm) throws NoSuchAlgorithmException {
79-
this(pStream, MessageDigest.getInstance(pAlgorithm));
81+
public MessageDigestCalculatingInputStream(final InputStream inputStream, final String algorithm)
82+
throws NoSuchAlgorithmException {
83+
this(inputStream, MessageDigest.getInstance(algorithm));
8084
}
8185

82-
/** Creates a new instance, which calculates a signature on the given stream,
83-
* using a {@link MessageDigest} with the "MD5" algorithm.
84-
* @param pStream the stream to calculate the message digest for
85-
* @throws NoSuchAlgorithmException if no Provider supports a MessageDigestSpi implementation for the specified algorithm.
86+
/**
87+
* Creates a new instance, which calculates a signature on the given stream, using a {@link MessageDigest} with the
88+
* "MD5" algorithm.
89+
*
90+
* @param inputStream the stream to calculate the message digest for
91+
* @throws NoSuchAlgorithmException if no Provider supports a MessageDigestSpi implementation for the specified
92+
* algorithm.
8693
*/
87-
public MessageDigestCalculatingInputStream(final InputStream pStream) throws NoSuchAlgorithmException {
88-
this(pStream, MessageDigest.getInstance("MD5"));
94+
public MessageDigestCalculatingInputStream(final InputStream inputStream) throws NoSuchAlgorithmException {
95+
this(inputStream, MessageDigest.getInstance("MD5"));
8996
}
9097

9198
/** Returns the {@link MessageDigest}, which is being used for generating the

src/main/java/org/apache/commons/io/input/ObservableInputStream.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
*/
3939
public class ObservableInputStream extends ProxyInputStream {
4040

41+
/**
42+
* Abstracts observer callback for {@code ObservableInputStream}s.
43+
*/
4144
public static abstract class Observer {
4245

4346
/** Called to indicate, that {@link InputStream#read()} has been invoked

0 commit comments

Comments
 (0)