diff options
author | Tom Tromey <tromey@gcc.gnu.org> | 2007-01-09 19:58:05 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2007-01-09 19:58:05 +0000 |
commit | 97b8365cafc3a344a22d3980b8ed885f5c6d8357 (patch) | |
tree | 996a5f57d4a68c53473382e45cb22f574cb3e4db /libjava/classpath/java/security/MessageDigestSpi.java | |
parent | c648dedbde727ca3f883bb5fd773aa4af70d3369 (diff) | |
download | gcc-97b8365cafc3a344a22d3980b8ed885f5c6d8357.zip gcc-97b8365cafc3a344a22d3980b8ed885f5c6d8357.tar.gz gcc-97b8365cafc3a344a22d3980b8ed885f5c6d8357.tar.bz2 |
Merged gcj-eclipse branch to trunk.
From-SVN: r120621
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 df3bd3e..6615b1d 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. |