    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 Path Extra Field (0x7075):
    024 *
    025 * <p>
    026 * Stores the UTF-8 version of the file name field as stored in the local header and central directory header.
    027 * </p>
    028 *
    029 * @see <a href="https://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE APPNOTE.TXT, section 4.6.9</a>
    030 * @NotThreadSafe super-class is not thread-safe
    031 */
    032public class UnicodePathExtraField extends AbstractUnicodeExtraField {
    033
    034    /**
    035     * Field ID.
    036     */
    037    public static final ZipShort UPATH_ID = new ZipShort(0x7075);
    038
    039    /**
    040     * Constructs a new instance.
    041     */
    042    public UnicodePathExtraField() {
    043    }
    044
    045    /**
    046     * Assemble as unicode path extension from the name given as text as well as the encoded bytes actually written to the archive.
    047     *
    048     * @param name  The file name
    049     * @param bytes the bytes actually written to the archive
    050     */
    051    public UnicodePathExtraField(final String name, final byte[] bytes) {
    052        super(name, bytes);
    053    }
    054
    055    /**
    056     * Assemble as unicode path 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 file name in {@code bytes}.
    061     * @param len   The length of the encoded file name or comment in {@code bytes}.
    062     */
    063    public UnicodePathExtraField(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 UPATH_ID;
    070    }
    071}