blob: 8db6a17bda518605ad456bc1a64b1a09a9628e3a [file] [log] [blame]
Stefan Bodewig4e2380b2009-02-18 14:51:10 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19package org.apache.commons.compress.archivers.zip;
20
21/**
22 * Info-ZIP Unicode Comment Extra Field (0x6375):
23 *
24 * <p>Stores the UTF-8 version of the file comment as stored in the
25 * central directory header.</p>
26 *
Stefan Bodewig45e51c22013-12-22 07:03:43 +000027 * @see <a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE's
28 * APPNOTE.TXT, section 4.6.8</a>
Stefan Bodewigb86d8a62013-07-17 14:37:22 +000029 *
Sebastian Bazley99870ef2009-03-28 00:04:36 +000030 * @NotThreadSafe super-class is not thread-safe
Stefan Bodewig4e2380b2009-02-18 14:51:10 +000031 */
32public class UnicodeCommentExtraField extends AbstractUnicodeExtraField {
33
34 public static final ZipShort UCOM_ID = new ZipShort(0x6375);
35
36 public UnicodeCommentExtraField () {
37 }
38
39 /**
Stefan Bodewig853176f2009-03-02 16:09:20 +000040 * Assemble as unicode comment extension from the name given as
41 * text as well as the encoded bytes actually written to the archive.
Stefan Bodewig4e2380b2009-02-18 14:51:10 +000042 *
Sebastian Bazley8ebac242009-03-04 00:18:09 +000043 * @param text The file name
Stefan Bodewig853176f2009-03-02 16:09:20 +000044 * @param bytes the bytes actually written to the archive
45 * @param off The offset of the encoded comment in <code>bytes</code>.
46 * @param len The length of the encoded comment or comment in
47 * <code>bytes</code>.
Stefan Bodewig4e2380b2009-02-18 14:51:10 +000048 */
Stefan Bodewig853176f2009-03-02 16:09:20 +000049 public UnicodeCommentExtraField(String text, byte[] bytes, int off,
50 int len) {
51 super(text, bytes, off, len);
Stefan Bodewigccc77aa2009-02-26 09:07:23 +000052 }
53
54 /**
55 * Assemble as unicode comment extension from the comment given as
56 * text as well as the bytes actually written to the archive.
57 *
58 * @param comment The file comment
59 * @param bytes the bytes actually written to the archive
60 */
61 public UnicodeCommentExtraField(String comment, byte[] bytes) {
62 super(comment, bytes);
Stefan Bodewig4e2380b2009-02-18 14:51:10 +000063 }
64
Stefan Bodewig4e2380b2009-02-18 14:51:10 +000065 public ZipShort getHeaderId() {
66 return UCOM_ID;
67 }
68
69}