Package org.apache.tika.metadata
Class Metadata
- java.lang.Object
- 
- org.apache.tika.metadata.Metadata
 
- 
- All Implemented Interfaces:
- Serializable,- ClimateForcast,- CreativeCommons,- Geographic,- HttpHeaders,- Message,- TIFF,- TikaMimeKeys
 - Direct Known Subclasses:
- XMPMetadata
 
 public class Metadata extends Object implements CreativeCommons, Geographic, HttpHeaders, Message, ClimateForcast, TIFF, TikaMimeKeys, Serializable A multi-valued metadata container.- See Also:
- Serialized Form
 
- 
- 
Field Summary- 
Fields inherited from interface org.apache.tika.metadata.ClimateForcastACKNOWLEDGEMENT, COMMAND_LINE, COMMENT, CONTACT, CONVENTIONS, EXPERIMENT_ID, HISTORY, INSTITUTION, MODEL_NAME_ENGLISH, PROGRAM_ID, PROJECT_ID, REALIZATION, REFERENCES, SOURCE, TABLE_ID
 - 
Fields inherited from interface org.apache.tika.metadata.CreativeCommonsLICENSE_LOCATION, LICENSE_URL, WORK_TYPE
 - 
Fields inherited from interface org.apache.tika.metadata.GeographicALTITUDE, LATITUDE, LONGITUDE
 - 
Fields inherited from interface org.apache.tika.metadata.HttpHeadersCONTENT_DISPOSITION, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_LOCATION, CONTENT_MD5, CONTENT_TYPE, LOCATION
 - 
Fields inherited from interface org.apache.tika.metadata.MessageMESSAGE_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.TIFFBITS_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.TikaMimeKeysMIME_TYPE_MAGIC, TIKA_MIME_FILE
 
- 
 - 
