001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * https://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.commons.compress.utils; 020 021import java.io.InputStream; 022import java.util.Objects; 023import java.util.zip.CheckedInputStream; 024import java.util.zip.Checksum; 025 026/** 027 * Calculates the checksum of the data read. 028 * 029 * @NotThreadSafe 030 * @since 1.14 031 * @deprecated Use {@link CheckedInputStream}. 032 */ 033@Deprecated 034public class ChecksumCalculatingInputStream extends CheckedInputStream { 035 036 /** 037 * Constructs a new instance. 038 * 039 * @param checksum The checksum to update 040 * @param inputStream The input stream to read. 041 * @deprecated Use {@link CheckedInputStream#CheckedInputStream(InputStream, Checksum)}. 042 */ 043 @Deprecated 044 @SuppressWarnings("resource") 045 public ChecksumCalculatingInputStream(final Checksum checksum, final InputStream inputStream) { 046 super(Objects.requireNonNull(inputStream, "inputStream"), Objects.requireNonNull(checksum, "checksum")); 047 } 048 049 /** 050 * Returns the calculated checksum. 051 * 052 * @return the calculated checksum. 053 * @deprecated Use {@link CheckedInputStream#getChecksum()} and {@link Checksum#getValue()}. 054 */ 055 @Deprecated 056 public long getValue() { 057 return getChecksum().getValue(); 058 } 059 060}