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 Path Extra Field (0x7075):
023     *
024     * <p>Stores the UTF-8 version of the file name field as stored in the 
025     * local header and central directory header.</p>
026     *
027     * <pre>
028     *         Value         Size        Description
029     *         -----         ----        -----------
030     * (UPath) 0x7075        Short       tag for this extra block type ("up")
031     *         TSize         Short       total data size for this block
032     *         Version       1 byte      version of this extra field, currently 1
033     *         NameCRC32     4 bytes     File Name Field CRC32 Checksum
034     *         UnicodeName   Variable    UTF-8 version of the entry File Name
035     * </pre>
036     * @NotThreadSafe super-class is not thread-safe
037     */
038    public class UnicodePathExtraField extends AbstractUnicodeExtraField {
039    
040        public static final ZipShort UPATH_ID = new ZipShort(0x7075);
041    
042        public UnicodePathExtraField () { 
043        }
044    
045        /**
046         * Assemble as unicode path 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 filename in <code>bytes</code>.
052         * @param len The length of the encoded filename or comment in
053         * <code>bytes</code>.
054         */
055        public UnicodePathExtraField(String text, byte[] bytes, int off, int len) {
056            super(text, bytes, off, len);
057        }
058    
059        /**
060         * Assemble as unicode path extension from the name given as
061         * text as well as the encoded bytes actually written to the archive.
062         * 
063         * @param name The file name
064         * @param bytes the bytes actually written to the archive
065         */
066        public UnicodePathExtraField(String name, byte[] bytes) {
067            super(name, bytes);
068        }
069    
070        public ZipShort getHeaderId() {
071            return UPATH_ID;
072        }
073    }