public class MapWritable extends Object implements Writable
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.| Modifier and Type | Field and Description |
|---|---|
static org.apache.commons.logging.Log |
LOG |
| Constructor and Description |
|---|
MapWritable() |
MapWritable(MapWritable map)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
containsKey(Writable key) |
boolean |
containsValue(Writable value) |
boolean |
equals(Object obj) |
Writable |
get(Writable key) |
int |
hashCode() |
boolean |
isEmpty() |
Set |
keySet() |
Writable |
put(Writable key,
Writable value) |
void |
putAll(MapWritable map) |
void |
readFields(DataInput in)
Reads the fields of this object from
in. |
Writable |
remove(Writable key) |
int |
size() |
String |
toString() |
Collection |
values() |
void |
write(DataOutput out)
Writes the fields of this object to
out. |
public MapWritable()
public MapWritable(MapWritable map)
map - map to copy frompublic void clear()
public boolean containsKey(Writable key)
public boolean containsValue(Writable value)
public boolean isEmpty()
public Set keySet()
public void putAll(MapWritable map)
public int size()
public Collection values()
public void write(DataOutput out) throws IOException
Writableout.write in interface WritableIOExceptionpublic void readFields(DataInput in) throws IOException
Writablein. For efficiency,
implementations should attempt to re-use storage in the existing object
where possible.readFields in interface WritableIOExceptionCopyright © 2007, 2014, Oracle and/or its affiliates. All rights reserved.