Package org.apache.nutch.metadata
Class MetaWrapper
java.lang.Object
org.apache.hadoop.io.GenericWritable
org.apache.nutch.util.GenericWritableConfigurable
org.apache.nutch.crawl.NutchWritable
org.apache.nutch.metadata.MetaWrapper
- All Implemented Interfaces:
Configurable,Writable
This is a simple decorator that adds metadata to any Writable-s that can be
serialized by
NutchWritable. This is useful when data needs to be
temporarily enriched during processing, but this temporary metadata doesn't
need to be permanently stored after the job is done.- Author:
- Andrzej Bialecki
-
Constructor Summary
ConstructorsConstructorDescriptionMetaWrapper(Writable instance, Configuration conf) MetaWrapper(Metadata metadata, Writable instance, Configuration conf) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd metadata.Get metadata value for a given key.Get all metadata.String[]getMetaValues(String name) Get multiple metadata values for a given key.voidreadFields(DataInput in) voidSet metadata.voidwrite(DataOutput out) Methods inherited from class org.apache.nutch.crawl.NutchWritable
getTypesMethods inherited from class org.apache.nutch.util.GenericWritableConfigurable
getConf, setConfMethods inherited from class org.apache.hadoop.io.GenericWritable
get, set, toString
-
Constructor Details
-
MetaWrapper
public MetaWrapper() -
MetaWrapper
-
MetaWrapper
-
-
Method Details
-
getMetadata
Get all metadata.- Returns:
- a populated
Metadataobject
-
addMeta
Add metadata.- Parameters:
name- metadata name to addvalue- metadata value to add- See Also:
-
setMeta
Set metadata.- Parameters:
name- metadata key to setvalue- metadata value to set- See Also:
-
getMeta
Get metadata value for a given key.- Parameters:
name- key to retrieve a value for- Returns:
- metadata value
- See Also:
-
getMetaValues
Get multiple metadata values for a given key.- Parameters:
name- key to retrieve values for- Returns:
- a string array containing metadata values
- See Also:
-
readFields
- Specified by:
readFieldsin interfaceWritable- Overrides:
readFieldsin classGenericWritableConfigurable- Throws:
IOException
-
write
- Specified by:
writein interfaceWritable- Overrides:
writein classGenericWritable- Throws:
IOException
-