1 | /*
|
---|
2 | * Copyright 2001,2004-2005 The Apache Software Foundation
|
---|
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 | */
|
---|
17 |
|
---|
18 | package org.apache.tools.zip;
|
---|
19 |
|
---|
20 | import java.util.zip.ZipException;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * General format of extra field data.
|
---|
24 | *
|
---|
25 | * <p>Extra fields usually appear twice per file, once in the local
|
---|
26 | * file data and once in the central directory. Usually they are the
|
---|
27 | * same, but they don't have to be. {@link
|
---|
28 | * java.util.zip.ZipOutputStream java.util.zip.ZipOutputStream} will
|
---|
29 | * only use the local file data in both places.</p>
|
---|
30 | *
|
---|
31 | */
|
---|
32 | public interface ZipExtraField {
|
---|
33 |
|
---|
34 | /**
|
---|
35 | * The Header-ID.
|
---|
36 | *
|
---|
37 | * @since 1.1
|
---|
38 | */
|
---|
39 | ZipShort getHeaderId();
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Length of the extra field in the local file data - without
|
---|
43 | * Header-ID or length specifier.
|
---|
44 | *
|
---|
45 | * @since 1.1
|
---|
46 | */
|
---|
47 | ZipShort getLocalFileDataLength();
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * Length of the extra field in the central directory - without
|
---|
51 | * Header-ID or length specifier.
|
---|
52 | *
|
---|
53 | * @since 1.1
|
---|
54 | */
|
---|
55 | ZipShort getCentralDirectoryLength();
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * The actual data to put into local file data - without Header-ID
|
---|
59 | * or length specifier.
|
---|
60 | *
|
---|
61 | * @since 1.1
|
---|
62 | */
|
---|
63 | byte[] getLocalFileDataData();
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * The actual data to put central directory - without Header-ID or
|
---|
67 | * length specifier.
|
---|
68 | *
|
---|
69 | * @since 1.1
|
---|
70 | */
|
---|
71 | byte[] getCentralDirectoryData();
|
---|
72 |
|
---|
73 | /**
|
---|
74 | * Populate data from this array as if it was in local file data.
|
---|
75 | *
|
---|
76 | * @since 1.1
|
---|
77 | */
|
---|
78 | void parseFromLocalFileData(byte[] data, int offset, int length)
|
---|
79 | throws ZipException;
|
---|
80 | }
|
---|