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

Print this page




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





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




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