| 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 |
*/ |
| 18 |
|
| 19 |
package org.apache.tools.zip; |
| 20 |
|
| 21 |
/** |
| 22 |
* Info-ZIP Unicode Path Extra Field (0x7075): |
| 23 |
* |
| 24 |
* <p>Stores the UTF-8 version of the file name field as stored in the |
| 25 |
* local header and central directory header.</p> |
| 26 |
* |
| 27 |
* <pre> |
| 28 |
* Value Size Description |
| 29 |
* ----- ---- ----------- |
| 30 |
* (UPath) 0x7075 Short tag for this extra block type ("up") |
| 31 |
* TSize Short total data size for this block |
| 32 |
* Version 1 byte version of this extra field, currently 1 |
| 33 |
* NameCRC32 4 bytes File Name Field CRC32 Checksum |
| 34 |
* UnicodeName Variable UTF-8 version of the entry File Name |
| 35 |
* </pre> |
| 36 |
*/ |
| 37 |
public class UnicodePathExtraField extends AbstractUnicodeExtraField { |
| 38 |
|
| 39 |
public static final ZipShort UPATH_ID = new ZipShort(0x7075); |
| 40 |
|
| 41 |
public UnicodePathExtraField () { |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Assemble as unicode path extension from the name given as |
| 46 |
* text as well as the encoded bytes actually written to the archive. |
| 47 |
* |
| 48 |
* @param text The file name |
| 49 |
* @param bytes the bytes actually written to the archive |
| 50 |
* @param off The offset of the encoded filename in <code>bytes</code>. |
| 51 |
* @param len The length of the encoded filename or comment in |
| 52 |
* <code>bytes</code>. |
| 53 |
*/ |
| 54 |
public UnicodePathExtraField(String text, byte[] bytes, int off, int len) { |
| 55 |
super(text, bytes, off, len); |
| 56 |
} |
| 57 |
|
| 58 |
/** |
| 59 |
* Assemble as unicode path extension from the name given as |
| 60 |
* text as well as the encoded bytes actually written to the archive. |
| 61 |
* |
| 62 |
* @param name The file name |
| 63 |
* @param bytes the bytes actually written to the archive |
| 64 |
*/ |
| 65 |
public UnicodePathExtraField(String name, byte[] bytes) { |
| 66 |
super(name, bytes); |
| 67 |
} |
| 68 |
|
| 69 |
public ZipShort getHeaderId() { |
| 70 |
return UPATH_ID; |
| 71 |
} |
| 72 |
} |