2 * Licensed to the Apache Software Foundation (ASF) under one or more
\r
3 * contributor license agreements. See the NOTICE file distributed with
\r
4 * this work for additional information regarding copyright ownership.
\r
5 * The ASF licenses this file to You under the Apache License, Version 2.0
\r
6 * (the "License"); you may not use this file except in compliance with
\r
7 * the License. You may obtain a copy of the License at
\r
9 * http://www.apache.org/licenses/LICENSE-2.0
\r
11 * Unless required by applicable law or agreed to in writing, software
\r
12 * distributed under the License is distributed on an "AS IS" BASIS,
\r
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 * See the License for the specific language governing permissions and
\r
15 * limitations under the License.
\r
19 package org.apache.tools.zip;
\r
21 import java.util.zip.ZipException;
\r
24 * General format of extra field data.
\r
26 * <p>Extra fields usually appear twice per file, once in the local
\r
27 * file data and once in the central directory. Usually they are the
\r
28 * same, but they don't have to be. {@link
\r
29 * java.util.zip.ZipOutputStream java.util.zip.ZipOutputStream} will
\r
30 * only use the local file data in both places.</p>
\r
33 public interface ZipExtraField {
\r
37 * @return the header id
\r
40 ZipShort getHeaderId();
\r
43 * Length of the extra field in the local file data - without
\r
44 * Header-ID or length specifier.
\r
45 * @return the length of the field in the local file data
\r
48 ZipShort getLocalFileDataLength();
\r
51 * Length of the extra field in the central directory - without
\r
52 * Header-ID or length specifier.
\r
53 * @return the length of the field in the central directory
\r
56 ZipShort getCentralDirectoryLength();
\r
59 * The actual data to put into local file data - without Header-ID
\r
60 * or length specifier.
\r
64 byte[] getLocalFileDataData();
\r
67 * The actual data to put into central directory - without Header-ID or
\r
72 byte[] getCentralDirectoryData();
\r
75 * Populate data from this array as if it was in local file data.
\r
76 * @param data an array of bytes
\r
77 * @param offset the start offset
\r
78 * @param length the number of bytes in the array from offset
\r
81 * @throws ZipException on error
\r
83 void parseFromLocalFileData(byte[] data, int offset, int length)
\r
84 throws ZipException;
\r