org.apache.nutch.crawl
Class MapWritable
java.lang.Object
org.apache.nutch.crawl.MapWritable
- All Implemented Interfaces:
- org.apache.hadoop.io.Writable
public class MapWritable
- extends Object
- implements org.apache.hadoop.io.Writable
A writable map, with a similar behavior as java.util.HashMap
.
In addition to the size of key and value writable tuple two additional bytes
are stored to identify the Writable classes. This means that a maximum of
255 different class types can be used for key and value objects.
A binary-id to class mapping is defined in a static block of this class.
However it is possible to use custom implementations of Writable.
For these custom Writables we write the byte id - utf class name tuple
into the header of each MapWritable that uses these types.
- Author:
- Stefan Groschupf
Field Summary |
static org.apache.commons.logging.Log |
LOG
|
LOG
public static final org.apache.commons.logging.Log LOG
MapWritable
public MapWritable()
MapWritable
public MapWritable(MapWritable map)
- Copy constructor. This constructor makes a deep copy, using serialization /
deserialization to break any possible references to contained objects.
- Parameters:
map
- map to copy from
clear
public void clear()
containsKey
public boolean containsKey(org.apache.hadoop.io.Writable key)
containsValue
public boolean containsValue(org.apache.hadoop.io.Writable value)
get
public org.apache.hadoop.io.Writable get(org.apache.hadoop.io.Writable key)
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
isEmpty
public boolean isEmpty()
keySet
public Set<org.apache.hadoop.io.Writable> keySet()
put
public org.apache.hadoop.io.Writable put(org.apache.hadoop.io.Writable key,
org.apache.hadoop.io.Writable value)
putAll
public void putAll(MapWritable map)
remove
public org.apache.hadoop.io.Writable remove(org.apache.hadoop.io.Writable key)
size
public int size()
values
public Collection<org.apache.hadoop.io.Writable> values()
equals
public boolean equals(Object obj)
- Overrides:
equals
in class Object
toString
public String toString()
- Overrides:
toString
in class Object
write
public void write(DataOutput out)
throws IOException
- Specified by:
write
in interface org.apache.hadoop.io.Writable
- Throws:
IOException
readFields
public void readFields(DataInput in)
throws IOException
- Specified by:
readFields
in interface org.apache.hadoop.io.Writable
- Throws:
IOException
Copyright © 2006 The Apache Software Foundation