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
019package 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 * @see <a href="https://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE
028 * APPNOTE.TXT, section 4.6.8</a>
029 *
030 * @NotThreadSafe super-class is not thread-safe
031 */
032public class UnicodeCommentExtraField extends AbstractUnicodeExtraField {
033
034    public static final ZipShort UCOM_ID = new ZipShort(0x6375);
035
036    public UnicodeCommentExtraField () {
037    }
038
039    /**
040     * Assemble as unicode comment extension from the name given as
041     * text as well as the encoded bytes actually written to the archive.
042     *
043     * @param text The file name
044     * @param bytes the bytes actually written to the archive
045     * @param off The offset of the encoded comment in <code>bytes</code>.
046     * @param len The length of the encoded comment or comment in
047     * <code>bytes</code>.
048     */
049    public UnicodeCommentExtraField(final String text, final byte[] bytes, final int off,
050                                    final int len) {
051        super(text, bytes, off, len);
052    }
053
054    /**
055     * Assemble as unicode comment extension from the comment given as
056     * text as well as the bytes actually written to the archive.
057     *
058     * @param comment The file comment
059     * @param bytes the bytes actually written to the archive
060     */
061    public UnicodeCommentExtraField(final String comment, final byte[] bytes) {
062        super(comment, bytes);
063    }
064
065    @Override
066    public ZipShort getHeaderId() {
067        return UCOM_ID;
068    }
069
070}