CRC32VerifyingInputStream.java

  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. import java.io.InputStream;
  21. import java.util.zip.CRC32;

  22. /**
  23.  * A stream that verifies the CRC of the data read once the stream is exhausted.
  24.  *
  25.  * @NotThreadSafe
  26.  * @since 1.6
  27.  * @deprecated Use {@link org.apache.commons.io.input.ChecksumInputStream}.
  28.  */
  29. @Deprecated
  30. public class CRC32VerifyingInputStream extends ChecksumVerifyingInputStream {
  31.     /**
  32.      * Constructs a new instance.
  33.      *
  34.      * @param in            the stream to wrap
  35.      * @param size          the of the stream's content
  36.      * @param expectedCrc32 the expected checksum
  37.      * @deprecated No longer used.
  38.      */
  39.     @Deprecated
  40.     public CRC32VerifyingInputStream(final InputStream in, final long size, final int expectedCrc32) {
  41.         this(in, size, expectedCrc32 & 0xFFFFffffL);
  42.     }

  43.     /**
  44.      * Constructs a new instance.
  45.      *
  46.      * @param in            the stream to wrap
  47.      * @param size          the of the stream's content
  48.      * @param expectedCrc32 the expected checksum
  49.      * @since 1.7
  50.      */
  51.     public CRC32VerifyingInputStream(final InputStream in, final long size, final long expectedCrc32) {
  52.         super(new CRC32(), in, size, expectedCrc32);
  53.     }

  54. }