FileDocCategorySizeDatePackage
UnrecognizedExtraField.javaAPI DocApache Ant 1.703757Wed Dec 13 06:16:20 GMT 2006org.apache.tools.zip

UnrecognizedExtraField

public class UnrecognizedExtraField extends Object implements ZipExtraField
Simple placeholder for all those extra fields we don't want to deal with.

Assumes local file data and central directory entries are identical - unless told the opposite.

Fields Summary
private ZipShort
headerId
The Header-ID.
private byte[]
localData
Extra field data in local file data - without Header-ID or length specifier.
private byte[]
centralData
Extra field data in central directory - without Header-ID or length specifier.
Constructors Summary
Methods Summary
public byte[]getCentralDirectoryData()
Get the central data.

return
the central data if present, else return the local file data

        if (centralData != null) {
            return centralData;
        }
        return getLocalFileDataData();
    
public ZipShortgetCentralDirectoryLength()
Get the central data length. If there is no central data, get the local file data length.

return
the central data length

        if (centralData != null) {
            return new ZipShort(centralData.length);
        }
        return getLocalFileDataLength();
    
public ZipShortgetHeaderId()
Get the header id.

return
the header id

        return headerId;
    
public byte[]getLocalFileDataData()
Get the local data.

return
the local data

        return localData;
    
public ZipShortgetLocalFileDataLength()
Get the length of the local data.

return
the length of the local data

        return new ZipShort(localData.length);
    
public voidparseFromLocalFileData(byte[] data, int offset, int length)

param
data the array of bytes.
param
offset the source location in the data array.
param
length the number of bytes to use in the data array.
see
ZipExtraField#parseFromLocalFileData(byte[], int, int)

        byte[] tmp = new byte[length];
        System.arraycopy(data, offset, tmp, 0, length);
        setLocalFileDataData(tmp);
    
public voidsetCentralDirectoryData(byte[] data)
Set the extra field data in central directory.

param
data the data to use

        centralData = data;
    
public voidsetHeaderId(ZipShort headerId)
Set the header id.

param
headerId the header id to use

        this.headerId = headerId;
    
public voidsetLocalFileDataData(byte[] data)
Set the extra field data in the local file data - without Header-ID or length specifier.

param
data the field data to use

        localData = data;