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