emul/mini/src/main/java/java/util/zip/Checksum.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 07 Feb 2013 12:58:12 +0100
branchemul
changeset 694 0d277415ed02
permissions -rw-r--r--
Rebasing the Inflater support on jzlib which, unlike GNU ClassPath, has correct implementation of Huffman code. Making the implementation more easily testable by turning Inflater and ZipInputStream into pure delegates. Current implementation is going to need proper long support.
jaroslav@609
     1
/*
jaroslav@609
     2
 * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
jaroslav@609
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jaroslav@609
     4
 *
jaroslav@609
     5
 * This code is free software; you can redistribute it and/or modify it
jaroslav@609
     6
 * under the terms of the GNU General Public License version 2 only, as
jaroslav@609
     7
 * published by the Free Software Foundation.  Oracle designates this
jaroslav@609
     8
 * particular file as subject to the "Classpath" exception as provided
jaroslav@609
     9
 * by Oracle in the LICENSE file that accompanied this code.
jaroslav@609
    10
 *
jaroslav@609
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
jaroslav@609
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jaroslav@609
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
jaroslav@609
    14
 * version 2 for more details (a copy is included in the LICENSE file that
jaroslav@609
    15
 * accompanied this code).
jaroslav@609
    16
 *
jaroslav@609
    17
 * You should have received a copy of the GNU General Public License version
jaroslav@609
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
jaroslav@609
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jaroslav@609
    20
 *
jaroslav@609
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jaroslav@609
    22
 * or visit www.oracle.com if you need additional information or have any
jaroslav@609
    23
 * questions.
jaroslav@609
    24
 */
jaroslav@609
    25
jaroslav@609
    26
package java.util.zip;
jaroslav@609
    27
jaroslav@609
    28
/**
jaroslav@609
    29
 * An interface representing a data checksum.
jaroslav@609
    30
 *
jaroslav@609
    31
 * @author      David Connelly
jaroslav@609
    32
 */
jaroslav@609
    33
public
jaroslav@609
    34
interface Checksum {
jaroslav@609
    35
    /**
jaroslav@609
    36
     * Updates the current checksum with the specified byte.
jaroslav@609
    37
     *
jaroslav@609
    38
     * @param b the byte to update the checksum with
jaroslav@609
    39
     */
jaroslav@609
    40
    public void update(int b);
jaroslav@609
    41
jaroslav@609
    42
    /**
jaroslav@609
    43
     * Updates the current checksum with the specified array of bytes.
jaroslav@609
    44
     * @param b the byte array to update the checksum with
jaroslav@609
    45
     * @param off the start offset of the data
jaroslav@609
    46
     * @param len the number of bytes to use for the update
jaroslav@609
    47
     */
jaroslav@609
    48
    public void update(byte[] b, int off, int len);
jaroslav@609
    49
jaroslav@609
    50
    /**
jaroslav@609
    51
     * Returns the current checksum value.
jaroslav@609
    52
     * @return the current checksum value
jaroslav@609
    53
     */
jaroslav@609
    54
    public long getValue();
jaroslav@609
    55
jaroslav@609
    56
    /**
jaroslav@609
    57
     * Resets the checksum to its initial value.
jaroslav@609
    58
     */
jaroslav@609
    59
    public void reset();
jaroslav@609
    60
}