Constructor SummaryConstructors Constructor Description Metadata()Constructs a new, empty metadata.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(String name, String value)Add a metadata name/value mapping.protected voidadd(String name, String[] newValues)Add a metadata name/value mapping.voidadd(Property property, int value)Adds the integer value of the identified metadata property.voidadd(Property property, String value)Add a metadata property/value mapping.voidadd(Property property, Calendar date)Adds the date value of the identified metadata property.booleanequals(Object o)Stringget(String name)Get the value associated to a metadata name.Stringget(Property property)Returns the value (if any) of the identified metadata property.DategetDate(Property property)Returns the value of the identified Date based metadata property.IntegergetInt(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.long[]getLongValues(Property property)Gets the array of ints of the identified "seq" integer metadata property.String[]getValues(String name)Get the values associated to a metadata name.String[]getValues(Property property)Get the values associated to a metadata name.inthashCode()booleanisMultiValued(String name)Returns true if named value is multivalued.booleanisMultiValued(Property property)Returns true if named value is multivalued.String[]names()Returns an array of the names contained in the metadata.voidremove(String name)Remove a metadata and all its associated values.voidset(String name, String value)Set metadata name/value.protected voidset(String name, String[] values)voidset(Property property, boolean value)Sets the integer value of the identified metadata property.voidset(Property property, double value)Sets the real or rational value of the identified metadata property.voidset(Property property, int value)Sets the integer value of the identified metadata property.voidset(Property property, long value)Sets the integer value of the identified metadata property.voidset(Property property, String value)Sets the value of the identified metadata property.voidset(Property property, String[] values)Sets the values of the identified metadata property.voidset(Property property, Calendar date)Sets the date value of the identified metadata property.voidset(Property property, Date date)Sets the date value of the identified metadata property.voidsetAll(Properties properties)Copy All key-value pairs from properties.voidsetMetadataWriteFilter(MetadataWriteFilter writeFilter)Sets the writeFilter that is called beforeset(String, String)set(String, String[]),add(String, String),add(String, String[]).intsize()Returns the number of metadata names in this metadata.StringtoString()
 
- 
- 
- 
Method Detail- 
isMultiValuedpublic 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
 
 - 
isMultiValuedpublic boolean isMultiValued(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
 
 - 
namespublic String[] names() Returns an array of the names contained in the metadata.- Returns:
- Metadata names
 
 - 
getpublic String get(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.
 
 - 
setMetadataWriteFilterpublic void setMetadataWriteFilter(MetadataWriteFilter writeFilter) Sets the writeFilter that is called beforeset(String, String)set(String, String[]),add(String, String),add(String, String[]). The default isACCEPT_ALL. This is intended for expert use only. Some parsers rely on metadata during the parse, and if the metadata they need is excluded, they will not function properly.- Parameters:
- writeFilter-
- Since:
- 2.4.0
 
 - 
getpublic String get(Property property) Returns the value (if any) of the identified metadata property.- Parameters:
- property- property definition
- Returns:
- property value, or nullif the property is not set
- Since:
- Apache Tika 0.7
 
 - 
getIntpublic 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 nullif the property is not set, or not a valid Integer
- Since:
- Apache Tika 0.8
 
 - 
getDatepublic 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 nullif the property is not set, or not a valid Date
- Since:
- Apache Tika 0.8
 
 - 
getValuespublic 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.
 
 - 
getValuespublic String[] getValues(String name) Get the values associated to a metadata name.- Parameters:
- name- of the metadata.
- Returns:
- the values associated to a metadata name.
 
 - 
addpublic void add(String name, 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.
 
 - 
addprotected void add(String name, String[] newValues) 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.
- newValues- the metadata values
 
 - 
addpublic void add(Property property, 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.
 
 - 
setAllpublic void setAll(Properties properties) Copy All key-value pairs from properties.- Parameters:
- properties- properties to copy from
 
 - 
setpublic void set(String name, 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, or- null
 
 - 
setpublic void set(Property property, String value) Sets the value of the identified metadata property.- Parameters:
- property- property definition
- value- property value
- Since:
- Apache Tika 0.7
 
 - 
setpublic void set(Property property, String[] values) Sets the values of the identified metadata property.- Parameters:
- property- property definition
- values- property values
- Since:
- Apache Tika 1.2
 
 - 
setpublic void set(Property property, int value) Sets the integer value of the identified metadata property.- Parameters:
- property- simple integer property definition
- value- property value
- Since:
- Apache Tika 0.8
 
 - 
setpublic void set(Property property, long value) Sets the integer value of the identified metadata property.- Parameters:
- property- simple integer property definition
- value- property value
- Since:
- Apache Tika 0.8
 
 - 
setpublic void set(Property property, boolean value) Sets the integer value of the identified metadata property.- Parameters:
- property- simple integer property definition
- value- property value
- Since:
- Apache Tika 2.1.1
 
 - 
addpublic void add(Property property, int value) Adds the integer value of the identified metadata property.- Parameters:
- property- seq integer property definition
- value- property value
- Since:
- Apache Tika 1.21
 
 - 
getIntValuespublic 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
 
 - 
getLongValuespublic long[] getLongValues(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
 
 - 
setpublic 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 definition
- value- property value
- Since:
- Apache Tika 0.8
 
 - 
setpublic void set(Property property, Date date) Sets the date value of the identified metadata property.- Parameters:
- property- simple integer property definition
- date- property value
- Since:
- Apache Tika 0.8
 
 - 
setpublic void set(Property property, Calendar date) Sets the date value of the identified metadata property.- Parameters:
- property- simple integer property definition
- date- property value
- Since:
- Apache Tika 0.8
 
 - 
addpublic void add(Property property, Calendar date) Adds the date value of the identified metadata property.- Parameters:
- property- simple calendar property definition
- date- property value
- Since:
- Apache Tika 2.5.0
 
 - 
removepublic void remove(String name) Remove a metadata and all its associated values.- Parameters:
- name- metadata name to remove
 
 - 
sizepublic int size() Returns the number of metadata names in this metadata.- Returns:
- number of metadata names
 
 
- 
 
-