UnicodePathExtraField.java

  1. /*
  2.  *  Licensed to the Apache Software Foundation (ASF) under one or more
  3.  *  contributor license agreements.  See the NOTICE file distributed with
  4.  *  this work for additional information regarding copyright ownership.
  5.  *  The ASF licenses this file to You under the Apache License, Version 2.0
  6.  *  (the "License"); you may not use this file except in compliance with
  7.  *  the License.  You may obtain a copy of the License at
  8.  *
  9.  *      http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  *  Unless required by applicable law or agreed to in writing, software
  12.  *  distributed under the License is distributed on an "AS IS" BASIS,
  13.  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  *  See the License for the specific language governing permissions and
  15.  *  limitations under the License.
  16.  */

  17. package org.apache.commons.compress.archivers.zip;

  18. /**
  19.  * Info-ZIP Unicode Path Extra Field (0x7075):
  20.  *
  21.  * <p>
  22.  * Stores the UTF-8 version of the file name field as stored in the local header and central directory header.
  23.  * </p>
  24.  *
  25.  * @see <a href="https://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE APPNOTE.TXT, section 4.6.9</a>
  26.  *
  27.  * @NotThreadSafe super-class is not thread-safe
  28.  */
  29. public class UnicodePathExtraField extends AbstractUnicodeExtraField {

  30.     public static final ZipShort UPATH_ID = new ZipShort(0x7075);

  31.     public UnicodePathExtraField() {
  32.     }

  33.     /**
  34.      * Assemble as unicode path extension from the name given as text as well as the encoded bytes actually written to the archive.
  35.      *
  36.      * @param name  The file name
  37.      * @param bytes the bytes actually written to the archive
  38.      */
  39.     public UnicodePathExtraField(final String name, final byte[] bytes) {
  40.         super(name, bytes);
  41.     }

  42.     /**
  43.      * Assemble as unicode path extension from the name given as text as well as the encoded bytes actually written to the archive.
  44.      *
  45.      * @param text  The file name
  46.      * @param bytes the bytes actually written to the archive
  47.      * @param off   The offset of the encoded file name in {@code bytes}.
  48.      * @param len   The length of the encoded file name or comment in {@code bytes}.
  49.      */
  50.     public UnicodePathExtraField(final String text, final byte[] bytes, final int off, final int len) {
  51.         super(text, bytes, off, len);
  52.     }

  53.     @Override
  54.     public ZipShort getHeaderId() {
  55.         return UPATH_ID;
  56.     }
  57. }