| 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * https://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | |
| 20 | package org.apache.commons.compress.archivers.zip; |
| 21 | |
| 22 | /** |
| 23 | * Info-ZIP Unicode Path Extra Field (0x7075): |
| 24 | * |
| 25 | * <p> |
| 26 | * Stores the UTF-8 version of the file name field as stored in the local header and central directory header. |
| 27 | * </p> |
| 28 | * |
| 29 | * @see <a href="https://www.pkware.com/documents/casestudies/APPNOTE.TXT">PKWARE APPNOTE.TXT, section 4.6.9</a> |
| 30 | * @NotThreadSafe super-class is not thread-safe |
| 31 | */ |
| 32 | public class UnicodePathExtraField extends AbstractUnicodeExtraField { |
| 33 | |
| 34 | /** |
| 35 | * Field ID. |
| 36 | */ |
| 37 | public static final ZipShort UPATH_ID = new ZipShort(0x7075); |
| 38 | |
| 39 | /** |
| 40 | * Constructs a new instance. |
| 41 | */ |
| 42 | public UnicodePathExtraField() { |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Assemble as unicode path extension from the name given as text as well as the encoded bytes actually written to the archive. |
| 47 | * |
| 48 | * @param name The file name |
| 49 | * @param bytes the bytes actually written to the archive |
| 50 | */ |
| 51 | public UnicodePathExtraField(final String name, final byte[] bytes) { |
| 52 | super(name, bytes); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Assemble as unicode path extension from the name given as text as well as the encoded bytes actually written to the archive. |
| 57 | * |
| 58 | * @param text The file name |
| 59 | * @param bytes the bytes actually written to the archive |
| 60 | * @param off The offset of the encoded file name in {@code bytes}. |
| 61 | * @param len The length of the encoded file name or comment in {@code bytes}. |
| 62 | */ |
| 63 | public UnicodePathExtraField(final String text, final byte[] bytes, final int off, final int len) { |
| 64 | super(text, bytes, off, len); |
| 65 | } |
| 66 | |
| 67 | @Override |
| 68 | public ZipShort getHeaderId() { |
| 69 | return UPATH_ID; |
| 70 | } |
| 71 | } |