hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject [32/51] [partial] hbase-site git commit: Published site at eea8b38dfa0180d3e6f93d3e8055d5d4fbf673c3.
Date Fri, 11 Mar 2016 17:00:06 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/0b785cb2/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodec.CellDecoder.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodec.CellDecoder.html b/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodec.CellDecoder.html
index 9cc2c69..1d79a4e 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodec.CellDecoder.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodec.CellDecoder.html
@@ -28,106 +28,113 @@
 <span class="sourceLineNo">020</span>import java.io.IOException;<a name="line.20"></a>
 <span class="sourceLineNo">021</span>import java.io.InputStream;<a name="line.21"></a>
 <span class="sourceLineNo">022</span>import java.io.OutputStream;<a name="line.22"></a>
-<span class="sourceLineNo">023</span><a name="line.23"></a>
-<span class="sourceLineNo">024</span>import org.apache.commons.io.IOUtils;<a name="line.24"></a>
-<span class="sourceLineNo">025</span>import org.apache.hadoop.hbase.Cell;<a name="line.25"></a>
-<span class="sourceLineNo">026</span>import org.apache.hadoop.hbase.CellUtil;<a name="line.26"></a>
-<span class="sourceLineNo">027</span>import org.apache.hadoop.hbase.HBaseInterfaceAudience;<a name="line.27"></a>
-<span class="sourceLineNo">028</span>import org.apache.hadoop.hbase.classification.InterfaceAudience;<a name="line.28"></a>
-<span class="sourceLineNo">029</span>import org.apache.hadoop.hbase.util.Bytes;<a name="line.29"></a>
-<span class="sourceLineNo">030</span><a name="line.30"></a>
-<span class="sourceLineNo">031</span>/**<a name="line.31"></a>
-<span class="sourceLineNo">032</span> * Basic Cell codec that just writes out all the individual elements of a Cell.  Uses ints<a name="line.32"></a>
-<span class="sourceLineNo">033</span> * delimiting all lengths. Profligate. Needs tune up.<a name="line.33"></a>
-<span class="sourceLineNo">034</span> * Note: This will not write tags of a Cell.<a name="line.34"></a>
-<span class="sourceLineNo">035</span> */<a name="line.35"></a>
-<span class="sourceLineNo">036</span>@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG)<a name="line.36"></a>
-<span class="sourceLineNo">037</span>public class CellCodec implements Codec {<a name="line.37"></a>
-<span class="sourceLineNo">038</span>  static class CellEncoder extends BaseEncoder {<a name="line.38"></a>
-<span class="sourceLineNo">039</span>    CellEncoder(final OutputStream out) {<a name="line.39"></a>
-<span class="sourceLineNo">040</span>      super(out);<a name="line.40"></a>
-<span class="sourceLineNo">041</span>    }<a name="line.41"></a>
-<span class="sourceLineNo">042</span><a name="line.42"></a>
-<span class="sourceLineNo">043</span>    @Override<a name="line.43"></a>
-<span class="sourceLineNo">044</span>    public void write(Cell cell) throws IOException {<a name="line.44"></a>
-<span class="sourceLineNo">045</span>      checkFlushed();<a name="line.45"></a>
-<span class="sourceLineNo">046</span>      // Row<a name="line.46"></a>
-<span class="sourceLineNo">047</span>      write(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());<a name="line.47"></a>
-<span class="sourceLineNo">048</span>      // Column family<a name="line.48"></a>
-<span class="sourceLineNo">049</span>      write(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength());<a name="line.49"></a>
-<span class="sourceLineNo">050</span>      // Qualifier<a name="line.50"></a>
-<span class="sourceLineNo">051</span>      write(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());<a name="line.51"></a>
-<span class="sourceLineNo">052</span>      // Version<a name="line.52"></a>
-<span class="sourceLineNo">053</span>      this.out.write(Bytes.toBytes(cell.getTimestamp()));<a name="line.53"></a>
-<span class="sourceLineNo">054</span>      // Type<a name="line.54"></a>
-<span class="sourceLineNo">055</span>      this.out.write(cell.getTypeByte());<a name="line.55"></a>
-<span class="sourceLineNo">056</span>      // Value<a name="line.56"></a>
-<span class="sourceLineNo">057</span>      write(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());<a name="line.57"></a>
-<span class="sourceLineNo">058</span>      // MvccVersion<a name="line.58"></a>
-<span class="sourceLineNo">059</span>      this.out.write(Bytes.toBytes(cell.getSequenceId()));<a name="line.59"></a>
-<span class="sourceLineNo">060</span>    }<a name="line.60"></a>
-<span class="sourceLineNo">061</span><a name="line.61"></a>
-<span class="sourceLineNo">062</span>    /**<a name="line.62"></a>
-<span class="sourceLineNo">063</span>     * Write int length followed by array bytes.<a name="line.63"></a>
-<span class="sourceLineNo">064</span>     * @param bytes<a name="line.64"></a>
-<span class="sourceLineNo">065</span>     * @param offset<a name="line.65"></a>
-<span class="sourceLineNo">066</span>     * @param length<a name="line.66"></a>
-<span class="sourceLineNo">067</span>     * @throws IOException<a name="line.67"></a>
-<span class="sourceLineNo">068</span>     */<a name="line.68"></a>
-<span class="sourceLineNo">069</span>    private void write(final byte [] bytes, final int offset, final int length)<a name="line.69"></a>
-<span class="sourceLineNo">070</span>    throws IOException {<a name="line.70"></a>
-<span class="sourceLineNo">071</span>      // TODO add BB backed os check and do for write. Pass Cell<a name="line.71"></a>
-<span class="sourceLineNo">072</span>      this.out.write(Bytes.toBytes(length));<a name="line.72"></a>
-<span class="sourceLineNo">073</span>      this.out.write(bytes, offset, length);<a name="line.73"></a>
-<span class="sourceLineNo">074</span>    }<a name="line.74"></a>
-<span class="sourceLineNo">075</span>  }<a name="line.75"></a>
-<span class="sourceLineNo">076</span><a name="line.76"></a>
-<span class="sourceLineNo">077</span>  static class CellDecoder extends BaseDecoder {<a name="line.77"></a>
-<span class="sourceLineNo">078</span>    public CellDecoder(final InputStream in) {<a name="line.78"></a>
-<span class="sourceLineNo">079</span>      super(in);<a name="line.79"></a>
-<span class="sourceLineNo">080</span>    }<a name="line.80"></a>
-<span class="sourceLineNo">081</span><a name="line.81"></a>
-<span class="sourceLineNo">082</span>    @Override<a name="line.82"></a>
-<span class="sourceLineNo">083</span>    protected Cell parseCell() throws IOException {<a name="line.83"></a>
-<span class="sourceLineNo">084</span>      byte [] row = readByteArray(this.in);<a name="line.84"></a>
-<span class="sourceLineNo">085</span>      byte [] family = readByteArray(in);<a name="line.85"></a>
-<span class="sourceLineNo">086</span>      byte [] qualifier = readByteArray(in);<a name="line.86"></a>
-<span class="sourceLineNo">087</span>      byte [] longArray = new byte[Bytes.SIZEOF_LONG];<a name="line.87"></a>
-<span class="sourceLineNo">088</span>      IOUtils.readFully(this.in, longArray);<a name="line.88"></a>
-<span class="sourceLineNo">089</span>      long timestamp = Bytes.toLong(longArray);<a name="line.89"></a>
-<span class="sourceLineNo">090</span>      byte type = (byte) this.in.read();<a name="line.90"></a>
-<span class="sourceLineNo">091</span>      byte[] value = readByteArray(in);<a name="line.91"></a>
-<span class="sourceLineNo">092</span>      // Read memstore version<a name="line.92"></a>
-<span class="sourceLineNo">093</span>      byte[] memstoreTSArray = new byte[Bytes.SIZEOF_LONG];<a name="line.93"></a>
-<span class="sourceLineNo">094</span>      IOUtils.readFully(this.in, memstoreTSArray);<a name="line.94"></a>
-<span class="sourceLineNo">095</span>      long memstoreTS = Bytes.toLong(memstoreTSArray);<a name="line.95"></a>
-<span class="sourceLineNo">096</span>      return CellUtil.createCell(row, family, qualifier, timestamp, type, value, memstoreTS);<a name="line.96"></a>
-<span class="sourceLineNo">097</span>    }<a name="line.97"></a>
-<span class="sourceLineNo">098</span><a name="line.98"></a>
-<span class="sourceLineNo">099</span>    /**<a name="line.99"></a>
-<span class="sourceLineNo">100</span>     * @return Byte array read from the stream.<a name="line.100"></a>
-<span class="sourceLineNo">101</span>     * @throws IOException<a name="line.101"></a>
-<span class="sourceLineNo">102</span>     */<a name="line.102"></a>
-<span class="sourceLineNo">103</span>    private byte [] readByteArray(final InputStream in) throws IOException {<a name="line.103"></a>
-<span class="sourceLineNo">104</span>      byte [] intArray = new byte[Bytes.SIZEOF_INT];<a name="line.104"></a>
-<span class="sourceLineNo">105</span>      IOUtils.readFully(in, intArray);<a name="line.105"></a>
-<span class="sourceLineNo">106</span>      int length = Bytes.toInt(intArray);<a name="line.106"></a>
-<span class="sourceLineNo">107</span>      byte [] bytes = new byte [length];<a name="line.107"></a>
-<span class="sourceLineNo">108</span>      IOUtils.readFully(in, bytes);<a name="line.108"></a>
-<span class="sourceLineNo">109</span>      return bytes;<a name="line.109"></a>
-<span class="sourceLineNo">110</span>    }<a name="line.110"></a>
-<span class="sourceLineNo">111</span>  }<a name="line.111"></a>
-<span class="sourceLineNo">112</span><a name="line.112"></a>
-<span class="sourceLineNo">113</span>  @Override<a name="line.113"></a>
-<span class="sourceLineNo">114</span>  public Decoder getDecoder(InputStream is) {<a name="line.114"></a>
-<span class="sourceLineNo">115</span>    return new CellDecoder(is);<a name="line.115"></a>
-<span class="sourceLineNo">116</span>  }<a name="line.116"></a>
-<span class="sourceLineNo">117</span><a name="line.117"></a>
-<span class="sourceLineNo">118</span>  @Override<a name="line.118"></a>
-<span class="sourceLineNo">119</span>  public Encoder getEncoder(OutputStream os) {<a name="line.119"></a>
-<span class="sourceLineNo">120</span>    return new CellEncoder(os);<a name="line.120"></a>
-<span class="sourceLineNo">121</span>  }<a name="line.121"></a>
-<span class="sourceLineNo">122</span>}<a name="line.122"></a>
+<span class="sourceLineNo">023</span>import java.nio.ByteBuffer;<a name="line.23"></a>
+<span class="sourceLineNo">024</span><a name="line.24"></a>
+<span class="sourceLineNo">025</span>import org.apache.commons.io.IOUtils;<a name="line.25"></a>
+<span class="sourceLineNo">026</span>import org.apache.hadoop.hbase.Cell;<a name="line.26"></a>
+<span class="sourceLineNo">027</span>import org.apache.hadoop.hbase.CellUtil;<a name="line.27"></a>
+<span class="sourceLineNo">028</span>import org.apache.hadoop.hbase.HBaseInterfaceAudience;<a name="line.28"></a>
+<span class="sourceLineNo">029</span>import org.apache.hadoop.hbase.classification.InterfaceAudience;<a name="line.29"></a>
+<span class="sourceLineNo">030</span>import org.apache.hadoop.hbase.io.ByteBufferInputStream;<a name="line.30"></a>
+<span class="sourceLineNo">031</span>import org.apache.hadoop.hbase.util.Bytes;<a name="line.31"></a>
+<span class="sourceLineNo">032</span><a name="line.32"></a>
+<span class="sourceLineNo">033</span>/**<a name="line.33"></a>
+<span class="sourceLineNo">034</span> * Basic Cell codec that just writes out all the individual elements of a Cell.  Uses ints<a name="line.34"></a>
+<span class="sourceLineNo">035</span> * delimiting all lengths. Profligate. Needs tune up.<a name="line.35"></a>
+<span class="sourceLineNo">036</span> * Note: This will not write tags of a Cell.<a name="line.36"></a>
+<span class="sourceLineNo">037</span> */<a name="line.37"></a>
+<span class="sourceLineNo">038</span>@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG)<a name="line.38"></a>
+<span class="sourceLineNo">039</span>public class CellCodec implements Codec {<a name="line.39"></a>
+<span class="sourceLineNo">040</span>  static class CellEncoder extends BaseEncoder {<a name="line.40"></a>
+<span class="sourceLineNo">041</span>    CellEncoder(final OutputStream out) {<a name="line.41"></a>
+<span class="sourceLineNo">042</span>      super(out);<a name="line.42"></a>
+<span class="sourceLineNo">043</span>    }<a name="line.43"></a>
+<span class="sourceLineNo">044</span><a name="line.44"></a>
+<span class="sourceLineNo">045</span>    @Override<a name="line.45"></a>
+<span class="sourceLineNo">046</span>    public void write(Cell cell) throws IOException {<a name="line.46"></a>
+<span class="sourceLineNo">047</span>      checkFlushed();<a name="line.47"></a>
+<span class="sourceLineNo">048</span>      // Row<a name="line.48"></a>
+<span class="sourceLineNo">049</span>      write(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());<a name="line.49"></a>
+<span class="sourceLineNo">050</span>      // Column family<a name="line.50"></a>
+<span class="sourceLineNo">051</span>      write(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength());<a name="line.51"></a>
+<span class="sourceLineNo">052</span>      // Qualifier<a name="line.52"></a>
+<span class="sourceLineNo">053</span>      write(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());<a name="line.53"></a>
+<span class="sourceLineNo">054</span>      // Version<a name="line.54"></a>
+<span class="sourceLineNo">055</span>      this.out.write(Bytes.toBytes(cell.getTimestamp()));<a name="line.55"></a>
+<span class="sourceLineNo">056</span>      // Type<a name="line.56"></a>
+<span class="sourceLineNo">057</span>      this.out.write(cell.getTypeByte());<a name="line.57"></a>
+<span class="sourceLineNo">058</span>      // Value<a name="line.58"></a>
+<span class="sourceLineNo">059</span>      write(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());<a name="line.59"></a>
+<span class="sourceLineNo">060</span>      // MvccVersion<a name="line.60"></a>
+<span class="sourceLineNo">061</span>      this.out.write(Bytes.toBytes(cell.getSequenceId()));<a name="line.61"></a>
+<span class="sourceLineNo">062</span>    }<a name="line.62"></a>
+<span class="sourceLineNo">063</span><a name="line.63"></a>
+<span class="sourceLineNo">064</span>    /**<a name="line.64"></a>
+<span class="sourceLineNo">065</span>     * Write int length followed by array bytes.<a name="line.65"></a>
+<span class="sourceLineNo">066</span>     * @param bytes<a name="line.66"></a>
+<span class="sourceLineNo">067</span>     * @param offset<a name="line.67"></a>
+<span class="sourceLineNo">068</span>     * @param length<a name="line.68"></a>
+<span class="sourceLineNo">069</span>     * @throws IOException<a name="line.69"></a>
+<span class="sourceLineNo">070</span>     */<a name="line.70"></a>
+<span class="sourceLineNo">071</span>    private void write(final byte [] bytes, final int offset, final int length)<a name="line.71"></a>
+<span class="sourceLineNo">072</span>    throws IOException {<a name="line.72"></a>
+<span class="sourceLineNo">073</span>      // TODO add BB backed os check and do for write. Pass Cell<a name="line.73"></a>
+<span class="sourceLineNo">074</span>      this.out.write(Bytes.toBytes(length));<a name="line.74"></a>
+<span class="sourceLineNo">075</span>      this.out.write(bytes, offset, length);<a name="line.75"></a>
+<span class="sourceLineNo">076</span>    }<a name="line.76"></a>
+<span class="sourceLineNo">077</span>  }<a name="line.77"></a>
+<span class="sourceLineNo">078</span><a name="line.78"></a>
+<span class="sourceLineNo">079</span>  static class CellDecoder extends BaseDecoder {<a name="line.79"></a>
+<span class="sourceLineNo">080</span>    public CellDecoder(final InputStream in) {<a name="line.80"></a>
+<span class="sourceLineNo">081</span>      super(in);<a name="line.81"></a>
+<span class="sourceLineNo">082</span>    }<a name="line.82"></a>
+<span class="sourceLineNo">083</span><a name="line.83"></a>
+<span class="sourceLineNo">084</span>    @Override<a name="line.84"></a>
+<span class="sourceLineNo">085</span>    protected Cell parseCell() throws IOException {<a name="line.85"></a>
+<span class="sourceLineNo">086</span>      byte [] row = readByteArray(this.in);<a name="line.86"></a>
+<span class="sourceLineNo">087</span>      byte [] family = readByteArray(in);<a name="line.87"></a>
+<span class="sourceLineNo">088</span>      byte [] qualifier = readByteArray(in);<a name="line.88"></a>
+<span class="sourceLineNo">089</span>      byte [] longArray = new byte[Bytes.SIZEOF_LONG];<a name="line.89"></a>
+<span class="sourceLineNo">090</span>      IOUtils.readFully(this.in, longArray);<a name="line.90"></a>
+<span class="sourceLineNo">091</span>      long timestamp = Bytes.toLong(longArray);<a name="line.91"></a>
+<span class="sourceLineNo">092</span>      byte type = (byte) this.in.read();<a name="line.92"></a>
+<span class="sourceLineNo">093</span>      byte[] value = readByteArray(in);<a name="line.93"></a>
+<span class="sourceLineNo">094</span>      // Read memstore version<a name="line.94"></a>
+<span class="sourceLineNo">095</span>      byte[] memstoreTSArray = new byte[Bytes.SIZEOF_LONG];<a name="line.95"></a>
+<span class="sourceLineNo">096</span>      IOUtils.readFully(this.in, memstoreTSArray);<a name="line.96"></a>
+<span class="sourceLineNo">097</span>      long memstoreTS = Bytes.toLong(memstoreTSArray);<a name="line.97"></a>
+<span class="sourceLineNo">098</span>      return CellUtil.createCell(row, family, qualifier, timestamp, type, value, memstoreTS);<a name="line.98"></a>
+<span class="sourceLineNo">099</span>    }<a name="line.99"></a>
+<span class="sourceLineNo">100</span><a name="line.100"></a>
+<span class="sourceLineNo">101</span>    /**<a name="line.101"></a>
+<span class="sourceLineNo">102</span>     * @return Byte array read from the stream.<a name="line.102"></a>
+<span class="sourceLineNo">103</span>     * @throws IOException<a name="line.103"></a>
+<span class="sourceLineNo">104</span>     */<a name="line.104"></a>
+<span class="sourceLineNo">105</span>    private byte [] readByteArray(final InputStream in) throws IOException {<a name="line.105"></a>
+<span class="sourceLineNo">106</span>      byte [] intArray = new byte[Bytes.SIZEOF_INT];<a name="line.106"></a>
+<span class="sourceLineNo">107</span>      IOUtils.readFully(in, intArray);<a name="line.107"></a>
+<span class="sourceLineNo">108</span>      int length = Bytes.toInt(intArray);<a name="line.108"></a>
+<span class="sourceLineNo">109</span>      byte [] bytes = new byte [length];<a name="line.109"></a>
+<span class="sourceLineNo">110</span>      IOUtils.readFully(in, bytes);<a name="line.110"></a>
+<span class="sourceLineNo">111</span>      return bytes;<a name="line.111"></a>
+<span class="sourceLineNo">112</span>    }<a name="line.112"></a>
+<span class="sourceLineNo">113</span>  }<a name="line.113"></a>
+<span class="sourceLineNo">114</span><a name="line.114"></a>
+<span class="sourceLineNo">115</span>  @Override<a name="line.115"></a>
+<span class="sourceLineNo">116</span>  public Decoder getDecoder(InputStream is) {<a name="line.116"></a>
+<span class="sourceLineNo">117</span>    return new CellDecoder(is);<a name="line.117"></a>
+<span class="sourceLineNo">118</span>  }<a name="line.118"></a>
+<span class="sourceLineNo">119</span><a name="line.119"></a>
+<span class="sourceLineNo">120</span>  @Override<a name="line.120"></a>
+<span class="sourceLineNo">121</span>  public Decoder getDecoder(ByteBuffer buf) {<a name="line.121"></a>
+<span class="sourceLineNo">122</span>    return getDecoder(new ByteBufferInputStream(buf));<a name="line.122"></a>
+<span class="sourceLineNo">123</span>  }<a name="line.123"></a>
+<span class="sourceLineNo">124</span><a name="line.124"></a>
+<span class="sourceLineNo">125</span>  @Override<a name="line.125"></a>
+<span class="sourceLineNo">126</span>  public Encoder getEncoder(OutputStream os) {<a name="line.126"></a>
+<span class="sourceLineNo">127</span>    return new CellEncoder(os);<a name="line.127"></a>
+<span class="sourceLineNo">128</span>  }<a name="line.128"></a>
+<span class="sourceLineNo">129</span>}<a name="line.129"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/0b785cb2/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodec.CellEncoder.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodec.CellEncoder.html b/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodec.CellEncoder.html
index 9cc2c69..1d79a4e 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodec.CellEncoder.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodec.CellEncoder.html
@@ -28,106 +28,113 @@
 <span class="sourceLineNo">020</span>import java.io.IOException;<a name="line.20"></a>
 <span class="sourceLineNo">021</span>import java.io.InputStream;<a name="line.21"></a>
 <span class="sourceLineNo">022</span>import java.io.OutputStream;<a name="line.22"></a>
-<span class="sourceLineNo">023</span><a name="line.23"></a>
-<span class="sourceLineNo">024</span>import org.apache.commons.io.IOUtils;<a name="line.24"></a>
-<span class="sourceLineNo">025</span>import org.apache.hadoop.hbase.Cell;<a name="line.25"></a>
-<span class="sourceLineNo">026</span>import org.apache.hadoop.hbase.CellUtil;<a name="line.26"></a>
-<span class="sourceLineNo">027</span>import org.apache.hadoop.hbase.HBaseInterfaceAudience;<a name="line.27"></a>
-<span class="sourceLineNo">028</span>import org.apache.hadoop.hbase.classification.InterfaceAudience;<a name="line.28"></a>
-<span class="sourceLineNo">029</span>import org.apache.hadoop.hbase.util.Bytes;<a name="line.29"></a>
-<span class="sourceLineNo">030</span><a name="line.30"></a>
-<span class="sourceLineNo">031</span>/**<a name="line.31"></a>
-<span class="sourceLineNo">032</span> * Basic Cell codec that just writes out all the individual elements of a Cell.  Uses ints<a name="line.32"></a>
-<span class="sourceLineNo">033</span> * delimiting all lengths. Profligate. Needs tune up.<a name="line.33"></a>
-<span class="sourceLineNo">034</span> * Note: This will not write tags of a Cell.<a name="line.34"></a>
-<span class="sourceLineNo">035</span> */<a name="line.35"></a>
-<span class="sourceLineNo">036</span>@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG)<a name="line.36"></a>
-<span class="sourceLineNo">037</span>public class CellCodec implements Codec {<a name="line.37"></a>
-<span class="sourceLineNo">038</span>  static class CellEncoder extends BaseEncoder {<a name="line.38"></a>
-<span class="sourceLineNo">039</span>    CellEncoder(final OutputStream out) {<a name="line.39"></a>
-<span class="sourceLineNo">040</span>      super(out);<a name="line.40"></a>
-<span class="sourceLineNo">041</span>    }<a name="line.41"></a>
-<span class="sourceLineNo">042</span><a name="line.42"></a>
-<span class="sourceLineNo">043</span>    @Override<a name="line.43"></a>
-<span class="sourceLineNo">044</span>    public void write(Cell cell) throws IOException {<a name="line.44"></a>
-<span class="sourceLineNo">045</span>      checkFlushed();<a name="line.45"></a>
-<span class="sourceLineNo">046</span>      // Row<a name="line.46"></a>
-<span class="sourceLineNo">047</span>      write(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());<a name="line.47"></a>
-<span class="sourceLineNo">048</span>      // Column family<a name="line.48"></a>
-<span class="sourceLineNo">049</span>      write(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength());<a name="line.49"></a>
-<span class="sourceLineNo">050</span>      // Qualifier<a name="line.50"></a>
-<span class="sourceLineNo">051</span>      write(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());<a name="line.51"></a>
-<span class="sourceLineNo">052</span>      // Version<a name="line.52"></a>
-<span class="sourceLineNo">053</span>      this.out.write(Bytes.toBytes(cell.getTimestamp()));<a name="line.53"></a>
-<span class="sourceLineNo">054</span>      // Type<a name="line.54"></a>
-<span class="sourceLineNo">055</span>      this.out.write(cell.getTypeByte());<a name="line.55"></a>
-<span class="sourceLineNo">056</span>      // Value<a name="line.56"></a>
-<span class="sourceLineNo">057</span>      write(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());<a name="line.57"></a>
-<span class="sourceLineNo">058</span>      // MvccVersion<a name="line.58"></a>
-<span class="sourceLineNo">059</span>      this.out.write(Bytes.toBytes(cell.getSequenceId()));<a name="line.59"></a>
-<span class="sourceLineNo">060</span>    }<a name="line.60"></a>
-<span class="sourceLineNo">061</span><a name="line.61"></a>
-<span class="sourceLineNo">062</span>    /**<a name="line.62"></a>
-<span class="sourceLineNo">063</span>     * Write int length followed by array bytes.<a name="line.63"></a>
-<span class="sourceLineNo">064</span>     * @param bytes<a name="line.64"></a>
-<span class="sourceLineNo">065</span>     * @param offset<a name="line.65"></a>
-<span class="sourceLineNo">066</span>     * @param length<a name="line.66"></a>
-<span class="sourceLineNo">067</span>     * @throws IOException<a name="line.67"></a>
-<span class="sourceLineNo">068</span>     */<a name="line.68"></a>
-<span class="sourceLineNo">069</span>    private void write(final byte [] bytes, final int offset, final int length)<a name="line.69"></a>
-<span class="sourceLineNo">070</span>    throws IOException {<a name="line.70"></a>
-<span class="sourceLineNo">071</span>      // TODO add BB backed os check and do for write. Pass Cell<a name="line.71"></a>
-<span class="sourceLineNo">072</span>      this.out.write(Bytes.toBytes(length));<a name="line.72"></a>
-<span class="sourceLineNo">073</span>      this.out.write(bytes, offset, length);<a name="line.73"></a>
-<span class="sourceLineNo">074</span>    }<a name="line.74"></a>
-<span class="sourceLineNo">075</span>  }<a name="line.75"></a>
-<span class="sourceLineNo">076</span><a name="line.76"></a>
-<span class="sourceLineNo">077</span>  static class CellDecoder extends BaseDecoder {<a name="line.77"></a>
-<span class="sourceLineNo">078</span>    public CellDecoder(final InputStream in) {<a name="line.78"></a>
-<span class="sourceLineNo">079</span>      super(in);<a name="line.79"></a>
-<span class="sourceLineNo">080</span>    }<a name="line.80"></a>
-<span class="sourceLineNo">081</span><a name="line.81"></a>
-<span class="sourceLineNo">082</span>    @Override<a name="line.82"></a>
-<span class="sourceLineNo">083</span>    protected Cell parseCell() throws IOException {<a name="line.83"></a>
-<span class="sourceLineNo">084</span>      byte [] row = readByteArray(this.in);<a name="line.84"></a>
-<span class="sourceLineNo">085</span>      byte [] family = readByteArray(in);<a name="line.85"></a>
-<span class="sourceLineNo">086</span>      byte [] qualifier = readByteArray(in);<a name="line.86"></a>
-<span class="sourceLineNo">087</span>      byte [] longArray = new byte[Bytes.SIZEOF_LONG];<a name="line.87"></a>
-<span class="sourceLineNo">088</span>      IOUtils.readFully(this.in, longArray);<a name="line.88"></a>
-<span class="sourceLineNo">089</span>      long timestamp = Bytes.toLong(longArray);<a name="line.89"></a>
-<span class="sourceLineNo">090</span>      byte type = (byte) this.in.read();<a name="line.90"></a>
-<span class="sourceLineNo">091</span>      byte[] value = readByteArray(in);<a name="line.91"></a>
-<span class="sourceLineNo">092</span>      // Read memstore version<a name="line.92"></a>
-<span class="sourceLineNo">093</span>      byte[] memstoreTSArray = new byte[Bytes.SIZEOF_LONG];<a name="line.93"></a>
-<span class="sourceLineNo">094</span>      IOUtils.readFully(this.in, memstoreTSArray);<a name="line.94"></a>
-<span class="sourceLineNo">095</span>      long memstoreTS = Bytes.toLong(memstoreTSArray);<a name="line.95"></a>
-<span class="sourceLineNo">096</span>      return CellUtil.createCell(row, family, qualifier, timestamp, type, value, memstoreTS);<a name="line.96"></a>
-<span class="sourceLineNo">097</span>    }<a name="line.97"></a>
-<span class="sourceLineNo">098</span><a name="line.98"></a>
-<span class="sourceLineNo">099</span>    /**<a name="line.99"></a>
-<span class="sourceLineNo">100</span>     * @return Byte array read from the stream.<a name="line.100"></a>
-<span class="sourceLineNo">101</span>     * @throws IOException<a name="line.101"></a>
-<span class="sourceLineNo">102</span>     */<a name="line.102"></a>
-<span class="sourceLineNo">103</span>    private byte [] readByteArray(final InputStream in) throws IOException {<a name="line.103"></a>
-<span class="sourceLineNo">104</span>      byte [] intArray = new byte[Bytes.SIZEOF_INT];<a name="line.104"></a>
-<span class="sourceLineNo">105</span>      IOUtils.readFully(in, intArray);<a name="line.105"></a>
-<span class="sourceLineNo">106</span>      int length = Bytes.toInt(intArray);<a name="line.106"></a>
-<span class="sourceLineNo">107</span>      byte [] bytes = new byte [length];<a name="line.107"></a>
-<span class="sourceLineNo">108</span>      IOUtils.readFully(in, bytes);<a name="line.108"></a>
-<span class="sourceLineNo">109</span>      return bytes;<a name="line.109"></a>
-<span class="sourceLineNo">110</span>    }<a name="line.110"></a>
-<span class="sourceLineNo">111</span>  }<a name="line.111"></a>
-<span class="sourceLineNo">112</span><a name="line.112"></a>
-<span class="sourceLineNo">113</span>  @Override<a name="line.113"></a>
-<span class="sourceLineNo">114</span>  public Decoder getDecoder(InputStream is) {<a name="line.114"></a>
-<span class="sourceLineNo">115</span>    return new CellDecoder(is);<a name="line.115"></a>
-<span class="sourceLineNo">116</span>  }<a name="line.116"></a>
-<span class="sourceLineNo">117</span><a name="line.117"></a>
-<span class="sourceLineNo">118</span>  @Override<a name="line.118"></a>
-<span class="sourceLineNo">119</span>  public Encoder getEncoder(OutputStream os) {<a name="line.119"></a>
-<span class="sourceLineNo">120</span>    return new CellEncoder(os);<a name="line.120"></a>
-<span class="sourceLineNo">121</span>  }<a name="line.121"></a>
-<span class="sourceLineNo">122</span>}<a name="line.122"></a>
+<span class="sourceLineNo">023</span>import java.nio.ByteBuffer;<a name="line.23"></a>
+<span class="sourceLineNo">024</span><a name="line.24"></a>
+<span class="sourceLineNo">025</span>import org.apache.commons.io.IOUtils;<a name="line.25"></a>
+<span class="sourceLineNo">026</span>import org.apache.hadoop.hbase.Cell;<a name="line.26"></a>
+<span class="sourceLineNo">027</span>import org.apache.hadoop.hbase.CellUtil;<a name="line.27"></a>
+<span class="sourceLineNo">028</span>import org.apache.hadoop.hbase.HBaseInterfaceAudience;<a name="line.28"></a>
+<span class="sourceLineNo">029</span>import org.apache.hadoop.hbase.classification.InterfaceAudience;<a name="line.29"></a>
+<span class="sourceLineNo">030</span>import org.apache.hadoop.hbase.io.ByteBufferInputStream;<a name="line.30"></a>
+<span class="sourceLineNo">031</span>import org.apache.hadoop.hbase.util.Bytes;<a name="line.31"></a>
+<span class="sourceLineNo">032</span><a name="line.32"></a>
+<span class="sourceLineNo">033</span>/**<a name="line.33"></a>
+<span class="sourceLineNo">034</span> * Basic Cell codec that just writes out all the individual elements of a Cell.  Uses ints<a name="line.34"></a>
+<span class="sourceLineNo">035</span> * delimiting all lengths. Profligate. Needs tune up.<a name="line.35"></a>
+<span class="sourceLineNo">036</span> * Note: This will not write tags of a Cell.<a name="line.36"></a>
+<span class="sourceLineNo">037</span> */<a name="line.37"></a>
+<span class="sourceLineNo">038</span>@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG)<a name="line.38"></a>
+<span class="sourceLineNo">039</span>public class CellCodec implements Codec {<a name="line.39"></a>
+<span class="sourceLineNo">040</span>  static class CellEncoder extends BaseEncoder {<a name="line.40"></a>
+<span class="sourceLineNo">041</span>    CellEncoder(final OutputStream out) {<a name="line.41"></a>
+<span class="sourceLineNo">042</span>      super(out);<a name="line.42"></a>
+<span class="sourceLineNo">043</span>    }<a name="line.43"></a>
+<span class="sourceLineNo">044</span><a name="line.44"></a>
+<span class="sourceLineNo">045</span>    @Override<a name="line.45"></a>
+<span class="sourceLineNo">046</span>    public void write(Cell cell) throws IOException {<a name="line.46"></a>
+<span class="sourceLineNo">047</span>      checkFlushed();<a name="line.47"></a>
+<span class="sourceLineNo">048</span>      // Row<a name="line.48"></a>
+<span class="sourceLineNo">049</span>      write(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());<a name="line.49"></a>
+<span class="sourceLineNo">050</span>      // Column family<a name="line.50"></a>
+<span class="sourceLineNo">051</span>      write(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength());<a name="line.51"></a>
+<span class="sourceLineNo">052</span>      // Qualifier<a name="line.52"></a>
+<span class="sourceLineNo">053</span>      write(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());<a name="line.53"></a>
+<span class="sourceLineNo">054</span>      // Version<a name="line.54"></a>
+<span class="sourceLineNo">055</span>      this.out.write(Bytes.toBytes(cell.getTimestamp()));<a name="line.55"></a>
+<span class="sourceLineNo">056</span>      // Type<a name="line.56"></a>
+<span class="sourceLineNo">057</span>      this.out.write(cell.getTypeByte());<a name="line.57"></a>
+<span class="sourceLineNo">058</span>      // Value<a name="line.58"></a>
+<span class="sourceLineNo">059</span>      write(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());<a name="line.59"></a>
+<span class="sourceLineNo">060</span>      // MvccVersion<a name="line.60"></a>
+<span class="sourceLineNo">061</span>      this.out.write(Bytes.toBytes(cell.getSequenceId()));<a name="line.61"></a>
+<span class="sourceLineNo">062</span>    }<a name="line.62"></a>
+<span class="sourceLineNo">063</span><a name="line.63"></a>
+<span class="sourceLineNo">064</span>    /**<a name="line.64"></a>
+<span class="sourceLineNo">065</span>     * Write int length followed by array bytes.<a name="line.65"></a>
+<span class="sourceLineNo">066</span>     * @param bytes<a name="line.66"></a>
+<span class="sourceLineNo">067</span>     * @param offset<a name="line.67"></a>
+<span class="sourceLineNo">068</span>     * @param length<a name="line.68"></a>
+<span class="sourceLineNo">069</span>     * @throws IOException<a name="line.69"></a>
+<span class="sourceLineNo">070</span>     */<a name="line.70"></a>
+<span class="sourceLineNo">071</span>    private void write(final byte [] bytes, final int offset, final int length)<a name="line.71"></a>
+<span class="sourceLineNo">072</span>    throws IOException {<a name="line.72"></a>
+<span class="sourceLineNo">073</span>      // TODO add BB backed os check and do for write. Pass Cell<a name="line.73"></a>
+<span class="sourceLineNo">074</span>      this.out.write(Bytes.toBytes(length));<a name="line.74"></a>
+<span class="sourceLineNo">075</span>      this.out.write(bytes, offset, length);<a name="line.75"></a>
+<span class="sourceLineNo">076</span>    }<a name="line.76"></a>
+<span class="sourceLineNo">077</span>  }<a name="line.77"></a>
+<span class="sourceLineNo">078</span><a name="line.78"></a>
+<span class="sourceLineNo">079</span>  static class CellDecoder extends BaseDecoder {<a name="line.79"></a>
+<span class="sourceLineNo">080</span>    public CellDecoder(final InputStream in) {<a name="line.80"></a>
+<span class="sourceLineNo">081</span>      super(in);<a name="line.81"></a>
+<span class="sourceLineNo">082</span>    }<a name="line.82"></a>
+<span class="sourceLineNo">083</span><a name="line.83"></a>
+<span class="sourceLineNo">084</span>    @Override<a name="line.84"></a>
+<span class="sourceLineNo">085</span>    protected Cell parseCell() throws IOException {<a name="line.85"></a>
+<span class="sourceLineNo">086</span>      byte [] row = readByteArray(this.in);<a name="line.86"></a>
+<span class="sourceLineNo">087</span>      byte [] family = readByteArray(in);<a name="line.87"></a>
+<span class="sourceLineNo">088</span>      byte [] qualifier = readByteArray(in);<a name="line.88"></a>
+<span class="sourceLineNo">089</span>      byte [] longArray = new byte[Bytes.SIZEOF_LONG];<a name="line.89"></a>
+<span class="sourceLineNo">090</span>      IOUtils.readFully(this.in, longArray);<a name="line.90"></a>
+<span class="sourceLineNo">091</span>      long timestamp = Bytes.toLong(longArray);<a name="line.91"></a>
+<span class="sourceLineNo">092</span>      byte type = (byte) this.in.read();<a name="line.92"></a>
+<span class="sourceLineNo">093</span>      byte[] value = readByteArray(in);<a name="line.93"></a>
+<span class="sourceLineNo">094</span>      // Read memstore version<a name="line.94"></a>
+<span class="sourceLineNo">095</span>      byte[] memstoreTSArray = new byte[Bytes.SIZEOF_LONG];<a name="line.95"></a>
+<span class="sourceLineNo">096</span>      IOUtils.readFully(this.in, memstoreTSArray);<a name="line.96"></a>
+<span class="sourceLineNo">097</span>      long memstoreTS = Bytes.toLong(memstoreTSArray);<a name="line.97"></a>
+<span class="sourceLineNo">098</span>      return CellUtil.createCell(row, family, qualifier, timestamp, type, value, memstoreTS);<a name="line.98"></a>
+<span class="sourceLineNo">099</span>    }<a name="line.99"></a>
+<span class="sourceLineNo">100</span><a name="line.100"></a>
+<span class="sourceLineNo">101</span>    /**<a name="line.101"></a>
+<span class="sourceLineNo">102</span>     * @return Byte array read from the stream.<a name="line.102"></a>
+<span class="sourceLineNo">103</span>     * @throws IOException<a name="line.103"></a>
+<span class="sourceLineNo">104</span>     */<a name="line.104"></a>
+<span class="sourceLineNo">105</span>    private byte [] readByteArray(final InputStream in) throws IOException {<a name="line.105"></a>
+<span class="sourceLineNo">106</span>      byte [] intArray = new byte[Bytes.SIZEOF_INT];<a name="line.106"></a>
+<span class="sourceLineNo">107</span>      IOUtils.readFully(in, intArray);<a name="line.107"></a>
+<span class="sourceLineNo">108</span>      int length = Bytes.toInt(intArray);<a name="line.108"></a>
+<span class="sourceLineNo">109</span>      byte [] bytes = new byte [length];<a name="line.109"></a>
+<span class="sourceLineNo">110</span>      IOUtils.readFully(in, bytes);<a name="line.110"></a>
+<span class="sourceLineNo">111</span>      return bytes;<a name="line.111"></a>
+<span class="sourceLineNo">112</span>    }<a name="line.112"></a>
+<span class="sourceLineNo">113</span>  }<a name="line.113"></a>
+<span class="sourceLineNo">114</span><a name="line.114"></a>
+<span class="sourceLineNo">115</span>  @Override<a name="line.115"></a>
+<span class="sourceLineNo">116</span>  public Decoder getDecoder(InputStream is) {<a name="line.116"></a>
+<span class="sourceLineNo">117</span>    return new CellDecoder(is);<a name="line.117"></a>
+<span class="sourceLineNo">118</span>  }<a name="line.118"></a>
+<span class="sourceLineNo">119</span><a name="line.119"></a>
+<span class="sourceLineNo">120</span>  @Override<a name="line.120"></a>
+<span class="sourceLineNo">121</span>  public Decoder getDecoder(ByteBuffer buf) {<a name="line.121"></a>
+<span class="sourceLineNo">122</span>    return getDecoder(new ByteBufferInputStream(buf));<a name="line.122"></a>
+<span class="sourceLineNo">123</span>  }<a name="line.123"></a>
+<span class="sourceLineNo">124</span><a name="line.124"></a>
+<span class="sourceLineNo">125</span>  @Override<a name="line.125"></a>
+<span class="sourceLineNo">126</span>  public Encoder getEncoder(OutputStream os) {<a name="line.126"></a>
+<span class="sourceLineNo">127</span>    return new CellEncoder(os);<a name="line.127"></a>
+<span class="sourceLineNo">128</span>  }<a name="line.128"></a>
+<span class="sourceLineNo">129</span>}<a name="line.129"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/0b785cb2/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodec.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodec.html b/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodec.html
index 9cc2c69..1d79a4e 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodec.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodec.html
@@ -28,106 +28,113 @@
 <span class="sourceLineNo">020</span>import java.io.IOException;<a name="line.20"></a>
 <span class="sourceLineNo">021</span>import java.io.InputStream;<a name="line.21"></a>
 <span class="sourceLineNo">022</span>import java.io.OutputStream;<a name="line.22"></a>
