diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-09 19:58:05 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-09 19:58:05 +0000 |
commit | 65bf3316cf384588453604be6b4f0ed3751a8b0f (patch) | |
tree | 996a5f57d4a68c53473382e45cb22f574cb3e4db /libjava/classpath/java/security/MessageDigestSpi.java | |
parent | 8fc56618a84446beccd45b80381cdfe0e94050df (diff) | |
download | ppe42-gcc-65bf3316cf384588453604be6b4f0ed3751a8b0f.tar.gz ppe42-gcc-65bf3316cf384588453604be6b4f0ed3751a8b0f.zip |
Merged gcj-eclipse branch to trunk.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120621 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/java/security/MessageDigestSpi.java')
-rw-r--r-- | libjava/classpath/java/security/MessageDigestSpi.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libjava/classpath/java/security/MessageDigestSpi.java b/libjava/classpath/java/security/MessageDigestSpi.java index df3bd3ead02..6615b1d93b0 100644 --- a/libjava/classpath/java/security/MessageDigestSpi.java +++ b/libjava/classpath/java/security/MessageDigestSpi.java @@ -37,6 +37,8 @@ exception statement from your version. */ package java.security; +import java.nio.ByteBuffer; + /** This is the Service Provider Interface (SPI) for MessageDigest class in java.security. It provides the back end functionality @@ -98,6 +100,23 @@ public abstract class MessageDigestSpi protected abstract void engineUpdate(byte[]input, int offset, int len); /** + * Updates this digest with the remaining bytes of a byte buffer. + * + * @param input The input buffer. + * @since 1.5 + */ + protected void engineUpdate (ByteBuffer input) + { + byte[] buf = new byte[1024]; + while (input.hasRemaining()) + { + int n = Math.min(input.remaining(), buf.length); + input.get (buf, 0, n); + engineUpdate (buf, 0, n); + } + } + + /** Computes the final digest of the stored bytes and returns them. It performs any necessary padding. The message digest should reset sensitive data after performing the digest. |