org.apache.hadoop.hbase.io
Class HbaseMapWritable<K,V>

java.lang.Object
  extended by org.apache.hadoop.hbase.io.HbaseMapWritable<K,V>
Type Parameters:
K - key TODO: Parameter K is never used, could be removed.
V - value Expects a Writable or byte [].
All Implemented Interfaces:
Map<byte[],V>, SortedMap<byte[],V>, org.apache.hadoop.conf.Configurable, CodeToClassAndBack, org.apache.hadoop.io.Writable

public class HbaseMapWritable<K,V>
extends Object
implements SortedMap<byte[],V>, org.apache.hadoop.conf.Configurable, org.apache.hadoop.io.Writable, CodeToClassAndBack

A Writable Map. Like MapWritable but dumb. It will fail if passed a value type that it has not already been told about. Its been primed with hbase Writables and byte []. Keys are always byte arrays.


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.io.CodeToClassAndBack
CodeToClassAndBack.InternalStaticLoader
 
Field Summary
protected  SortedMap<byte[],V> instance
           
 
Fields inherited from interface org.apache.hadoop.hbase.io.CodeToClassAndBack
CLASS_TO_CODE, classList, CODE_TO_CLASS, sl
 
Constructor Summary
HbaseMapWritable()
          The default contructor where a TreeMap is used
HbaseMapWritable(SortedMap<byte[],V> map)
          Contructor where another SortedMap can be used
 
Method Summary
 void clear()
           
 Comparator<? super byte[]> comparator()
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 Set<Map.Entry<byte[],V>> entrySet()
           
 byte[] firstKey()
           
 V get(Object key)
           
protected  Class<?> getClass(byte id)
           
 org.apache.hadoop.conf.Configuration getConf()
           
protected  byte getId(Class<?> clazz)
           
 SortedMap<byte[],V> headMap(byte[] toKey)
           
 boolean isEmpty()
           
 Set<byte[]> keySet()
           
 byte[] lastKey()
           
 V put(byte[] key, V value)
           
 void putAll(Map<? extends byte[],? extends V> m)
           
 void readFields(DataInput in)
           
 V remove(Object key)
           
 void setConf(org.apache.hadoop.conf.Configuration conf)
           
 int size()
           
 SortedMap<byte[],V> subMap(byte[] fromKey, byte[] toKey)
           
 SortedMap<byte[],V> tailMap(byte[] fromKey)
           
 String toString()
           
 Collection<V> values()
           
 void write(DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

instance

protected SortedMap<byte[],V> instance
Constructor Detail

HbaseMapWritable

public HbaseMapWritable()
The default contructor where a TreeMap is used


HbaseMapWritable

public HbaseMapWritable(SortedMap<byte[],V> map)
Contructor where another SortedMap can be used

Parameters:
map - the SortedMap to be used
Method Detail

getConf

public org.apache.hadoop.conf.Configuration getConf()
Specified by:
getConf in interface org.apache.hadoop.conf.Configurable
Returns:
the conf

setConf

public void setConf(org.apache.hadoop.conf.Configuration conf)
Specified by:
setConf in interface org.apache.hadoop.conf.Configurable
Parameters:
conf - the conf to set

clear

public void clear()
Specified by:
clear in interface Map<byte[],V>

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<byte[],V>

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map<byte[],V>

entrySet

public Set<Map.Entry<byte[],V>> entrySet()
Specified by:
entrySet in interface Map<byte[],V>
Specified by:
entrySet in interface SortedMap<byte[],V>

get

public V get(Object key)
Specified by:
get in interface Map<byte[],V>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<byte[],V>

keySet

public Set<byte[]> keySet()
Specified by:
keySet in interface Map<byte[],V>
Specified by:
keySet in interface SortedMap<byte[],V>

size

public int size()
Specified by:
size in interface Map<byte[],V>

values

public Collection<V> values()
Specified by:
values in interface Map<byte[],V>
Specified by:
values in interface SortedMap<byte[],V>

putAll

public void putAll(Map<? extends byte[],? extends V> m)
Specified by:
putAll in interface Map<byte[],V>

remove

public V remove(Object key)
Specified by:
remove in interface Map<byte[],V>

put

public V put(byte[] key,
             V value)
Specified by:
put in interface Map<byte[],V>

comparator

public Comparator<? super byte[]> comparator()
Specified by:
comparator in interface SortedMap<byte[],V>

firstKey

public byte[] firstKey()
Specified by:
firstKey in interface SortedMap<byte[],V>

headMap

public SortedMap<byte[],V> headMap(byte[] toKey)
Specified by:
headMap in interface SortedMap<byte[],V>

lastKey

public byte[] lastKey()
Specified by:
lastKey in interface SortedMap<byte[],V>

subMap

public SortedMap<byte[],V> subMap(byte[] fromKey,
                                  byte[] toKey)
Specified by:
subMap in interface SortedMap<byte[],V>

tailMap

public SortedMap<byte[],V> tailMap(byte[] fromKey)
Specified by:
tailMap in interface SortedMap<byte[],V>

getClass

protected Class<?> getClass(byte id)
Returns:
the Class class for the specified id

getId

protected byte getId(Class<?> clazz)
Returns:
the id for the specified Class

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

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 © 2011 The Apache Software Foundation. All Rights Reserved.