-<span class="sourceLineNo">023</span><a name="line.23"></a>
-<span class="sourceLineNo">024</span>import org.apache.commons.io.IOUtils;<a name="line.24"></a>
-<span class="sourceLineNo">025</span>import org.apache.hadoop.hbase.Cell;<a name="line.25"></a>
-<span class="sourceLineNo">026</span>import org.apache.hadoop.hbase.CellUtil;<a name="line.26"></a>
-<span class="sourceLineNo">027</span>import org.apache.hadoop.hbase.HBaseInterfaceAudience;<a name="line.27"></a>
-<span class="sourceLineNo">028</span>import org.apache.hadoop.hbase.classification.InterfaceAudience;<a name="line.28"></a>
-<span class="sourceLineNo">029</span>import org.apache.hadoop.hbase.util.Bytes;<a name="line.29"></a>
-<span class="sourceLineNo">030</span><a name="line.30"></a>
-<span class="sourceLineNo">031</span>/**<a name="line.31"></a>
-<span class="sourceLineNo">032</span> * Basic Cell codec that just writes out all the individual elements of a Cell.  Uses ints<a name="line.32"></a>
-<span class="sourceLineNo">033</span> * delimiting all lengths. Profligate. Needs tune up.<a name="line.33"></a>
-<span class="sourceLineNo">034</span> * Note: This will not write tags of a Cell.<a name="line.34"></a>
-<span class="sourceLineNo">035</span> */<a name="line.35"></a>
-<span class="sourceLineNo">036</span>@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG)<a name="line.36"></a>
-<span class="sourceLineNo">037</span>public class CellCodec implements Codec {<a name="line.37"></a>
-<span class="sourceLineNo">038</span>  static class CellEncoder extends BaseEncoder {<a name="line.38"></a>
-<span class="sourceLineNo">039</span>    CellEncoder(final OutputStream out) {<a name="line.39"></a>
-<span class="sourceLineNo">040</span>      super(out);<a name="line.40"></a>
-<span class="sourceLineNo">041</span>    }<a name="line.41"></a>
-<span class="sourceLineNo">042</span><a name="line.42"></a>
-<span class="sourceLineNo">043</span>    @Override<a name="line.43"></a>
-<span class="sourceLineNo">044</span>    public void write(Cell cell) throws IOException {<a name="line.44"></a>
-<span class="sourceLineNo">045</span>      checkFlushed();<a name="line.45"></a>
-<span class="sourceLineNo">046</span>      // Row<a name="line.46"></a>
-<span class="sourceLineNo">047</span>      write(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());<a name="line.47"></a>
-<span class="sourceLineNo">048</span>      // Column family<a name="line.48"></a>
-<span class="sourceLineNo">049</span>      write(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength());<a name="line.49"></a>
-<span class="sourceLineNo">050</span>      // Qualifier<a name="line.50"></a>
-<span class="sourceLineNo">051</span>      write(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());<a name="line.51"></a>
-<span class="sourceLineNo">052</span>      // Version<a name="line.52"></a>
-<span class="sourceLineNo">053</span>      this.out.write(Bytes.toBytes(cell.getTimestamp()));<a name="line.53"></a>
-<span class="sourceLineNo">054</span>      // Type<a name="line.54"></a>
-<span class="sourceLineNo">055</span>      this.out.write(cell.getTypeByte());<a name="line.55"></a>
-<span class="sourceLineNo">056</span>      // Value<a name="line.56"></a>
-<span class="sourceLineNo">057</span>      write(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());<a name="line.57"></a>
-<span class="sourceLineNo">058</span>      // MvccVersion<a name="line.58"></a>
-<span class="sourceLineNo">059</span>      this.out.write(Bytes.toBytes(cell.getSequenceId()));<a name="line.59"></a>
-<span class="sourceLineNo">060</span>    }<a name="line.60"></a>
-<span class="sourceLineNo">061</span><a name="line.61"></a>
-<span class="sourceLineNo">062</span>    /**<a name="line.62"></a>
-<span class="sourceLineNo">063</span>     * Write int length followed by array bytes.<a name="line.63"></a>
-<span class="sourceLineNo">064</span>     * @param bytes<a name="line.64"></a>
-<span class="sourceLineNo">065</span>     * @param offset<a name="line.65"></a>
-<span class="sourceLineNo">066</span>     * @param length<a name="line.66"></a>
-<span class="sourceLineNo">067</span>     * @throws IOException<a name="line.67"></a>
-<span class="sourceLineNo">068</span>     */<a name="line.68"></a>
-<span class="sourceLineNo">069</span>    private void write(final byte [] bytes, final int offset, final int length)<a name="line.69"></a>
-<span class="sourceLineNo">070</span>    throws IOException {<a name="line.70"></a>
-<span class="sourceLineNo">071</span>      // TODO add BB backed os check and do for write. Pass Cell<a name="line.71"></a>
-<span class="sourceLineNo">072</span>      this.out.write(Bytes.toBytes(length));<a name="line.72"></a>
-<span class="sourceLineNo">073</span>      this.out.write(bytes, offset, length);<a name="line.73"></a>
-<span class="sourceLineNo">074</span>    }<a name="line.74"></a>
-<span class="sourceLineNo">075</span>  }<a name="line.75"></a>
-<span class="sourceLineNo">076</span><a name="line.76"></a>
-<span class="sourceLineNo">077</span>  static class CellDecoder extends BaseDecoder {<a name="line.77"></a>
-<span class="sourceLineNo">078</span>    public CellDecoder(final InputStream in) {<a name="line.78"></a>
-<span class="sourceLineNo">079</span>      super(in);<a name="line.79"></a>
-<span class="sourceLineNo">080</span>    }<a name="line.80"></a>
-<span class="sourceLineNo">081</span><a name="line.81"></a>
-<span class="sourceLineNo">082</span>    @Override<a name="line.82"></a>
-<span class="sourceLineNo">083</span>    protected Cell parseCell() throws IOException {<a name="line.83"></a>
-<span class="sourceLineNo">084</span>      byte [] row = readByteArray(this.in);<a name="line.84"></a>
-<span class="sourceLineNo">085</span>      byte [] family = readByteArray(in);<a name="line.85"></a>
-<span class="sourceLineNo">086</span>      byte [] qualifier = readByteArray(in);<a name="line.86"></a>
-<span class="sourceLineNo">087</span>      byte [] longArray = new byte[Bytes.SIZEOF_LONG];<a name="line.87"></a>
-<span class="sourceLineNo">088</span>      IOUtils.readFully(this.in, longArray);<a name="line.88"></a>
-<span class="sourceLineNo">089</span>      long timestamp = Bytes.toLong(longArray);<a name="line.89"></a>
-<span class="sourceLineNo">090</span>      byte type = (byte) this.in.read();<a name="line.90"></a>
-<span class="sourceLineNo">091</span>      byte[] value = readByteArray(in);<a name="line.91"></a>
-<span class="sourceLineNo">092</span>      // Read memstore version<a name="line.92"></a>
-<span class="sourceLineNo">093</span>      byte[] memstoreTSArray = new byte[Bytes.SIZEOF_LONG];<a name="line.93"></a>
-<span class="sourceLineNo">094</span>      IOUtils.readFully(this.in, memstoreTSArray);<a name="line.94"></a>
-<span class="sourceLineNo">095</span>      long memstoreTS = Bytes.toLong(memstoreTSArray);<a name="line.95"></a>
-<span class="sourceLineNo">096</span>      return CellUtil.createCell(row, family, qualifier, timestamp, type, value, memstoreTS);<a name="line.96"></a>
-<span class="sourceLineNo">097</span>    }<a name="line.97"></a>
-<span class="sourceLineNo">098</span><a name="line.98"></a>
-<span class="sourceLineNo">099</span>    /**<a name="line.99"></a>
-<span class="sourceLineNo">100</span>     * @return Byte array read from the stream.<a name="line.100"></a>
-<span class="sourceLineNo">101</span>     * @throws IOException<a name="line.101"></a>
-<span class="sourceLineNo">102</span>     */<a name="line.102"></a>
-<span class="sourceLineNo">103</span>    private byte [] readByteArray(final InputStream in) throws IOException {<a name="line.103"></a>
-<span class="sourceLineNo">104</span>      byte [] intArray = new byte[Bytes.SIZEOF_INT];<a name="line.104"></a>
-<span class="sourceLineNo">105</span>      IOUtils.readFully(in, intArray);<a name="line.105"></a>
-<span class="sourceLineNo">106</span>      int length = Bytes.toInt(intArray);<a name="line.106"></a>
-<span class="sourceLineNo">107</span>      byte [] bytes = new byte [length];<a name="line.107"></a>
-<span class="sourceLineNo">108</span>      IOUtils.readFully(in, bytes);<a name="line.108"></a>
-<span class="sourceLineNo">109</span>      return bytes;<a name="line.109"></a>
-<span class="sourceLineNo">110</span>    }<a name="line.110"></a>
-<span class="sourceLineNo">111</span>  }<a name="line.111"></a>
-<span class="sourceLineNo">112</span><a name="line.112"></a>
-<span class="sourceLineNo">113</span>  @Override<a name="line.113"></a>
-<span class="sourceLineNo">114</span>  public Decoder getDecoder(InputStream is) {<a name="line.114"></a>
-<span class="sourceLineNo">115</span>    return new CellDecoder(is);<a name="line.115"></a>
-<span class="sourceLineNo">116</span>  }<a name="line.116"></a>
-<span class="sourceLineNo">117</span><a name="line.117"></a>
-<span class="sourceLineNo">118</span>  @Override<a name="line.118"></a>
-<span class="sourceLineNo">119</span>  public Encoder getEncoder(OutputStream os) {<a name="line.119"></a>
-<span class="sourceLineNo">120</span>    return new CellEncoder(os);<a name="line.120"></a>
-<span class="sourceLineNo">121</span>  }<a name="line.121"></a>
-<span class="sourceLineNo">122</span>}<a name="line.122"></a>
+<span class="sourceLineNo">023</span>import java.nio.ByteBuffer;<a name="line.23"></a>
+<span class="sourceLineNo">024</span><a name="line.24"></a>
+<span class="sourceLineNo">025</span>import org.apache.commons.io.IOUtils;<a name="line.25"></a>
+<span class="sourceLineNo">026</span>import org.apache.hadoop.hbase.Cell;<a name="line.26"></a>
+<span class="sourceLineNo">027</span>import org.apache.hadoop.hbase.CellUtil;<a name="line.27"></a>
+<span class="sourceLineNo">028</span>import org.apache.hadoop.hbase.HBaseInterfaceAudience;<a name="line.28"></a>
+<span class="sourceLineNo">029</span>import org.apache.hadoop.hbase.classification.InterfaceAudience;<a name="line.29"></a>
+<span class="sourceLineNo">030</span>import org.apache.hadoop.hbase.io.ByteBufferInputStream;<a name="line.30"></a>
+<span class="sourceLineNo">031</span>import org.apache.hadoop.hbase.util.Bytes;<a name="line.31"></a>
+<span class="sourceLineNo">032</span><a name="line.32"></a>
+<span class="sourceLineNo">033</span>/**<a name="line.33"></a>
+<span class="sourceLineNo">034</span> * Basic Cell codec that just writes out all the individual elements of a Cell.  Uses ints<a name="line.34"></a>
+<span class="sourceLineNo">035</span> * delimiting all lengths. Profligate. Needs tune up.<a name="line.35"></a>
+<span class="sourceLineNo">036</span> * Note: This will not write tags of a Cell.<a name="line.36"></a>
+<span class="sourceLineNo">037</span> */<a name="line.37"></a>
+<span class="sourceLineNo">038</span>@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG)<a name="line.38"></a>
+<span class="sourceLineNo">039</span>public class CellCodec implements Codec {<a name="line.39"></a>
+<span class="sourceLineNo">040</span>  static class CellEncoder extends BaseEncoder {<a name="line.40"></a>
+<span class="sourceLineNo">041</span>    CellEncoder(final OutputStream out) {<a name="line.41"></a>
+<span class="sourceLineNo">042</span>      super(out);<a name="line.42"></a>
+<span class="sourceLineNo">043</span>    }<a name="line.43"></a>
+<span class="sourceLineNo">044</span><a name="line.44"></a>
+<span class="sourceLineNo">045</span>    @Override<a name="line.45"></a>
+<span class="sourceLineNo">046</span>    public void write(Cell cell) throws IOException {<a name="line.46"></a>
+<span class="sourceLineNo">047</span>      checkFlushed();<a name="line.47"></a>
+<span class="sourceLineNo">048</span>      // Row<a name="line.48"></a>
+<span class="sourceLineNo">049</span>      write(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());<a name="line.49"></a>
+<span class="sourceLineNo">050</span>      // Column family<a name="line.50"></a>
+<span class="sourceLineNo">051</span>      write(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength());<a name="line.51"></a>
+<span class="sourceLineNo">052</span>      // Qualifier<a name="line.52"></a>
+<span class="sourceLineNo">053</span>      write(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());<a name="line.53"></a>
+<span class="sourceLineNo">054</span>      // Version<a name="line.54"></a>
+<span class="sourceLineNo">055</span>      this.out.write(Bytes.toBytes(cell.getTimestamp()));<a name="line.55"></a>
+<span class="sourceLineNo">056</span>      // Type<a name="line.56"></a>
+<span class="sourceLineNo">057</span>      this.out.write(cell.getTypeByte());<a name="line.57"></a>
+<span class="sourceLineNo">058</span>      // Value<a name="line.58"></a>
+<span class="sourceLineNo">059</span>      write(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());<a name="line.59"></a>
+<span class="sourceLineNo">060</span>      // MvccVersion<a name="line.60"></a>
+<span class="sourceLineNo">061</span>      this.out.write(Bytes.toBytes(cell.getSequenceId()));<a name="line.61"></a>
+<span class="sourceLineNo">062</span>    }<a name="line.62"></a>
+<span class="sourceLineNo">063</span><a name="line.63"></a>
+<span class="sourceLineNo">064</span>    /**<a name="line.64"></a>
+<span class="sourceLineNo">065</span>     * Write int length followed by array bytes.<a name="line.65"></a>
+<span class="sourceLineNo">066</span>     * @param bytes<a name="line.66"></a>
+<span class="sourceLineNo">067</span>     * @param offset<a name="line.67"></a>
+<span class="sourceLineNo">068</span>     * @param length<a name="line.68"></a>
+<span class="sourceLineNo">069</span>     * @throws IOException<a name="line.69"></a>
+<span class="sourceLineNo">070</span>     */<a name="line.70"></a>
+<span class="sourceLineNo">071</span>    private void write(final byte [] bytes, final int offset, final int length)<a name="line.71"></a>
+<span class="sourceLineNo">072</span>    throws IOException {<a name="line.72"></a>
+<span class="sourceLineNo">073</span>      // TODO add BB backed os check and do for write. Pass Cell<a name="line.73"></a>
+<span class="sourceLineNo">074</span>      this.out.write(Bytes.toBytes(length));<a name="line.74"></a>
+<span class="sourceLineNo">075</span>      this.out.write(bytes, offset, length);<a name="line.75"></a>
+<span class="sourceLineNo">076</span>    }<a name="line.76"></a>
+<span class="sourceLineNo">077</span>  }<a name="line.77"></a>
+<span class="sourceLineNo">078</span><a name="line.78"></a>
+<span class="sourceLineNo">079</span>  static class CellDecoder extends BaseDecoder {<a name="line.79"></a>
+<span class="sourceLineNo">080</span>    public CellDecoder(final InputStream in) {<a name="line.80"></a>
+<span class="sourceLineNo">081</span>      super(in);<a name="line.81"></a>
+<span class="sourceLineNo">082</span>    }<a name="line.82"></a>
+<span class="sourceLineNo">083</span><a name="line.83"></a>
+<span class="sourceLineNo">084</span>    @Override<a name="line.84"></a>
+<span class="sourceLineNo">085</span>    protected Cell parseCell() throws IOException {<a name="line.85"></a>
+<span class="sourceLineNo">086</span>      byte [] row = readByteArray(this.in);<a name="line.86"></a>
+<span class="sourceLineNo">087</span>      byte [] family = readByteArray(in);<a name="line.87"></a>
+<span class="sourceLineNo">088</span>      byte [] qualifier = readByteArray(in);<a name="line.88"></a>
+<span class="sourceLineNo">089</span>      byte [] longArray = new byte[Bytes.SIZEOF_LONG];<a name="line.89"></a>
+<span class="sourceLineNo">090</span>      IOUtils.readFully(this.in, longArray);<a name="line.90"></a>
+<span class="sourceLineNo">091</span>      long timestamp = Bytes.toLong(longArray);<a name="line.91"></a>
+<span class="sourceLineNo">092</span>      byte type = (byte) this.in.read();<a name="line.92"></a>
+<span class="sourceLineNo">093</span>      byte[] value = readByteArray(in);<a name="line.93"></a>
+<span class="sourceLineNo">094</span>      // Read memstore version<a name="line.94"></a>
+<span class="sourceLineNo">095</span>      byte[] memstoreTSArray = new byte[Bytes.SIZEOF_LONG];<a name="line.95"></a>
+<span class="sourceLineNo">096</span>      IOUtils.readFully(this.in, memstoreTSArray);<a name="line.96"></a>
+<span class="sourceLineNo">097</span>      long memstoreTS = Bytes.toLong(memstoreTSArray);<a name="line.97"></a>
+<span class="sourceLineNo">098</span>      return CellUtil.createCell(row, family, qualifier, timestamp, type, value, memstoreTS);<a name="line.98"></a>
+<span class="sourceLineNo">099</span>    }<a name="line.99"></a>
+<span class="sourceLineNo">100</span><a name="line.100"></a>
+<span class="sourceLineNo">101</span>    /**<a name="line.101"></a>
+<span class="sourceLineNo">102</span>     * @return Byte array read from the stream.<a name="line.102"></a>
+<span class="sourceLineNo">103</span>     * @throws IOException<a name="line.103"></a>
+<span class="sourceLineNo">104</span>     */<a name="line.104"></a>
+<span class="sourceLineNo">105</span>    private byte [] readByteArray(final InputStream in) throws IOException {<a name="line.105"></a>
+<span class="sourceLineNo">106</span>      byte [] intArray = new byte[Bytes.SIZEOF_INT];<a name="line.106"></a>
+<span class="sourceLineNo">107</span>      IOUtils.readFully(in, intArray);<a name="line.107"></a>
+<span class="sourceLineNo">108</span>      int length = Bytes.toInt(intArray);<a name="line.108"></a>
+<span class="sourceLineNo">109</span>      byte [] bytes = new byte [length];<a name="line.109"></a>
+<span class="sourceLineNo">110</span>      IOUtils.readFully(in, bytes);<a name="line.110"></a>
+<span class="sourceLineNo">111</span>      return bytes;<a name="line.111"></a>
+<span class="sourceLineNo">112</span>    }<a name="line.112"></a>
+<span class="sourceLineNo">113</span>  }<a name="line.113"></a>
+<span class="sourceLineNo">114</span><a name="line.114"></a>
+<span class="sourceLineNo">115</span>  @Override<a name="line.115"></a>
+<span class="sourceLineNo">116</span>  public Decoder getDecoder(InputStream is) {<a name="line.116"></a>
+<span class="sourceLineNo">117</span>    return new CellDecoder(is);<a name="line.117"></a>
+<span class="sourceLineNo">118</span>  }<a name="line.118"></a>
+<span class="sourceLineNo">119</span><a name="line.119"></a>
+<span class="sourceLineNo">120</span>  @Override<a name="line.120"></a>
+<span class="sourceLineNo">121</span>  public Decoder getDecoder(ByteBuffer buf) {<a name="line.121"></a>
+<span class="sourceLineNo">122</span>    return getDecoder(new ByteBufferInputStream(buf));<a name="line.122"></a>
+<span class="sourceLineNo">123</span>  }<a name="line.123"></a>
+<span class="sourceLineNo">124</span><a name="line.124"></a>
+<span class="sourceLineNo">125</span>  @Override<a name="line.125"></a>
+<span class="sourceLineNo">126</span>  public Encoder getEncoder(OutputStream os) {<a name="line.126"></a>
+<span class="sourceLineNo">127</span>    return new CellEncoder(os);<a name="line.127"></a>
+<span class="sourceLineNo">128</span>  }<a name="line.128"></a>
+<span class="sourceLineNo">129</span>}<a name="line.129"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/0b785cb2/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodecWithTags.CellDecoder.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodecWithTags.CellDecoder.html b/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodecWithTags.CellDecoder.html
index 742b06b..b129aea 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodecWithTags.CellDecoder.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/codec/CellCodecWithTags.CellDecoder.html
@@ -28,107 +28,114 @@
 <span class="sourceLineNo">020</span>import java.io.IOException;<a name="line.20"></a>
 <span class="sourceLineNo">021</span>import java.io.InputStream;<a name="line.21"></a>
 <span class="sourceLineNo">022</span>import java.io.OutputStream;<a name="line.22"></a>
