AlgorithmParameterGenerator.java, [...]: Import cleanup.
2004-10-21 Michael Koch <konqueror@gmx.de> * java/security/AlgorithmParameterGenerator.java, java/security/AlgorithmParameters.java, java/security/AlgorithmParametersSpi.java, java/security/AllPermission.java, java/security/BasicPermission.java, java/security/Certificate.java, java/security/CodeSource.java, java/security/DigestInputStream.java, java/security/DigestOutputStream.java, java/security/GuardedObject.java, java/security/KeyFactory.java, java/security/KeyFactorySpi.java, java/security/KeyPairGenerator.java, java/security/KeyStore.java, java/security/KeyStoreSpi.java, java/security/Permissions.java, java/security/Security.java, java/security/Signature.java, java/security/UnresolvedPermission.java, java/security/cert/CertPathBuilder.java, java/security/cert/CertPathValidator.java, java/security/cert/CertStore.java, java/security/cert/Certificate.java, java/security/cert/CertificateFactory.java, java/security/cert/PolicyQualifierInfo.java, java/security/cert/TrustAnchor.java, java/security/cert/X509CRL.java, java/security/cert/X509CRLSelector.java, java/security/cert/X509CertSelector.java: Import cleanup. From-SVN: r89397
This commit is contained in:
parent
02db0fc1ce
commit
78fe42c391
30 changed files with 500 additions and 453 deletions
|
@ -1,5 +1,5 @@
|
|||
/* DigestInputStream.java --- An Input stream tied to a message digest
|
||||
Copyright (C) 1999, 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2003, 2004 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -35,28 +35,29 @@ this exception to your version of the library, but you are not
|
|||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.security;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.FilterInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
DigestInputStream is a class that ties an InputStream with a
|
||||
MessageDigest. The Message Digest is used by the class to
|
||||
update it self as bytes are read from the InputStream.
|
||||
|
||||
The updating to the digest depends on the on flag which is set
|
||||
to true by default to tell the class to update the data
|
||||
in the message digest.
|
||||
|
||||
@version 0.0
|
||||
@author Mark Benvenuto <ivymccough@worldnet.att.net>
|
||||
* DigestInputStream is a class that ties an InputStream with a
|
||||
* MessageDigest. The Message Digest is used by the class to
|
||||
* update it self as bytes are read from the InputStream.
|
||||
*
|
||||
* The updating to the digest depends on the on flag which is set
|
||||
* to true by default to tell the class to update the data
|
||||
* in the message digest.
|
||||
*
|
||||
* @version 0.0
|
||||
* @author Mark Benvenuto <ivymccough@worldnet.att.net>
|
||||
*/
|
||||
public class DigestInputStream extends FilterInputStream
|
||||
{
|
||||
/**
|
||||
The message digest for the DigestInputStream
|
||||
* The message digest for the DigestInputStream
|
||||
*/
|
||||
protected MessageDigest digest;
|
||||
|
||||
|
@ -64,12 +65,12 @@ public class DigestInputStream extends FilterInputStream
|
|||
private boolean state = true;
|
||||
|
||||
/**
|
||||
Constructs a new DigestInputStream.
|
||||
It associates a MessageDigest with the stream to
|
||||
compute the stream as data is written.
|
||||
|
||||
@param stream An InputStream to associate this stream with
|
||||
@param digest A MessageDigest to hash the stream with
|
||||
* Constructs a new DigestInputStream.
|
||||
* It associates a MessageDigest with the stream to
|
||||
* compute the stream as data is written.
|
||||
*
|
||||
* @param stream An InputStream to associate this stream with
|
||||
* @param digest A MessageDigest to hash the stream with
|
||||
*/
|
||||
public DigestInputStream(InputStream stream, MessageDigest digest)
|
||||
{
|
||||
|
@ -79,9 +80,9 @@ public class DigestInputStream extends FilterInputStream
|
|||
}
|
||||
|
||||
/**
|
||||
Returns the MessageDigest associated with this DigestInputStream
|
||||
|
||||
@return The MessageDigest used to hash this stream
|
||||
* Returns the MessageDigest associated with this DigestInputStream
|
||||
*
|
||||
* @return The MessageDigest used to hash this stream
|
||||
*/
|
||||
public MessageDigest getMessageDigest()
|
||||
{
|
||||
|
@ -89,9 +90,9 @@ public class DigestInputStream extends FilterInputStream
|
|||
}
|
||||
|
||||
/**
|
||||
Sets the current MessageDigest to current parameter
|
||||
|
||||
@param digest A MessageDigest to associate with this stream
|
||||
* Sets the current MessageDigest to current parameter
|
||||
*
|
||||
* @param digest A MessageDigest to associate with this stream
|
||||
*/
|
||||
public void setMessageDigest(MessageDigest digest)
|
||||
{
|
||||
|
@ -99,15 +100,15 @@ public class DigestInputStream extends FilterInputStream
|
|||
}
|
||||
|
||||
/**
|
||||
Reads a byte from the input stream and updates the digest.
|
||||
This method reads the underlying input stream and if the
|
||||
on flag is true then updates the message digest.
|
||||
|
||||
@return Returns a byte from the input stream, -1 is returned to indicate that
|
||||
the end of stream was reached before this read call
|
||||
|
||||
@throws IOException if an IO error occurs in the underlying input stream,
|
||||
this error is thrown
|
||||
* Reads a byte from the input stream and updates the digest.
|
||||
* This method reads the underlying input stream and if the
|
||||
* on flag is true then updates the message digest.
|
||||
*
|
||||
* @return Returns a byte from the input stream, -1 is returned to indicate that
|
||||
* the end of stream was reached before this read call
|
||||
*
|
||||
* @throws IOException if an IO error occurs in the underlying input stream,
|
||||
* this error is thrown
|
||||
*/
|
||||
public int read() throws IOException
|
||||
{
|
||||
|
@ -120,18 +121,18 @@ public class DigestInputStream extends FilterInputStream
|
|||
}
|
||||
|
||||
/**
|
||||
Reads bytes from the input stream and updates the digest.
|
||||
This method reads the underlying input stream and if the
|
||||
on flag is true then updates the message digest.
|
||||
|
||||
@param b a byte array to store the data from the input stream
|
||||
@param off an offset to start at in the array
|
||||
@param len length of data to read
|
||||
@return Returns count of bytes read, -1 is returned to indicate that
|
||||
the end of stream was reached before this read call
|
||||
|
||||
@throws IOException if an IO error occurs in the underlying input stream,
|
||||
this error is thrown
|
||||
* Reads bytes from the input stream and updates the digest.
|
||||
* This method reads the underlying input stream and if the
|
||||
* on flag is true then updates the message digest.
|
||||
*
|
||||
* @param b a byte array to store the data from the input stream
|
||||
* @param off an offset to start at in the array
|
||||
* @param len length of data to read
|
||||
* @return Returns count of bytes read, -1 is returned to indicate that
|
||||
* the end of stream was reached before this read call
|
||||
*
|
||||
* @throws IOException if an IO error occurs in the underlying input stream,
|
||||
* this error is thrown
|
||||
*/
|
||||
public int read(byte[]b, int off, int len) throws IOException
|
||||
{
|
||||
|
@ -144,10 +145,10 @@ public class DigestInputStream extends FilterInputStream
|
|||
}
|
||||
|
||||
/**
|
||||
Sets the flag specifing if this DigestInputStream updates the
|
||||
digest in the write() methods. The default is on;
|
||||
|
||||
@param on True means it digests stream, false means it does not
|
||||
* Sets the flag specifing if this DigestInputStream updates the
|
||||
* digest in the write() methods. The default is on;
|
||||
*
|
||||
* @param on True means it digests stream, false means it does not
|
||||
*/
|
||||
public void on(boolean on)
|
||||
{
|
||||
|
@ -155,9 +156,9 @@ public class DigestInputStream extends FilterInputStream
|
|||
}
|
||||
|
||||
/**
|
||||
Converts the input stream and underlying message digest to a string.
|
||||
|
||||
@return A string representing the input stream and message digest.
|
||||
* Converts the input stream and underlying message digest to a string.
|
||||
*
|
||||
* @return A string representing the input stream and message digest.
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue