01: /*
02: * Copyright 2001,2004 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: * @author Stefan Bodewig
32: * @version $Revision: 1.5.2.3 $
33: */
34: public interface ZipExtraField {
35:
36: /**
37: * The Header-ID.
38: *
39: * @since 1.1
40: */
41: ZipShort getHeaderId();
42:
43: /**
44: * Length of the extra field in the local file data - without
45: * Header-ID or length specifier.
46: *
47: * @since 1.1
48: */
49: ZipShort getLocalFileDataLength();
50:
51: /**
52: * Length of the extra field in the central directory - without
53: * Header-ID or length specifier.
54: *
55: * @since 1.1
56: */
57: ZipShort getCentralDirectoryLength();
58:
59: /**
60: * The actual data to put into local file data - without Header-ID
61: * or length specifier.
62: *
63: * @since 1.1
64: */
65: byte[] getLocalFileDataData();
66:
67: /**
68: * The actual data to put central directory - without Header-ID or
69: * length specifier.
70: *
71: * @since 1.1
72: */
73: byte[] getCentralDirectoryData();
74:
75: /**
76: * Populate data from this array as if it was in local file data.
77: *
78: * @since 1.1
79: */
80: void parseFromLocalFileData(byte[] data, int offset, int length)
81: throws ZipException;
82: }
|