View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   https://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.commons.compress.utils;
20  
21  import java.io.InputStream;
22  import java.util.zip.CRC32;
23  
24  /**
25   * A stream that verifies the CRC of the data read once the stream is exhausted.
26   *
27   * @NotThreadSafe
28   * @since 1.6
29   * @deprecated Use {@link org.apache.commons.io.input.ChecksumInputStream}.
30   */
31  @Deprecated
32  public class CRC32VerifyingInputStream extends ChecksumVerifyingInputStream {
33      /**
34       * Constructs a new instance.
35       *
36       * @param in            the stream to wrap
37       * @param size          the of the stream's content
38       * @param expectedCrc32 the expected checksum
39       * @deprecated No longer used.
40       */
41      @Deprecated
42      public CRC32VerifyingInputStream(final InputStream in, final long size, final int expectedCrc32) {
43          this(in, size, expectedCrc32 & 0xFFFFffffL);
44      }
45  
46      /**
47       * Constructs a new instance.
48       *
49       * @param in            the stream to wrap
50       * @param size          the of the stream's content
51       * @param expectedCrc32 the expected checksum
52       * @since 1.7
53       */
54      public CRC32VerifyingInputStream(final InputStream in, final long size, final long expectedCrc32) {
55          super(new CRC32(), in, size, expectedCrc32);
56      }
57  
58  }