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