Example usage for org.apache.commons.compress.archivers.zip ZipExtraField getLocalFileDataData

List of usage examples for org.apache.commons.compress.archivers.zip ZipExtraField getLocalFileDataData

Introduction

In this page you can find the example usage for org.apache.commons.compress.archivers.zip ZipExtraField getLocalFileDataData.

Prototype

byte[] getLocalFileDataData();

Source Link

Document

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

Usage

From source file:org.callimachusproject.io.ContentTypeExtraField.java

static String parseExtraField(ZipArchiveEntry entry) {
    try {//ww  w .  j a  va 2  s  . co  m
        ZipExtraField field = entry.getExtraField(ID);
        if (field == null)
            return null;
        byte[] data = field.getLocalFileDataData();
        String str = new String(data, "UTF-8");
        if (isContentType(str))
            return str;
    } catch (UnsupportedEncodingException e) {
        throw new AssertionError(e);
    }
    return null;
}

From source file:org.callimachusproject.io.MetaTypeExtraField.java

static MetaTypeExtraField parseExtraField(ZipArchiveEntry entry) {
    try {/*from   w  w w.  j a va  2s.  c  o  m*/
        ZipExtraField field = entry.getExtraField(ID);
        if (field == null)
            return null;
        byte[] data = field.getLocalFileDataData();
        String str = new String(data, "UTF-8");
        if ("FILE".equals(str))
            return FILE;
        if ("FOLDER".equals(str))
            return FOLDER;
        if ("RDF".equals(str))
            return RDF;
        if ("RDFS".equals(str))
            return RDFS;
    } catch (UnsupportedEncodingException e) {
        throw new AssertionError(e);
    }
    return null;
}