src/share/classes/java/util/zip/Adler32.java

Print this page




  45     private int adler = 1;
  46 
  47     /**
  48      * Creates a new Adler32 object.
  49      */
  50     public Adler32() {
  51     }
  52 
  53     /**
  54      * Updates the checksum with the specified byte (the low eight
  55      * bits of the argument b).
  56      *
  57      * @param b the byte to update the checksum with
  58      */
  59     public void update(int b) {
  60         adler = update(adler, b);
  61     }
  62 
  63     /**
  64      * Updates the checksum with the specified array of bytes.





  65      */
  66     public void update(byte[] b, int off, int len) {
  67         if (b == null) {
  68             throw new NullPointerException();
  69         }
  70         if (off < 0 || len < 0 || off > b.length - len) {
  71             throw new ArrayIndexOutOfBoundsException();
  72         }
  73         adler = updateBytes(adler, b, off, len);
  74     }
  75 
  76     /**
  77      * Updates the checksum with the specified array of bytes.
  78      *
  79      * @param b the byte array to update the checksum with
  80      */
  81     public void update(byte[] b) {
  82         adler = updateBytes(adler, b, 0, b.length);
  83     }
  84 




  45     private int adler = 1;
  46 
  47     /**
  48      * Creates a new Adler32 object.
  49      */
  50     public Adler32() {
  51     }
  52 
  53     /**
  54      * Updates the checksum with the specified byte (the low eight
  55      * bits of the argument b).
  56      *
  57      * @param b the byte to update the checksum with
  58      */
  59     public void update(int b) {
  60         adler = update(adler, b);
  61     }
  62 
  63     /**
  64      * Updates the checksum with the specified array of bytes.
  65      *
  66      * @throws  ArrayIndexOutOfBoundsException
  67      *          if {@code off} is negative, or {@code len} is negative,
  68      *          or {@code off+len} is greater than the length of the
  69      *          array {@code b}
  70      */
  71     public void update(byte[] b, int off, int len) {
  72         if (b == null) {
  73             throw new NullPointerException();
  74         }
  75         if (off < 0 || len < 0 || off > b.length - len) {
  76             throw new ArrayIndexOutOfBoundsException();
  77         }
  78         adler = updateBytes(adler, b, off, len);
  79     }
  80 
  81     /**
  82      * Updates the checksum with the specified array of bytes.
  83      *
  84      * @param b the byte array to update the checksum with
  85      */
  86     public void update(byte[] b) {
  87         adler = updateBytes(adler, b, 0, b.length);
  88     }
  89