Example usage for org.apache.poi.hpsf ClassID toString

List of usage examples for org.apache.poi.hpsf ClassID toString

Introduction

In this page you can find the example usage for org.apache.poi.hpsf ClassID toString.

Prototype

@Override
public String toString() 

Source Link

Document

Returns a human-readable representation of the Class ID in standard format "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"}.

Usage

From source file:org.apache.tika.parser.microsoft.AbstractPOIFSExtractor.java

License:Apache License

protected void handleEmbeddedResource(TikaInputStream resource, String filename, String relationshipID,
        ClassID storageClassID, String mediaType, XHTMLContentHandler xhtml, boolean outputHtml)
        throws IOException, SAXException, TikaException {
    try {/*from  w  w  w.  ja va 2s  .c  o m*/
        Metadata metadata = new Metadata();
        if (filename != null) {
            metadata.set(Metadata.TIKA_MIME_FILE, filename);
            metadata.set(Metadata.RESOURCE_NAME_KEY, filename);
        }
        if (relationshipID != null) {
            metadata.set(Metadata.EMBEDDED_RELATIONSHIP_ID, relationshipID);
        }
        if (storageClassID != null) {
            metadata.set(Metadata.EMBEDDED_STORAGE_CLASS_ID, storageClassID.toString());
        }
        if (mediaType != null) {
            metadata.set(Metadata.CONTENT_TYPE, mediaType);
        }

        if (extractor.shouldParseEmbedded(metadata)) {
            extractor.parseEmbedded(resource, xhtml, metadata, outputHtml);
        }
    } finally {
        resource.close();
    }
}

From source file:org.ddt.listener.ole.MonikerFactory.java

License:Apache License

/**
 * Retrieves the appropriate Moniker type for the given class id.
 *
 * The Moniker is initialised from the input stream.
 *
 * @param clsid The class id of the Moniker type
 * @param is The <code>DocumentInputStream</code> to read the Moniker from.
 * @return A Moniker, or <b>null</b> if the class id is not recognised.
 * @throws IOException/*from   w  ww .j  ava 2  s .  c  o m*/
 * @throws BadOleStreamException If a malformed Moniker Stream is found. 
 */
static Moniker getMoniker(ClassID clsid, DocumentInputStream is) throws IOException, BadOleStreamException {
    if (clsid.equals(FILE_MONIKER_ID)) {
        return new FileMoniker(is);
    } else if (clsid.equals(COMPOSITE_MONIKER_ID)) {
        return new CompositeMoniker(is);
    } else if (clsid.equals(URL_MONIKER_ID)) {
        return new URLMoniker(is);
    } else if (clsid.equals(ITEM_MONIKER_ID)) {
        return new ItemMoniker(is);
    } else {
        log.log(Level.WARNING, "ClassID unknown: {0}", clsid.toString());
        return null;
    }

}