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 2020/05/04 20:20:43 UTC
[commons-io] branch master updated: Javadoc and normalize param
names. Line-lengths to 120.
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-io.git
The following commit(s) were added to refs/heads/master by this push:
new ee664f0 Javadoc and normalize param names. Line-lengths to 120.
ee664f0 is described below
commit ee664f09a49428a39bdc4fb9d891cb4e340f7767
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon May 4 16:20:38 2020 -0400
Javadoc and normalize param names. Line-lengths to 120.
---
.../input/MessageDigestCalculatingInputStream.java | 61 ++++++++++++----------
.../commons/io/input/ObservableInputStream.java | 3 ++
2 files changed, 37 insertions(+), 27 deletions(-)
diff --git a/src/main/java/org/apache/commons/io/input/MessageDigestCalculatingInputStream.java b/src/main/java/org/apache/commons/io/input/MessageDigestCalculatingInputStream.java
index 6d57dad..ce2b773 100644
--- a/src/main/java/org/apache/commons/io/input/MessageDigestCalculatingInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/MessageDigestCalculatingInputStream.java
@@ -35,24 +35,24 @@ public class MessageDigestCalculatingInputStream extends ObservableInputStream {
* Maintains the message digest.
*/
public static class MessageDigestMaintainingObserver extends Observer {
- private final MessageDigest md;
+ private final MessageDigest messageDigest;
/**
* Creates an MessageDigestMaintainingObserver for the given MessageDigest.
- * @param pMd the message digest to use
+ * @param messageDigest the message digest to use
*/
- public MessageDigestMaintainingObserver(final MessageDigest pMd) {
- md = pMd;
+ public MessageDigestMaintainingObserver(final MessageDigest messageDigest) {
+ this.messageDigest = messageDigest;
}
@Override
- public void data(final int pByte) throws IOException {
- md.update((byte) pByte);
+ public void data(final int input) throws IOException {
+ messageDigest.update((byte) input);
}
@Override
- public void data(final byte[] pBuffer, final int pOffset, final int pLength) throws IOException {
- md.update(pBuffer, pOffset, pLength);
+ public void data(final byte[] input, final int offset, final int length) throws IOException {
+ messageDigest.update(input, offset, length);
}
}
@@ -60,32 +60,39 @@ public class MessageDigestCalculatingInputStream extends ObservableInputStream {
/** Creates a new instance, which calculates a signature on the given stream,
* using the given {@link MessageDigest}.
- * @param pStream the stream to calculate the message digest for
- * @param pDigest the message digest to use
+ * @param inputStream the stream to calculate the message digest for
+ * @param MessageDigest the message digest to use
*/
- public MessageDigestCalculatingInputStream(final InputStream pStream, final MessageDigest pDigest) {
- super(pStream);
- messageDigest = pDigest;
- add(new MessageDigestMaintainingObserver(pDigest));
+ public MessageDigestCalculatingInputStream(final InputStream inputStream, final MessageDigest MessageDigest) {
+ super(inputStream);
+ this.messageDigest = MessageDigest;
+ add(new MessageDigestMaintainingObserver(MessageDigest));
}
- /** Creates a new instance, which calculates a signature on the given stream,
- * using a {@link MessageDigest} with the given algorithm.
- * @param pStream the stream to calculate the message digest for
- * @param pAlgorithm the name of the algorithm to use
- * @throws NoSuchAlgorithmException if no Provider supports a MessageDigestSpi implementation for the specified algorithm.
+ /**
+ * Creates a new instance, which calculates a signature on the given stream, using a {@link MessageDigest} with the
+ * given algorithm.
+ *
+ * @param inputStream the stream to calculate the message digest for
+ * @param algorithm the name of the algorithm to use
+ * @throws NoSuchAlgorithmException if no Provider supports a MessageDigestSpi implementation for the specified
+ * algorithm.
*/
- public MessageDigestCalculatingInputStream(final InputStream pStream, final String pAlgorithm) throws NoSuchAlgorithmException {
- this(pStream, MessageDigest.getInstance(pAlgorithm));
+ public MessageDigestCalculatingInputStream(final InputStream inputStream, final String algorithm)
+ throws NoSuchAlgorithmException {
+ this(inputStream, MessageDigest.getInstance(algorithm));
}
- /** Creates a new instance, which calculates a signature on the given stream,
- * using a {@link MessageDigest} with the "MD5" algorithm.
- * @param pStream the stream to calculate the message digest for
- * @throws NoSuchAlgorithmException if no Provider supports a MessageDigestSpi implementation for the specified algorithm.
+ /**
+ * Creates a new instance, which calculates a signature on the given stream, using a {@link MessageDigest} with the
+ * "MD5" algorithm.
+ *
+ * @param inputStream the stream to calculate the message digest for
+ * @throws NoSuchAlgorithmException if no Provider supports a MessageDigestSpi implementation for the specified
+ * algorithm.
*/
- public MessageDigestCalculatingInputStream(final InputStream pStream) throws NoSuchAlgorithmException {
- this(pStream, MessageDigest.getInstance("MD5"));
+ public MessageDigestCalculatingInputStream(final InputStream inputStream) throws NoSuchAlgorithmException {
+ this(inputStream, MessageDigest.getInstance("MD5"));
}
/** Returns the {@link MessageDigest}, which is being used for generating the
diff --git a/src/main/java/org/apache/commons/io/input/ObservableInputStream.java b/src/main/java/org/apache/commons/io/input/ObservableInputStream.java
index ece74ad..c2aaf47 100644
--- a/src/main/java/org/apache/commons/io/input/ObservableInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/ObservableInputStream.java
@@ -38,6 +38,9 @@ import org.apache.commons.io.IOUtils;
*/
public class ObservableInputStream extends ProxyInputStream {
+ /**
+ * Abstracts observer callback for {@code ObservableInputStream}s.
+ */
public static abstract class Observer {
/** Called to indicate, that {@link InputStream#read()} has been invoked