Package org.apache.tika.metadata
Class Metadata
- java.lang.Object
-
- org.apache.tika.metadata.Metadata
-
- All Implemented Interfaces:
java.io.Serializable
,ClimateForcast
,CreativeCommons
,Geographic
,HttpHeaders
,Message
,MSOffice
,TIFF
,TikaMetadataKeys
,TikaMimeKeys
public class Metadata extends java.lang.Object implements CreativeCommons, Geographic, HttpHeaders, Message, MSOffice, ClimateForcast, TIFF, TikaMetadataKeys, TikaMimeKeys, java.io.Serializable
A multi-valued metadata container.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CONTRIBUTOR
Deprecated.use TikaCoreProperties#CONTRIBUTORstatic java.lang.String
COVERAGE
Deprecated.use TikaCoreProperties#COVERAGEstatic java.lang.String
CREATOR
Deprecated.use TikaCoreProperties#CREATORstatic Property
DATE
Deprecated.use TikaCoreProperties#CREATEDstatic java.lang.String
DESCRIPTION
Deprecated.use TikaCoreProperties#DESCRIPTIONstatic java.lang.String
FORMAT
Deprecated.use TikaCoreProperties#FORMATstatic java.lang.String
IDENTIFIER
Deprecated.use TikaCoreProperties#IDENTIFIERstatic java.lang.String
LANGUAGE
Deprecated.use TikaCoreProperties#LANGUAGEstatic java.lang.String
MODIFIED
Deprecated.use TikaCoreProperties#MODIFIEDstatic java.lang.String
NAMESPACE_PREFIX_DELIMITER
The common delimiter used between the namespace abbreviation and the property namestatic java.lang.String
PUBLISHER
Deprecated.use TikaCoreProperties#PUBLISHERstatic java.lang.String
RELATION
Deprecated.use TikaCoreProperties#RELATIONstatic java.lang.String
RIGHTS
Deprecated.use TikaCoreProperties#RIGHTSstatic java.lang.String
SOURCE
Deprecated.use TikaCoreProperties#SOURCEstatic java.lang.String
SUBJECT
Deprecated.use TikaCoreProperties#KEYWORDSstatic java.lang.String
TITLE
Deprecated.use TikaCoreProperties#TITLEstatic java.lang.String
TYPE
Deprecated.use TikaCoreProperties#TYPE-
Fields inherited from interface org.apache.tika.metadata.ClimateForcast
ACKNOWLEDGEMENT, COMMAND_LINE, COMMENT, CONTACT, CONVENTIONS, EXPERIMENT_ID, HISTORY, INSTITUTION, MODEL_NAME_ENGLISH, PROGRAM_ID, PROJECT_ID, REALIZATION, REFERENCES, TABLE_ID
-
Fields inherited from interface org.apache.tika.metadata.CreativeCommons
LICENSE_LOCATION, LICENSE_URL, WORK_TYPE
-
Fields inherited from interface org.apache.tika.metadata.Geographic
ALTITUDE, LATITUDE, LONGITUDE
-
Fields inherited from interface org.apache.tika.metadata.HttpHeaders
CONTENT_DISPOSITION, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_LOCATION, CONTENT_MD5, CONTENT_TYPE, LAST_MODIFIED, LOCATION
-
Fields inherited from interface org.apache.tika.metadata.Message
MESSAGE_BCC, MESSAGE_BCC_DISPLAY_NAME, MESSAGE_BCC_EMAIL, MESSAGE_BCC_NAME, MESSAGE_CC, MESSAGE_CC_DISPLAY_NAME, MESSAGE_CC_EMAIL, MESSAGE_CC_NAME, MESSAGE_FROM, MESSAGE_FROM_EMAIL, MESSAGE_FROM_NAME, MESSAGE_PREFIX, MESSAGE_RAW_HEADER_PREFIX, MESSAGE_RECIPIENT_ADDRESS, MESSAGE_TO, MESSAGE_TO_DISPLAY_NAME, MESSAGE_TO_EMAIL, MESSAGE_TO_NAME, MULTIPART_BOUNDARY, MULTIPART_SUBTYPE
-
Fields inherited from interface org.apache.tika.metadata.MSOffice
APPLICATION_NAME, APPLICATION_VERSION, AUTHOR, CATEGORY, CHARACTER_COUNT, CHARACTER_COUNT_WITH_SPACES, COMMENTS, COMPANY, CONTENT_STATUS, CREATION_DATE, EDIT_TIME, IMAGE_COUNT, KEYWORDS, LAST_AUTHOR, LAST_PRINTED, LAST_SAVED, LINE_COUNT, MANAGER, NOTES, OBJECT_COUNT, PAGE_COUNT, PARAGRAPH_COUNT, PRESENTATION_FORMAT, REVISION_NUMBER, SECURITY, SLIDE_COUNT, TABLE_COUNT, TEMPLATE, TOTAL_TIME, USER_DEFINED_METADATA_NAME_PREFIX, VERSION, WORD_COUNT
-
Fields inherited from interface org.apache.tika.metadata.TIFF
BITS_PER_SAMPLE, EQUIPMENT_MAKE, EQUIPMENT_MODEL, EXIF_PAGE_COUNT, EXPOSURE_TIME, F_NUMBER, FLASH_FIRED, FOCAL_LENGTH, IMAGE_LENGTH, IMAGE_WIDTH, ISO_SPEED_RATINGS, ORIENTATION, ORIGINAL_DATE, RESOLUTION_HORIZONTAL, RESOLUTION_UNIT, RESOLUTION_VERTICAL, SAMPLES_PER_PIXEL, SOFTWARE
-
Fields inherited from interface org.apache.tika.metadata.TikaMetadataKeys
EMBEDDED_RELATIONSHIP_ID, EMBEDDED_RESOURCE_TYPE, EMBEDDED_STORAGE_CLASS_ID, PROTECTED, RESOURCE_NAME_KEY
-
Fields inherited from interface org.apache.tika.metadata.TikaMimeKeys
MIME_TYPE_MAGIC, TIKA_MIME_FILE
-
-
Constructor Summary
Constructors Constructor Description Metadata()
Constructs a new, empty metadata.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(java.lang.String name, java.lang.String value)
Add a metadata name/value mapping.void
add(Property property, int value)
Adds the integer value of the identified metadata property.void
add(Property property, java.lang.String value)
Add a metadata property/value mapping.boolean
equals(java.lang.Object o)
java.lang.String
get(java.lang.String name)
Get the value associated to a metadata name.java.lang.String
get(Property property)
Returns the value (if any) of the identified metadata property.java.util.Date
getDate(Property property)
Returns the value of the identified Date based metadata property.java.lang.Integer
getInt(Property property)
Returns the value of the identified Integer based metadata property.int[]
getIntValues(Property property)
Gets the array of ints of the identified "seq" integer metadata property.java.lang.String[]
getValues(java.lang.String name)
Get the values associated to a metadata name.java.lang.String[]
getValues(Property property)
Get the values associated to a metadata name.int
hashCode()
boolean
isMultiValued(java.lang.String name)
Returns true if named value is multivalued.boolean
isMultiValued(Property property)
Returns true if named value is multivalued.java.lang.String[]
names()
Returns an array of the names contained in the metadata.void
remove(java.lang.String name)
Remove a metadata and all its associated values.void
set(java.lang.String name, java.lang.String value)
Set metadata name/value.void
set(Property property, double value)
Sets the real or rational value of the identified metadata property.void
set(Property property, int value)
Sets the integer value of the identified metadata property.void
set(Property property, java.lang.String value)
Sets the value of the identified metadata property.void
set(Property property, java.lang.String[] values)
Sets the values of the identified metadata property.void
set(Property property, java.util.Calendar date)
Sets the date value of the identified metadata property.void
set(Property property, java.util.Date date)
Sets the date value of the identified metadata property.void
setAll(java.util.Properties properties)
Copy All key-value pairs from properties.int
size()
Returns the number of metadata names in this metadata.java.lang.String
toString()
-
-
-
Field Detail
-
NAMESPACE_PREFIX_DELIMITER
public static final java.lang.String NAMESPACE_PREFIX_DELIMITER
The common delimiter used between the namespace abbreviation and the property name- See Also:
- Constant Field Values
-
FORMAT
public static final java.lang.String FORMAT
Deprecated.use TikaCoreProperties#FORMAT- See Also:
- Constant Field Values
-
IDENTIFIER
public static final java.lang.String IDENTIFIER
Deprecated.use TikaCoreProperties#IDENTIFIER- See Also:
- Constant Field Values
-
MODIFIED
public static final java.lang.String MODIFIED
Deprecated.use TikaCoreProperties#MODIFIED- See Also:
- Constant Field Values
-
CONTRIBUTOR
public static final java.lang.String CONTRIBUTOR
Deprecated.use TikaCoreProperties#CONTRIBUTOR- See Also:
- Constant Field Values
-
COVERAGE
public static final java.lang.String COVERAGE
Deprecated.use TikaCoreProperties#COVERAGE- See Also:
- Constant Field Values
-
CREATOR
public static final java.lang.String CREATOR
Deprecated.use TikaCoreProperties#CREATOR- See Also:
- Constant Field Values
-
DATE
public static final Property DATE
Deprecated.use TikaCoreProperties#CREATED
-
DESCRIPTION
public static final java.lang.String DESCRIPTION
Deprecated.use TikaCoreProperties#DESCRIPTION- See Also:
- Constant Field Values
-
LANGUAGE
public static final java.lang.String LANGUAGE
Deprecated.use TikaCoreProperties#LANGUAGE- See Also:
- Constant Field Values
-
PUBLISHER
public static final java.lang.String PUBLISHER
Deprecated.use TikaCoreProperties#PUBLISHER- See Also:
- Constant Field Values
-
RELATION
public static final java.lang.String RELATION
Deprecated.use TikaCoreProperties#RELATION- See Also:
- Constant Field Values
-
RIGHTS
public static final java.lang.String RIGHTS
Deprecated.use TikaCoreProperties#RIGHTS- See Also:
- Constant Field Values
-
SOURCE
public static final java.lang.String SOURCE
Deprecated.use TikaCoreProperties#SOURCE- See Also:
- Constant Field Values
-
SUBJECT
public static final java.lang.String SUBJECT
Deprecated.use TikaCoreProperties#KEYWORDS- See Also:
- Constant Field Values
-
TITLE
public static final java.lang.String TITLE
Deprecated.use TikaCoreProperties#TITLE- See Also:
- Constant Field Values
-
TYPE
public static final java.lang.String TYPE
Deprecated.use TikaCoreProperties#TYPE- See Also:
- Constant Field Values
-
-
Method Detail
-
isMultiValued
public boolean isMultiValued(Property property)
Returns true if named value is multivalued.- Parameters:
property
- metadata property- Returns:
- true is named value is multivalued, false if single value or null
-
isMultiValued
public boolean isMultiValued(java.lang.String name)
Returns true if named value is multivalued.- Parameters:
name
- name of metadata- Returns:
- true is named value is multivalued, false if single value or null
-
names
public java.lang.String[] names()
Returns an array of the names contained in the metadata.- Returns:
- Metadata names
-
get
public java.lang.String get(java.lang.String name)
Get the value associated to a metadata name. If many values are assiociated to the specified name, then the first one is returned.- Parameters:
name
- of the metadata.- Returns:
- the value associated to the specified metadata name.
-
get
public java.lang.String get(Property property)
Returns the value (if any) of the identified metadata property.- Parameters:
property
- property definition- Returns:
- property value, or
null
if the property is not set - Since:
- Apache Tika 0.7
-
getInt
public java.lang.Integer getInt(Property property)
Returns the value of the identified Integer based metadata property.- Parameters:
property
- simple integer property definition- Returns:
- property value as a Integer, or
null
if the property is not set, or not a valid Integer - Since:
- Apache Tika 0.8
-
getDate
public java.util.Date getDate(Property property)
Returns the value of the identified Date based metadata property.- Parameters:
property
- simple date property definition- Returns:
- property value as a Date, or
null
if the property is not set, or not a valid Date - Since:
- Apache Tika 0.8
-
getValues
public java.lang.String[] getValues(Property property)
Get the values associated to a metadata name.- Parameters:
property
- of the metadata.- Returns:
- the values associated to a metadata name.
-
getValues
public java.lang.String[] getValues(java.lang.String name)
Get the values associated to a metadata name.- Parameters:
name
- of the metadata.- Returns:
- the values associated to a metadata name.
-
add
public void add(java.lang.String name, java.lang.String value)
Add a metadata name/value mapping. Add the specified value to the list of values associated to the specified metadata name.- Parameters:
name
- the metadata name.value
- the metadata value.
-
add
public void add(Property property, java.lang.String value)
Add a metadata property/value mapping. Add the specified value to the list of values associated to the specified metadata property.- Parameters:
property
- the metadata property.value
- the metadata value.
-
setAll
public void setAll(java.util.Properties properties)
Copy All key-value pairs from properties.- Parameters:
properties
- properties to copy from
-
set
public void set(java.lang.String name, java.lang.String value)
Set metadata name/value. Associate the specified value to the specified metadata name. If some previous values were associated to this name, they are removed. If the given value isnull
, then the metadata entry is removed.- Parameters:
name
- the metadata name.value
- the metadata value, ornull
-
set
public void set(Property property, java.lang.String value)
Sets the value of the identified metadata property.- Parameters:
property
- property definitionvalue
- property value- Since:
- Apache Tika 0.7
-
set
public void set(Property property, java.lang.String[] values)
Sets the values of the identified metadata property.- Parameters:
property
- property definitionvalues
- property values- Since:
- Apache Tika 1.2
-
set
public void set(Property property, int value)
Sets the integer value of the identified metadata property.- Parameters:
property
- simple integer property definitionvalue
- property value- Since:
- Apache Tika 0.8
-
add
public void add(Property property, int value)
Adds the integer value of the identified metadata property.- Parameters:
property
- seq integer property definitionvalue
- property value- Since:
- Apache Tika 1.21
-
getIntValues
public int[] getIntValues(Property property)
Gets the array of ints of the identified "seq" integer metadata property.- Parameters:
property
- seq integer property definition- Returns:
- array of ints
- Since:
- Apache Tika 1.21
-
set
public void set(Property property, double value)
Sets the real or rational value of the identified metadata property.- Parameters:
property
- simple real or simple rational property definitionvalue
- property value- Since:
- Apache Tika 0.8
-
set
public void set(Property property, java.util.Date date)
Sets the date value of the identified metadata property.- Parameters:
property
- simple integer property definitiondate
- property value- Since:
- Apache Tika 0.8
-
set
public void set(Property property, java.util.Calendar date)
Sets the date value of the identified metadata property.- Parameters:
property
- simple integer property definitiondate
- property value- Since:
- Apache Tika 0.8
-
remove
public void remove(java.lang.String name)
Remove a metadata and all its associated values.- Parameters:
name
- metadata name to remove
-
size
public int size()
Returns the number of metadata names in this metadata.- Returns:
- number of metadata names
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-