1 /* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 package com.ohos.hapsigntool.zip; 17 18 import java.io.IOException; 19 import java.nio.ByteBuffer; 20 21 /** 22 * ZipDataOutput interface 23 * 24 * @since 2021/12/20 25 */ 26 public interface ZipDataOutput { 27 /** 28 * Write data into this ZipDataOutput 29 * 30 * @param buffer data bytes 31 * @param offset offset index of data bytes 32 * @param length the number of bytes to use, starting at offset index 33 * @throws IOException when IO error occurred 34 */ write(byte[] buffer, int offset, int length)35 void write(byte[] buffer, int offset, int length) throws IOException; 36 37 /** 38 * Write all remaining data in the ByteBuffer into this ZipDataOutput 39 * 40 * @param buffer data bytes 41 * @throws IOException when IO error occurred 42 */ write(ByteBuffer buffer)43 void write(ByteBuffer buffer) throws IOException; 44 } 45