1/* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.util.apk; 18 19import java.io.IOException; 20import java.security.DigestException; 21 22/** Source of data to be digested. */ 23interface DataSource { 24 25 /** 26 * Returns the size (in bytes) of the data offered by this source. 27 */ 28 long size(); 29 30 /** 31 * Feeds the specified region of this source's data into the provided digester. 32 * 33 * @param offset offset of the region inside this data source. 34 * @param size size (in bytes) of the region. 35 */ 36 void feedIntoDataDigester(DataDigester md, long offset, int size) 37 throws IOException, DigestException; 38} 39