Top Fields Constructors Methods
org.jabref.logic.xmp

public Class XmpUtilReader

extends Object
Class Inheritance
Imports
java.io.ByteArrayInputStream, .IOException, java.nio.file.Path, java.util.ArrayList, .LinkedList, .List, .Optional, org.jabref.model.entry.BibEntry, .LinkedFile, org.jabref.model.schema.DublinCoreSchemaCustom, org.apache.pdfbox.Loader, org.apache.pdfbox.pdmodel.PDDocument, org.apache.pdfbox.pdmodel.PDDocumentCatalog, org.apache.pdfbox.pdmodel.PDDocumentInformation, org.apache.pdfbox.pdmodel.common.PDMetadata, org.apache.xmpbox.XMPMetadata, org.apache.xmpbox.schema.DublinCoreSchema, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
private static final String
private static final Logger
private static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private List<org.apache.xmpbox.XMPMetadata>

Returns:

empty List if no metadata has been found, or cannot properly find start or end tag in metadata
getXmpMetadata
(org.apache.pdfbox.pdmodel.PDDocument document)

This method is a hack to generate multiple XMPMetadata objects, because the implementation of the pdfbox does not support methods for reading multiple DublinCoreSchemas from a single metadata entry.

public org.apache.pdfbox.pdmodel.PDDocument
loadWithAutomaticDecryption(Path
The path to load.
path
)

Loads the specified file with the basic pdfbox functionality and uses an empty string as default password.

public List<org.apache.xmpbox.XMPMetadata>

Returns:

The XMPMetadata object found in the file
readRawXmp
(Path
The path to read the XMPMetadata from.
path
)

Will read the XMPMetadata from the given pdf file, closing the file afterwards.

public List<BibEntry>

Returns:

list of BibEntries retrieved from the stream. May be empty, but never null
readXmp
(Path
The path to read from.
path
,
XmpPreferences xmpPreferences)

Try to read the given BibTexEntry from the XMP-stream of the given inputstream containing a PDF-file.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

END_TAGback to summary
private static final String END_TAG
LOGGERback to summary
private static final Logger LOGGER
START_TAGback to summary
private static final String START_TAG

Constructor Detail

XmpUtilReaderback to summary
public XmpUtilReader()

Method Detail

getXmpMetadataback to summary
private List<org.apache.xmpbox.XMPMetadata> getXmpMetadata(org.apache.pdfbox.pdmodel.PDDocument document)

This method is a hack to generate multiple XMPMetadata objects, because the implementation of the pdfbox does not support methods for reading multiple DublinCoreSchemas from a single metadata entry.

Returns:List<org.apache.xmpbox.XMPMetadata>

empty List if no metadata has been found, or cannot properly find start or end tag in metadata

loadWithAutomaticDecryptionback to summary
public org.apache.pdfbox.pdmodel.PDDocument loadWithAutomaticDecryption(Path path) throws IOException

Loads the specified file with the basic pdfbox functionality and uses an empty string as default password.

Parameters
path:Path

The path to load.

Exceptions
IOException:
from the underlying @link PDDocument#load(File)
readRawXmpback to summary
public List<org.apache.xmpbox.XMPMetadata> readRawXmp(Path path) throws IOException

Will read the XMPMetadata from the given pdf file, closing the file afterwards.

Parameters
path:Path

The path to read the XMPMetadata from.

Returns:List<org.apache.xmpbox.XMPMetadata>

The XMPMetadata object found in the file

readXmpback to summary
public List<BibEntry> readXmp(Path path, XmpPreferences xmpPreferences) throws IOException

Try to read the given BibTexEntry from the XMP-stream of the given inputstream containing a PDF-file. Only supports Dublin Core as a metadata format.

Parameters
path:Path

The path to read from.

Returns:List<BibEntry>

list of BibEntries retrieved from the stream. May be empty, but never null

Exceptions
IOException:
Throws an IOException if the file cannot be read, so the user than remove a lock or cancel the operation.