public class HMapILW extends HMapIL implements org.apache.hadoop.io.Writable
Writable representing a map where both keys and values are ints.
One notable feature of this class is the ability to support lazy decoding, controlled by
the setLazyDecodeFlag(boolean) method. In lazy decoding mode, when an object of this
type is deserialized, key-value pairs are not inserted into the map, but rather held in arrays.
The reduces memory used in cases where random access to values is not required. In lazy decoding
mode, the raw keys and values may be fetched by the getKeys() and getValues()
methods, respectively. The map can be subsequently populated with the decode() method.
DEFAULT_VALUE| Constructor and Description |
|---|
HMapILW()
Creates a
HMapILW object. |
| Modifier and Type | Method and Description |
|---|---|
static HMapILW |
create(byte[] bytes)
Creates a
HMapILW object from a byte array. |
static HMapILW |
create(DataInput in)
Creates a
HMapILW object from a DataInput. |
void |
decode()
In lazy decoding mode, populates the map with deserialized data.
|
int[] |
getKeys()
In lazy decoding mode, returns an array of all the keys if the map hasn't been decoded yet.
|
static boolean |
getLazyDecodeFlag()
Returns the value of the lazy decoding flag
|
long[] |
getValues()
In lazy decoding mode, returns an array of all the values if the map hasn't been decoded yet.
|
boolean |
isDecoded()
Returns whether or not this map has been decoded.
|
void |
lazyplus(HMapILW m)
In lazy decoding mode, adds values from keys of another map to this map.
|
void |
readFields(DataInput in)
Deserializes the map.
|
byte[] |
serialize()
Returns the serialized representation of this object as a byte array.
|
static void |
setLazyDecodeFlag(boolean b)
Sets the lazy decoding flag.
|
int |
size()
Returns the number of key-value mappings in this map.
|
void |
write(DataOutput out)
Serializes the map.
|
clear, clone, containsKey, containsValue, dot, entrySet, get, getEntriesSortedByValue, getEntriesSortedByValue, increment, increment, isEmpty, keySet, plus, put, putAll, remove, toString, valuespublic void readFields(DataInput in) throws IOException
readFields in interface org.apache.hadoop.io.Writablein - source for raw byte representationIOExceptionpublic void decode()
throws IOException
IOExceptionpublic boolean isDecoded()
public void write(DataOutput out) throws IOException
write in interface org.apache.hadoop.io.Writableout - where to write the raw byte representationIOExceptionpublic byte[] serialize()
throws IOException
IOExceptionpublic static HMapILW create(DataInput in) throws IOException
HMapILW object from a DataInput.in - source for reading the serialized representationHMapILW objectIOExceptionpublic static HMapILW create(byte[] bytes) throws IOException
HMapILW object from a byte array.bytes - raw serialized representationHMapILW objectIOExceptionpublic static void setLazyDecodeFlag(boolean b)
public static boolean getLazyDecodeFlag()
public int[] getKeys()
public long[] getValues()
public void lazyplus(HMapILW m)
m - the other mapCopyright © 2014. All rights reserved.