1 /* 2 * Copyright 2022 Google LLC 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 package com.google.android.libraries.mobiledatadownload.file.common; 17 18 /** 19 * A ParamComputer updates the fragment param value in order to encode state in the URI fragment 20 * based on the content of the stream. The primary use case for this is checksum. 21 */ 22 public interface ParamComputer { 23 24 /** ParamComputer callback, to be invoked exactly once when the computed param value is ready. */ 25 interface Callback { onParamValueComputed(Fragment.ParamValue value)26 void onParamValueComputed(Fragment.ParamValue value); 27 } 28 29 /** 30 * Sets a callback which is invoked when the computed URI is available (eg, end of stream). 31 * 32 * <p>NOTE: Must invoke callback exactly once. 33 */ setCallback(Callback callback)34 void setCallback(Callback callback); 35 } 36