Top Description Fields Constructors Methods
org.apache.commons.compress.archivers.zip

public abstract Class AbstractUnicodeExtraField

extends Object
implements ZipExtraField
Class Inheritance
All Implemented Interfaces
org.apache.commons.compress.archivers.zip.ZipExtraField
Known Direct Subclasses
org.apache.commons.compress.archivers.zip.UnicodeCommentExtraField, org.apache.commons.compress.archivers.zip.UnicodePathExtraField
Static Imports
java.nio.charset.StandardCharsets.UTF_8

A common base class for Unicode extra information extra fields.

Field Summary

Modifier and TypeField and Description
private byte[]
private long
private byte[]

Constructor Summary

AccessConstructor and Description
protected
AbstractUnicodeExtraField()

Constructs a new instance.

protected
AbstractUnicodeExtraField(final String
The file name or comment.
text
,
final byte[]
The encoded of the file name or comment in the ZIP file.
bytes
)

Assemble as unicode extension from the name/comment and encoding of the original ZIP entry.

protected
AbstractUnicodeExtraField(final String
The file name or comment.
text
,
final byte[]
The encoded of the file name or comment in the ZIP file.
bytes
,
final int
The offset of the encoded file name or comment in bytes.
off
,
final int
The length of the encoded file name or comment in bytes.
len
)

Assemble as unicode extension from the name/comment and encoding of the original ZIP entry.

Method Summary

Modifier and TypeMethod and Description
private void
public byte[]
getCentralDirectoryData()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getCentralDirectoryData.

The actual data to put into central directory - without Header-ID or length specifier.
public ZipShort
getCentralDirectoryLength()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getCentralDirectoryLength.

Length of the extra field in the central directory - without Header-ID or length specifier.
public byte[]
getLocalFileDataData()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getLocalFileDataData.

The actual data to put into local file data - without Header-ID or length specifier.
public ZipShort
getLocalFileDataLength()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getLocalFileDataLength.

Length of the extra field in the local file data - without Header-ID or length specifier.
public long

Returns:

The CRC32 checksum of the file name or comment as encoded in the central directory of the ZIP file.
getNameCRC32
()

Gets the CRC32 checksum of the file name or comment as encoded in the central directory of the ZIP file.

public byte[]

Returns:

The UTF-8 encoded name.
getUnicodeName
()

Gets The UTF-8 encoded name.

public void
parseFromCentralDirectoryData(final byte[]
the buffer to read data from
buffer
,
final int
offset into buffer to read data
offset
,
final int
the length of data
length
)

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromCentralDirectoryData.

Doesn't do anything special since this class always uses the same data in central directory and local file data.
public void
parseFromLocalFileData(final byte[]
the buffer to read data from
buffer
,
final int
offset into buffer to read data
offset
,
final int
the length of data
length
)

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromLocalFileData.

Populate data from this array as if it was in local file data.
public void
setNameCRC32(final long
The CRC32 checksum of the file name as encoded in the central directory of the ZIP file to set.
nameCRC32
)

Gets The CRC32 checksum of the file name as encoded in the central directory of the ZIP file to set.

public void
setUnicodeName(final byte[]
The UTF-8 encoded name to set.
unicodeName
)

Gets the UTF-8 encoded name to set.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

databack to summary
private byte[] data
nameCRC32back to summary
private long nameCRC32
unicodeNameback to summary
private byte[] unicodeName

Constructor Detail

AbstractUnicodeExtraFieldback to summary
protected AbstractUnicodeExtraField()

Constructs a new instance.

AbstractUnicodeExtraFieldback to summary
protected AbstractUnicodeExtraField(final String text, final byte[] bytes)

Assemble as unicode extension from the name/comment and encoding of the original ZIP entry.

Parameters
text:String

The file name or comment.

bytes:byte[]

The encoded of the file name or comment in the ZIP file.

