Package org.verapdf.xmp
Class XMPMetaFactory
java.lang.Object
org.verapdf.xmp.XMPMetaFactory
Creates
XMPMeta
-instances from an InputStream
- Since:
- 30.01.2006
-
Method Summary
Modifier and TypeMethodDescriptionstatic XMPMeta
create()
static XMPSchemaRegistry
static XMPVersionInfo
Obtain version information.static XMPMeta
parse
(InputStream in) Parsing with default options.static XMPMeta
parse
(InputStream in, ParseOptions options) These functions support parsing serialized RDF into an XMP object, and serailizing an XMP object into RDF.static XMPMeta
parseFromBuffer
(byte[] buffer) Parsing with default options.static XMPMeta
parseFromBuffer
(byte[] buffer, ParseOptions options) Creates anXMPMeta
-object from a byte-buffer.static XMPMeta
parseFromString
(String packet) Parsing with default options.static XMPMeta
parseFromString
(String packet, ParseOptions options) Creates anXMPMeta
-object from a string.static void
reset()
Resets the schema registry to its original state (creates a new one).static void
serialize
(XMPMeta xmp, OutputStream out) Serializes anXMPMeta
-object as RDF into anOutputStream
with default options.static void
serialize
(XMPMeta xmp, OutputStream out, SerializeOptions options) Serializes anXMPMeta
-object as RDF into anOutputStream
.static byte[]
serializeToBuffer
(XMPMeta xmp, SerializeOptions options) Serializes anXMPMeta
-object as RDF into a byte buffer.static String
serializeToString
(XMPMeta xmp, SerializeOptions options) Serializes anXMPMeta
-object as RDF into a string.
-
Method Details
-
getSchemaRegistry
- Returns:
- Returns the singleton instance of the
XMPSchemaRegistry
.
-
create
- Returns:
- Returns an empty
XMPMeta
-object.
-
parse
Parsing with default options.- Parameters:
in
- anInputStream
- Returns:
- Returns the
XMPMeta
-object created from the input. - Throws:
XMPException
- If the file is not well-formed XML or if the parsing fails.- See Also:
-
parse
These functions support parsing serialized RDF into an XMP object, and serailizing an XMP object into RDF. The input for parsing may be any valid Unicode encoding. ISO Latin-1 is also recognized, but its use is strongly discouraged. Serialization is always as UTF-8.parseFromBuffer()
parses RDF from anInputStream
. The encoding is recognized automatically.- Parameters:
in
- anInputStream
options
- Options controlling the parsing.
The available options are:- XMP_REQUIRE_XMPMETA - The <x:xmpmeta> XML element is required around <rdf:RDF>.
- XMP_STRICT_ALIASING - Do not reconcile alias differences, throw an exception.
- Returns:
- Returns the
XMPMeta
-object created from the input. - Throws:
XMPException
- If the file is not well-formed XML or if the parsing fails.
-
parseFromString
Parsing with default options.- Parameters:
packet
- a String contain an XMP-file.- Returns:
- Returns the
XMPMeta
-object created from the input. - Throws:
XMPException
- If the file is not well-formed XML or if the parsing fails.- See Also:
-
parseFromString
Creates anXMPMeta
-object from a string.- Parameters:
packet
- a String contain an XMP-file.options
- Options controlling the parsing.- Returns:
- Returns the
XMPMeta
-object created from the input. - Throws:
XMPException
- If the file is not well-formed XML or if the parsing fails.- See Also:
-
parseFromBuffer
Parsing with default options.- Parameters:
buffer
- a String contain an XMP-file.- Returns:
- Returns the
XMPMeta
-object created from the input. - Throws:
XMPException
- If the file is not well-formed XML or if the parsing fails.- See Also:
-
parseFromBuffer
Creates anXMPMeta
-object from a byte-buffer.- Parameters:
buffer
- a String contain an XMP-file.options
- Options controlling the parsing.- Returns:
- Returns the
XMPMeta
-object created from the input. - Throws:
XMPException
- If the file is not well-formed XML or if the parsing fails.- See Also:
-
serialize
Serializes anXMPMeta
-object as RDF into anOutputStream
with default options.- Parameters:
xmp
- a metadata objectout
- anOutputStream
to write the serialized RDF to.- Throws:
XMPException
- on serializsation errors.
-
serialize
public static void serialize(XMPMeta xmp, OutputStream out, SerializeOptions options) throws XMPException Serializes anXMPMeta
-object as RDF into anOutputStream
.- Parameters:
xmp
- a metadata objectoptions
- Options to control the serialization (seeSerializeOptions
).out
- anOutputStream
to write the serialized RDF to.- Throws:
XMPException
- on serializsation errors.
-
serializeToBuffer
Serializes anXMPMeta
-object as RDF into a byte buffer.- Parameters:
xmp
- a metadata objectoptions
- Options to control the serialization (seeSerializeOptions
).- Returns:
- Returns a byte buffer containing the serialized RDF.
- Throws:
XMPException
- on serializsation errors.
-
serializeToString
Serializes anXMPMeta
-object as RDF into a string. Note: Encoding is ignored when serializing to a string.- Parameters:
xmp
- a metadata objectoptions
- Options to control the serialization (seeSerializeOptions
).- Returns:
- Returns a string containing the serialized RDF.
- Throws:
XMPException
- on serializsation errors.
-
reset
public static void reset()Resets the schema registry to its original state (creates a new one). Be careful this might break all existing XMPMeta-objects and should be used only for testing purpurses. -
getVersionInfo
Obtain version information. The XMPVersionInfo singleton is created the first time its requested.- Returns:
- Returns the version information.
-