-<span class="sourceLineNo">023</span><a name="line.23"></a>
-<span class="sourceLineNo">024</span>import org.apache.commons.io.IOUtils;<a name="line.24"></a>
-<span class="sourceLineNo">025</span>import org.apache.hadoop.hbase.Cell;<a name="line.25"></a>
-<span class="sourceLineNo">026</span>import org.apache.hadoop.hbase.CellUtil;<a name="line.26"></a>
-<span class="sourceLineNo">027</span>import org.apache.hadoop.hbase.HBaseInterfaceAudience;<a name="line.27"></a>
-<span class="sourceLineNo">028</span>import org.apache.hadoop.hbase.classification.InterfaceAudience;<a name="line.28"></a>
-<span class="sourceLineNo">029</span>import org.apache.hadoop.hbase.util.Bytes;<a name="line.29"></a>
-<span class="sourceLineNo">030</span><a name="line.30"></a>
-<span class="sourceLineNo">031</span>/**<a name="line.31"></a>
-<span class="sourceLineNo">032</span> * Basic Cell codec that just writes out all the individual elements of a Cell including the tags.<a name="line.32"></a>
-<span class="sourceLineNo">033</span> * Uses ints delimiting all lengths. Profligate. Needs tune up.<a name="line.33"></a>
-<span class="sourceLineNo">034</span> * &lt;b&gt;Use this Codec only at server side.&lt;/b&gt;<a name="line.34"></a>
-<span class="sourceLineNo">035</span> */<a name="line.35"></a>
-<span class="sourceLineNo">036</span>@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG)<a name="line.36"></a>
-<span class="sourceLineNo">037</span>public class CellCodecWithTags implements Codec {<a name="line.37"></a>
-<span class="sourceLineNo">038</span>  static class CellEncoder extends BaseEncoder {<a name="line.38"></a>
-<span class="sourceLineNo">039</span>    CellEncoder(final OutputStream out) {<a name="line.39"></a>
-<span class="sourceLineNo">040</span>      super(out);<a name="line.40"></a>
-<span class="sourceLineNo">041</span>    }<a name="line.41"></a>
-<span class="sourceLineNo">042</span><a name="line.42"></a>
-<span class="sourceLineNo">043</span>    @Override<a name="line.43"></a>
-<span class="sourceLineNo">044</span>    public void write(Cell cell) throws IOException {<a name="line.44"></a>
-<span class="sourceLineNo">045</span>      checkFlushed();<a name="line.45"></a>
-<span class="sourceLineNo">046</span>      // Row<a name="line.46"></a>
-<span class="sourceLineNo">047</span>      write(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());<a name="line.47"></a>
-<span class="sourceLineNo">048</span>      // Column family<a name="line.48"></a>
-<span class="sourceLineNo">049</span>      write(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength());<a name="line.49"></a>
-<span class="sourceLineNo">050</span>      // Qualifier<a name="line.50"></a>
-<span class="sourceLineNo">051</span>      write(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());<a name="line.51"></a>
-<span class="sourceLineNo">052</span>      // Version<a name="line.52"></a>
-<span class="sourceLineNo">053</span>      this.out.write(Bytes.toBytes(cell.getTimestamp()));<a name="line.53"></a>
-<span class="sourceLineNo">054</span>      // Type<a name="line.54"></a>
-<span class="sourceLineNo">055</span>      this.out.write(cell.getTypeByte());<a name="line.55"></a>
-<span class="sourceLineNo">056</span>      // Value<a name="line.56"></a>
-<span class="sourceLineNo">057</span>      write(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());<a name="line.57"></a>
-<span class="sourceLineNo">058</span>      // Tags<a name="line.58"></a>
-<span class="sourceLineNo">059</span>      write(cell.getTagsArray(), cell.getTagsOffset(), cell.getTagsLength());<a name="line.59"></a>
-<span class="sourceLineNo">060</span>      // MvccVersion<a name="line.60"></a>
-<span class="sourceLineNo">061</span>      this.out.write(Bytes.toBytes(cell.getSequenceId()));<a name="line.61"></a>
-<span class="sourceLineNo">062</span>    }<a name="line.62"></a>
-<span class="sourceLineNo">063</span><a name="line.63"></a>
-<span class="sourceLineNo">064</span>    /**<a name="line.64"></a>
-<span class="sourceLineNo">065</span>     * Write int length followed by array bytes.<a name="line.65"></a>
-<span class="sourceLineNo">066</span>     *<a name="line.66"></a>
-<span class="sourceLineNo">067</span>     * @param bytes<a name="line.67"></a>
-<span class="sourceLineNo">068</span>     * @param offset<a name="line.68"></a>
-<span class="sourceLineNo">069</span>     * @param length<a name="line.69"></a>
-<span class="sourceLineNo">070</span>     * @throws IOException<a name="line.70"></a>
-<span class="sourceLineNo">071</span>     */<a name="line.71"></a>
-<span class="sourceLineNo">072</span>    private void write(final byte[] bytes, final int offset, final int length) throws IOException {<a name="line.72"></a>
-<span class="sourceLineNo">073</span>      this.out.write(Bytes.toBytes(length));<a name="line.73"></a>
-<span class="sourceLineNo">074</span>      this.out.write(bytes, offset, length);<a name="line.74"></a>
-<span class="sourceLineNo">075</span>    }<a name="line.75"></a>
-<span class="sourceLineNo">076</span>  }<a name="line.76"></a>
-<span class="sourceLineNo">077</span><a name="line.77"></a>
-<span class="sourceLineNo">078</span>  static class CellDecoder extends BaseDecoder {<a name="line.78"></a>
-<span class="sourceLineNo">079</span>    public CellDecoder(final InputStream in) {<a name="line.79"></a>
-<span class="sourceLineNo">080</span>      super(in);<a name="line.80"></a>
-<span class="sourceLineNo">081</span>    }<a name="line.81"></a>
-<span class="sourceLineNo">082</span><a name="line.82"></a>
-<span class="sourceLineNo">083</span>    protected Cell parseCell() throws IOException {<a name="line.83"></a>
-<span class="sourceLineNo">084</span>      byte[] row = readByteArray(this.in);<a name="line.84"></a>
-<span class="sourceLineNo">085</span>      byte[] family = readByteArray(in);<a name="line.85"></a>
-<span class="sourceLineNo">086</span>      byte[] qualifier = readByteArray(in);<a name="line.86"></a>
-<span class="sourceLineNo">087</span>      byte[] longArray = new byte[Bytes.SIZEOF_LONG];<a name="line.87"></a>
-<span class="sourceLineNo">088</span>      IOUtils.readFully(this.in, longArray);<a name="line.88"></a>
-<span class="sourceLineNo">089</span>      long timestamp = Bytes.toLong(longArray);<a name="line.89"></a>
-<span class="sourceLineNo">090</span>      byte type = (byte) this.in.read();<a name="line.90"></a>
-<span class="sourceLineNo">091</span>      byte[] value = readByteArray(in);<a name="line.91"></a>
-<span class="sourceLineNo">092</span>      byte[] tags = readByteArray(in);<a name="line.92"></a>
-<span class="sourceLineNo">093</span>      // Read memstore version<a name="line.93"></a>
-<span class="sourceLineNo">094</span>      byte[] memstoreTSArray = new byte[Bytes.SIZEOF_LONG];<a name="line.94"></a>
-<span class="sourceLineNo">095</span>      IOUtils.readFully(this.in, memstoreTSArray);<a name="line.95"></a>
-<span class="sourceLineNo">096</span>      long memstoreTS = Bytes.toLong(memstoreTSArray);<a name="line.96"></a>
-<span class="sourceLineNo">097</span>      return CellUtil.createCell(row, family, qualifier, timestamp, type, value, tags, memstoreTS);<a name="line.97"></a>
-<span class="sourceLineNo">098</span>    }<a name="line.98"></a>
-<span class="sourceLineNo">099</span><a name="line.99"></a>
-<span class="sourceLineNo">100</span>    /**<a name="line.100"></a>
-<span class="sourceLineNo">101</span>     * @return Byte array read from the stream.<a name="line.101"></a>
-<span class="sourceLineNo">102</span>     * @throws IOException<a name="line.102"></a>
-<span class="sourceLineNo">103</span>     */<a name="line.103"></a>
-<span class="sourceLineNo">104</span>    private byte[] readByteArray(final InputStream in) throws IOException {<a name="line.104"></a>
-<span class="sourceLineNo">105</span>      byte[] intArray = new byte[Bytes.SIZEOF_INT];<a name="line.105"></a>
-<span class="sourceLineNo">106</span>      IOUtils.readFully(in, intArray);<a name="line.106"></a>
-<span class="sourceLineNo">107</span>      int length = Bytes.toInt(intArray);<a name="line.107"></a>
-<span class="sourceLineNo">108</span>      byte[] bytes = new byte[length];<a name="line.108"></a>
-<span class="sourceLineNo">109</span>      IOUtils.readFully(in, bytes);<a name="line.109"></a>
-<span class="sourceLineNo">110</span>      return bytes;<a name="line.110"></a>
-<span class="sourceLineNo">111</span>    }<a name="line.111"></a>
-<span class="sourceLineNo">112</span>  }<a name="line.112"></a>
-<span class="sourceLineNo">113</span><a name="line.113"></a>
-<span class="sourceLineNo">114</span>  @Override<a name="line.114"></a>
-<span class="sourceLineNo">115</span>  public Decoder getDecoder(InputStream is) {<a name="line.115"></a>
-<span class="sourceLineNo">116</span>    return new CellDecoder(is);<a name="line.116"></a>
-<span class="sourceLineNo">117</span>  }<a name="line.117"></a>
-<span class="sourceLineNo">118</span><a name="line.118"></a>
-<span class="sourceLineNo">119</span>  @Override<a name="line.119"></a>
-<span class="sourceLineNo">120</span>  public Encoder getEncoder(OutputStream os) {<a name="line.120"></a>
-<span class="sourceLineNo">121</span>    return new CellEncoder(os);<a name="line.121"></a>
-<span class="sourceLineNo">122</span>  }<a name="line.122"></a>
-<span class="sourceLineNo">123</span>}<a name="line.123"></a>
+<span class="sourceLineNo">023</span>import java.nio.ByteBuffer;<a name="line.23"></a>
+<span class="sourceLineNo">024</span><a name="line.24"></a>
+<span class="sourceLineNo">025</span>import org.apache.commons.io.IOUtils;<a name="line.25"></a>
+<span class="sourceLineNo">026</span>import org.apache.hadoop.hbase.Cell;<a name="line.26"></a>
+<span class="sourceLineNo">027</span>import org.apache.hadoop.hbase.CellUtil;<a name="line.27"></a>
+<span class="sourceLineNo">028</span>import org.apache.hadoop.hbase.HBaseInterfaceAudience;<a name="line.28"></a>
+<span class="sourceLineNo">029</span>import org.apache.hadoop.hbase.classification.InterfaceAudience;<a name="line.29"></a>
+<span class="sourceLineNo">030</span>import org.apache.hadoop.hbase.io.ByteBufferInputStream;<a name="line.30"></a>
+<span class="sourceLineNo">031</span>import org.apache.hadoop.hbase.util.Bytes;<a name="line.31"></a>
+<span class="sourceLineNo">032</span><a name="line.32"></a>
+<span class="sourceLineNo">033</span>/**<a name="line.33"></a>
+<span class="sourceLineNo">034</span> * Basic Cell codec that just writes out all the individual elements of a Cell including the tags.<a name="line.34"></a>
+<span class="sourceLineNo">035</span> * Uses ints delimiting all lengths. Profligate. Needs tune up.<a name="line.35"></a>
+<span class="sourceLineNo">036</span> * &lt;b&gt;Use this Codec only at server side.&lt;/b&gt;<a name="line.36"></a>
+<span class="sourceLineNo">037</span> */<a name="line.37"></a>
+<span class="sourceLineNo">038</span>@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG)<a name="line.38"></a>
+<span class="sourceLineNo">039</span>public class CellCodecWithTags implements Codec {<a name="line.39"></a>
+<span class="sourceLineNo">040</span>  static class CellEncoder extends BaseEncoder {<a name="line.40"></a>
+<span class="sourceLineNo">041</span>    CellEncoder(final OutputStream out) {<a name="line.41"></a>
+<span class="sourceLineNo">042</span>      super(out);<a name="line.42"></a>
+<span class="sourceLineNo">043</span>    }<a name="line.43"></a>
+<span class="sourceLineNo">044</span><a name="line.44"></a>
+<span class="sourceLineNo">045</span>    @Override<a name="line.45"></a>
+<span class="sourceLineNo">046</span>    public void write(Cell cell) throws IOException {<a name="line.46"></a>
+<span class="sourceLineNo">047</span>      checkFlushed();<a name="line.47"></a>
+<span class="sourceLineNo">048</span>      // Row<a name="line.48"></a>
+<span class="sourceLineNo">049</span>      write(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());<a name="line.49"></a>
+<span class="sourceLineNo">050</span>      // Column family<a name="line.50"></a>
+<span class="sourceLineNo">051</span>      write(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength());<a name="line.51"></a>
+<span class="sourceLineNo">052</span>      // Qualifier<a name="line.52"></a>
+<span class="sourceLineNo">053</span>      write(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());<a name="line.53"></a>
+<span class="sourceLineNo">054</span>      // Version<a name="line.54"></a>
+<span class="sourceLineNo">055</span>      this.out.write(Bytes.toBytes(cell.getTimestamp()));<a name="line.55"></a>
+<span class="sourceLineNo">056</span>      // Type<a name="line.56"></a>
+<span class="sourceLineNo">057</span>      this.out.write(cell.getTypeByte());<a name="line.57"></a>
+<span class="sourceLineNo">058</span>      // Value<a name="line.58"></a>
+<span class="sourceLineNo">059</span>      write(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());<a name="line.59"></a>
+<span class="sourceLineNo">060</span>      // Tags<a name="line.60"></a>
+<span class="sourceLineNo">061</span>      write(cell.getTagsArray(), cell.getTagsOffset(), cell.getTagsLength());<a name="line.61"></a>
+<span class="sourceLineNo">062</span>      // MvccVersion<a name="line.62"></a>
+<span class="sourceLineNo">063</span>      this.out.write(Bytes.toBytes(cell.getSequenceId()));<a name="line.63"></a>
+<span class="sourceLineNo">064</span>    }<a name="line.64"></a>
+<span class="sourceLineNo">065</span><a name="line.65"></a>
+<span class="sourceLineNo">066</span>    /**<a name="line.66"></a>
+<span class="sourceLineNo">067</span>     * Write int length followed by array bytes.<a name="line.67"></a>
+<span class="sourceLineNo">068</span>     *<a name="line.68"></a>
+<span class="sourceLineNo">069</span>     * @param bytes<a name="line.69"></a>
+<span class="sourceLineNo">070</span>     * @param offset<a name="line.70"></a>
+<span class="sourceLineNo">071</span>     * @param length<a name="line.71"></a>
+<span class="sourceLineNo">072</span>     * @throws IOException<a name="line.72"></a>
+<span class="sourceLineNo">073</span>     */<a name="line.73"></a>
+<span class="sourceLineNo">074</span>    private void write(final byte[] bytes, final int offset, final int length) throws IOException {<a name="line.74"></a>
+<span class="sourceLineNo">075</span>      this.out.write(Bytes.toBytes(length));<a name="line.75"></a>
+<span class="sourceLineNo">076</span>      this.out.write(bytes, offset, length);<a name="line.76"></a>
+<span class="sourceLineNo">077</span>    }<a name="line.77"></a>
+<span class="sourceLineNo">078</span>  }<a name="line.78"></a>
+<span class="sourceLineNo">079</span><a name="line.79"></a>
+<span class="sourceLineNo">080</span>  static class CellDecoder extends BaseDecoder {<a name="line.80"></a>
+<span class="sourceLineNo">081</span>    public CellDecoder(final InputStream in) {<a name="line.81"></a>
+<span class="sourceLineNo">082</span>      super(in);<a name="line.82"></a>
+<span class="sourceLineNo">083</span>    }<a name="line.83"></a>
+<span class="sourceLineNo">084</span><a name="line.84"></a>
+<span class="sourceLineNo">085</span>    protected Cell parseCell() throws IOException {<a name="line.85"></a>
+<span class="sourceLineNo">086</span>      byte[] row = readByteArray(this.in);<a name="line.86"></a>
+<span class="sourceLineNo">087</span>      byte[] family = readByteArray(in);<a name="line.87"></a>
+<span class="sourceLineNo">088</span>      byte[] qualifier = readByteArray(in);<a name="line.88"></a>
+<span class="sourceLineNo">089</span>      byte[] longArray = new byte[Bytes.SIZEOF_LONG];<a name="line.89"></a>
+<span class="sourceLineNo">090</span>      IOUtils.readFully(this.in, longArray);<a name="line.90"></a>
+<span class="sourceLineNo">091</span>      long timestamp = Bytes.toLong(longArray);<a name="line.91"></a>
+<span class="sourceLineNo">092</span>      byte type = (byte) this.in.read();<a name="line.92"></a>
+<span class="sourceLineNo">093</span>      byte[] value = readByteArray(in);<a name="line.93"></a>
+<span class="sourceLineNo">094</span>      byte[] tags = readByteArray(in);<a name="line.94"></a>
+<span class="sourceLineNo">095</span>      // Read memstore version<a name="line.95"></a>
+<span class="sourceLineNo">096</span>      byte[] memstoreTSArray = new byte[Bytes.SIZEOF_LONG];<a name="line.96"></a>
+<span class="sourceLineNo">097</span>      IOUtils.readFully(this.in, memstoreTSArray);<a name="line.97"></a>
+<span class="sourceLineNo">098</span>      long memstoreTS = Bytes.toLong(memstoreTSArray);<a name="line.98"></a>
+<span class="sourceLineNo">099</span>      return CellUtil.createCell(row, family, qualifier, timestamp, type, value, tags, memstoreTS);<a name="line.99"></a>
+<span class="sourceLineNo">100</span>    }<a name="line.100"></a>
+<span class="sourceLineNo">101</span><a name="line.101"></a>
+<span class="sourceLineNo">102</span>    /**<a name="line.102"></a>
+<span class="sourceLineNo">103</span>     * @return Byte array read from the stream.<a name="line.103"></a>
+<span class="sourceLineNo">104</span>     * @throws IOException<a name="line.104"></a>
+<span class="sourceLineNo">105</span>     */<a name="line.105"></a>
+<span class="sourceLineNo">106</span>    private byte[] readByteArray(final InputStream in) throws IOException {<a name="line.106"></a>
+<span class="sourceLineNo">107</span>      byte[] intArray = new byte[Bytes.SIZEOF_INT];<a name="line.107"></a>
+<span class="sourceLineNo">108</span>      IOUtils.readFully(in, intArray);<a name="line.108"></a>
+<span class="sourceLineNo">109</span>      int length = Bytes.toInt(intArray);<a name="line.109"></a>
+<span class="sourceLineNo">110</span>      byte[] bytes = new byte[length];<a name="line.110"></a>
+<span class="sourceLineNo">111</span>      IOUtils.readFully(in, bytes);<a name="line.111"></a>
+<span class="sourceLineNo">112</span>      return bytes;<a name="line.112"></a>
+<span class="sourceLineNo">113</span>    }<a name="line.113"></a>
+<span class="sourceLineNo">114</span>  }<a name="line.114"></a>
+<span class="sourceLineNo">115</span><a name="line.115"></a>
+<span class="sourceLineNo">116</span>  @Override<a name="line.116"></a>
+<span class="sourceLineNo">117</span>  public Decoder getDecoder(InputStream is) {<a name="line.117"></a>
+<span class="sourceLineNo">118</span>    return new CellDecoder(is);<a name="line.118"></a>
+<span class="sourceLineNo">119</span>  }<a name="line.119"></a>
+<span class="sourceLineNo">120</span><a name="line.120"></a>
+<span class="sourceLineNo">121</span>  @Override<a name="line.121"></a>
+<span class="sourceLineNo">122</span>  public Decoder getDecoder(ByteBuffer buf) {<a name="line.122"></a>
+<span class="sourceLineNo">123</span>    return getDecoder(new ByteBufferInputStream(buf));<a name="line.123"></a>
+<span class="sourceLineNo">124</span>  }<a name="line.124"></a>
+<span class="sourceLineNo">125</span><a name="line.125"></a>
+<span class="sourceLineNo">126</span>  @Override<a name="line.126"></a>
+<span class="sourceLineNo">127</span>  public Encoder getEncoder(OutputStream os) {<a name="line.127"></a>
+<span class="sourceLineNo">128</span>    return new CellEncoder(os);<a name="line.128"></a>
+<span class="sourceLineNo">129</span>  }<a name="line.129"></a>
+<span class="sourceLineNo">130</span>}<a name="line.130"></a>
 
 
 


Mime
View raw message