1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * https://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20 package org.apache.commons.compress.archivers.zip;
21
22 /**
23 * Info-ZIP Unicode Comment Extra Field (0x6375):
24 *
25 * <p>
26 * Stores the UTF-8 version of the file comment as stored in the central directory header.
27 * </p>
28 *
29 * @see <a href="https://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE APPNOTE.TXT, section 4.6.8</a>
30 * @NotThreadSafe super-class is not thread-safe
31 */
32 public class UnicodeCommentExtraField extends AbstractUnicodeExtraField {
33
34 /**
35 * Field ID.
36 */
37 public static final ZipShort UCOM_ID = new ZipShort(0x6375);
38
39 /**
40 * Constructs a new instance.
41 */
42 public UnicodeCommentExtraField() {
43 }
44
45 /**
46 * Constructs a new instance as Unicode comment extension from the comment given as text as well as the bytes actually written to the archive.
47 *
48 * @param comment The file comment
49 * @param bytes the bytes actually written to the archive
50 */
51 public UnicodeCommentExtraField(final String comment, final byte[] bytes) {
52 super(comment, bytes);
53 }
54
55 /**
56 * Assemble as Unicode comment extension from the name given as text as well as the encoded bytes actually written to the archive.
57 *
58 * @param text The file name
59 * @param bytes the bytes actually written to the archive
60 * @param off The offset of the encoded comment in {@code bytes}.
61 * @param len The length of the encoded comment or comment in {@code bytes}.
62 */
63 public UnicodeCommentExtraField(final String text, final byte[] bytes, final int off, final int len) {
64 super(text, bytes, off, len);
65 }
66
67 @Override
68 public ZipShort getHeaderId() {
69 return UCOM_ID;
70 }
71
72 }