    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
    018package org.apache.commons.compress.archivers.zip;
    019
    020/**
    021 * Info-ZIP Unicode Comment Extra Field (0x6375):
    022 *
    023 * <p>
    024 * Stores the UTF-8 version of the file comment as stored in the central directory header.
    025 * </p>
    026 *
    027 * @see <a href="https://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE APPNOTE.TXT, section 4.6.8</a>
    028 *
    029 * @NotThreadSafe super-class is not thread-safe
    030 */
    031public class UnicodeCommentExtraField extends AbstractUnicodeExtraField {
    032
    033    public static final ZipShort UCOM_ID = new ZipShort(0x6375);
    034
    035    public UnicodeCommentExtraField() {
    036    }
    037
    038    /**
    039     * Assemble as unicode comment extension from the comment given as text as well as the bytes actually written to the archive.
    040     *
    041     * @param comment The file comment
    042     * @param bytes   the bytes actually written to the archive
    043     */
    044    public UnicodeCommentExtraField(final String comment, final byte[] bytes) {
    045        super(comment, bytes);
    046    }
    047
    048    /**
    049     * Assemble as unicode comment extension from the name given as text as well as the encoded bytes actually written to the archive.
    050     *
    051     * @param text  The file name
    052     * @param bytes the bytes actually written to the archive
    053     * @param off   The offset of the encoded comment in {@code bytes}.
    054     * @param len   The length of the encoded comment or comment in {@code bytes}.
    055     */
    056    public UnicodeCommentExtraField(final String text, final byte[] bytes, final int off, final int len) {
    057        super(text, bytes, off, len);
    058    }
    059
    060    @Override
    061    public ZipShort getHeaderId() {
    062        return UCOM_ID;
    063    }
    064
    065}