001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * https://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019 020package org.apache.commons.compress.archivers.zip; 021 022/** 023 * Info-ZIP Unicode Comment Extra Field (0x6375): 024 * 025 * <p> 026 * Stores the UTF-8 version of the file comment as stored in the central directory header. 027 * </p> 028 * 029 * @see <a href="https://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE APPNOTE.TXT, section 4.6.8</a> 030 * @NotThreadSafe super-class is not thread-safe 031 */ 032public class UnicodeCommentExtraField extends AbstractUnicodeExtraField { 033 034 /** 035 * Field ID. 036 */ 037 public static final ZipShort UCOM_ID = new ZipShort(0x6375); 038 039 /** 040 * Constructs a new instance. 041 */ 042 public UnicodeCommentExtraField() { 043 } 044 045 /** 046 * Constructs a new instance as Unicode comment extension from the comment given as text as well as the bytes actually written to the archive. 047 * 048 * @param comment The file comment 049 * @param bytes the bytes actually written to the archive 050 */ 051 public UnicodeCommentExtraField(final String comment, final byte[] bytes) { 052 super(comment, bytes); 053 } 054 055 /** 056 * Assemble as Unicode comment extension from the name given as text as well as the encoded bytes actually written to the archive. 057 * 058 * @param text The file name 059 * @param bytes the bytes actually written to the archive 060 * @param off The offset of the encoded comment in {@code bytes}. 061 * @param len The length of the encoded comment or comment in {@code bytes}. 062 */ 063 public UnicodeCommentExtraField(final String text, final byte[] bytes, final int off, final int len) { 064 super(text, bytes, off, len); 065 } 066 067 @Override 068 public ZipShort getHeaderId() { 069 return UCOM_ID; 070 } 071 072}