AbstractUnicodeExtraFieldback to summary
protected AbstractUnicodeExtraField(final String text, final byte[] bytes, final int off, final int len)

Assemble as unicode extension from the name/comment and encoding of the original ZIP entry.

Parameters
text:String

The file name or comment.

bytes:byte[]

The encoded of the file name or comment in the ZIP file.

off:int

The offset of the encoded file name or comment in bytes.

len:int

The length of the encoded file name or comment in bytes.

Method Detail

assembleDataback to summary
private void assembleData()
getCentralDirectoryDataback to summary
public byte[] getCentralDirectoryData()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getCentralDirectoryData.

Doc from org.apache.commons.compress.archivers.zip.ZipExtraField.getCentralDirectoryData.

The actual data to put into central directory - without Header-ID or length specifier.

Returns:byte[]

the data

Annotations
@Override
getCentralDirectoryLengthback to summary
public ZipShort getCentralDirectoryLength()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getCentralDirectoryLength.

Doc from org.apache.commons.compress.archivers.zip.ZipExtraField.getCentralDirectoryLength.

Length of the extra field in the central directory - without Header-ID or length specifier.

Returns:ZipShort

the length of the field in the central directory

Annotations
@Override
getLocalFileDataDataback to summary
public byte[] getLocalFileDataData()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getLocalFileDataData.

Doc from org.apache.commons.compress.archivers.zip.ZipExtraField.getLocalFileDataData.

The actual data to put into local file data - without Header-ID or length specifier.

Returns:byte[]

the data

Annotations
@Override
getLocalFileDataLengthback to summary
public ZipShort getLocalFileDataLength()

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.getLocalFileDataLength.

Doc from org.apache.commons.compress.archivers.zip.ZipExtraField.getLocalFileDataLength.

Length of the extra field in the local file data - without Header-ID or length specifier.

Returns:ZipShort

the length of the field in the local file data

Annotations
@Override
getNameCRC32back to summary
public long getNameCRC32()

Gets the CRC32 checksum of the file name or comment as encoded in the central directory of the ZIP file.

Returns:long

The CRC32 checksum of the file name or comment as encoded in the central directory of the ZIP file.

getUnicodeNameback to summary
public byte[] getUnicodeName()

Gets The UTF-8 encoded name.

Returns:byte[]

The UTF-8 encoded name.

parseFromCentralDirectoryDataback to summary
public void parseFromCentralDirectoryData(final byte[] buffer, final int offset, final int length) throws ZipException

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromCentralDirectoryData.

Doesn't do anything special since this class always uses the same data in central directory and local file data.

Parameters
buffer:byte[]

Doc from org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromCentralDirectoryData.

the buffer to read data from

offset:int

Doc from org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromCentralDirectoryData.

offset into buffer to read data

length:int

Doc from org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromCentralDirectoryData.

the length of data

Annotations
@Override
Exceptions
ZipException:

Doc from org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromCentralDirectoryData.

on error

parseFromLocalFileDataback to summary
public void parseFromLocalFileData(final byte[] buffer, final int offset, final int length) throws ZipException

Implements org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromLocalFileData.

Doc from org.apache.commons.compress.archivers.zip.ZipExtraField.parseFromLocalFileData.

Populate data from this array as if it was in local file data.

Parameters
buffer:byte[]

the buffer to read data from

offset:int

offset into buffer to read data

length:int

the length of data

Annotations
@Override
Exceptions
ZipException:
on error
setNameCRC32back to summary
public void setNameCRC32(final long nameCRC32)

Gets The CRC32 checksum of the file name as encoded in the central directory of the ZIP file to set.

Parameters
nameCRC32:long

The CRC32 checksum of the file name as encoded in the central directory of the ZIP file to set.

setUnicodeNameback to summary
public void setUnicodeName(final byte[] unicodeName)

Gets the UTF-8 encoded name to set.

Parameters
unicodeName:byte[]

The UTF-8 encoded name to set.