1 /* 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 package org.apache.commons.compress.archivers.zip; 19 20 /** 21 * Info-ZIP Unicode Comment Extra Field (0x6375): 22 * 23 * <p> 24 * Stores the UTF-8 version of the file comment as stored in the central directory header. 25 * </p> 26 * 27 * @see <a href="https://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE APPNOTE.TXT, section 4.6.8</a> 28 * 29 * @NotThreadSafe super-class is not thread-safe 30 */ 31 public class UnicodeCommentExtraField extends AbstractUnicodeExtraField { 32 33 public static final ZipShort UCOM_ID = new ZipShort(0x6375); 34 35 public UnicodeCommentExtraField() { 36 } 37 38 /** 39 * Assemble as unicode comment extension from the comment given as text as well as the bytes actually written to the archive. 40 * 41 * @param comment The file comment 42 * @param bytes the bytes actually written to the archive 43 */ 44 public UnicodeCommentExtraField(final String comment, final byte[] bytes) { 45 super(comment, bytes); 46 } 47 48 /** 49 * Assemble as unicode comment extension from the name given as text as well as the encoded bytes actually written to the archive. 50 * 51 * @param text The file name 52 * @param bytes the bytes actually written to the archive 53 * @param off The offset of the encoded comment in {@code bytes}. 54 * @param len The length of the encoded comment or comment in {@code bytes}. 55 */ 56 public UnicodeCommentExtraField(final String text, final byte[] bytes, final int off, final int len) { 57 super(text, bytes, off, len); 58 } 59 60 @Override 61 public ZipShort getHeaderId() { 62 return UCOM_ID; 63 } 64 65 }