22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package java.util.zip;
27
28 import java.nio.ByteBuffer;
29 import sun.nio.ch.DirectBuffer;
30
31 import jdk.internal.HotSpotIntrinsicCandidate;
32
33 /**
34 * A class that can be used to compute the Adler-32 checksum of a data
35 * stream. An Adler-32 checksum is almost as reliable as a CRC-32 but
36 * can be computed much faster.
37 *
38 * <p> Passing a {@code null} argument to a method in this class will cause
39 * a {@link NullPointerException} to be thrown.</p>
40 *
41 * @author David Connelly
42 */
43 public
44 class Adler32 implements Checksum {
45
46 private int adler = 1;
47
48 /**
49 * Creates a new Adler32 object.
50 */
51 public Adler32() {
52 }
53
54 /**
55 * Updates the checksum with the specified byte (the low eight
56 * bits of the argument b).
57 */
58 @Override
59 public void update(int b) {
60 adler = update(adler, b);
61 }
|
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package java.util.zip;
27
28 import java.nio.ByteBuffer;
29 import sun.nio.ch.DirectBuffer;
30
31 import jdk.internal.HotSpotIntrinsicCandidate;
32
33 /**
34 * A class that can be used to compute the Adler-32 checksum of a data
35 * stream. An Adler-32 checksum is almost as reliable as a CRC-32 but
36 * can be computed much faster.
37 *
38 * <p> Passing a {@code null} argument to a method in this class will cause
39 * a {@link NullPointerException} to be thrown.</p>
40 *
41 * @author David Connelly
42 * @since 1.1
43 */
44 public
45 class Adler32 implements Checksum {
46
47 private int adler = 1;
48
49 /**
50 * Creates a new Adler32 object.
51 */
52 public Adler32() {
53 }
54
55 /**
56 * Updates the checksum with the specified byte (the low eight
57 * bits of the argument b).
58 */
59 @Override
60 public void update(int b) {
61 adler = update(adler, b);
62 }
|