hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject [37/51] [partial] hbase git commit: Published site at 3bac31b2a49bca153df3b47a198667828b61f36e.
Date Sun, 29 Nov 2015 21:17:50 GMT
http://git-wip-us.apache.org/repos/asf/hbase/blob/ef7355e1/devapidocs/src-html/org/apache/hadoop/hbase/Tag.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/Tag.html b/devapidocs/src-html/org/apache/hadoop/hbase/Tag.html
index 59133de..85a093a 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/Tag.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/Tag.html
@@ -50,191 +50,181 @@
 <span class="sourceLineNo">042</span>  private int offset = 0;<a name="line.42"></a>
 <span class="sourceLineNo">043</span>  private int length = 0;<a name="line.43"></a>
 <span class="sourceLineNo">044</span><a name="line.44"></a>
-<span class="sourceLineNo">045</span>  // The special tag will write the length
of each tag and that will be<a name="line.45"></a>
-<span class="sourceLineNo">046</span>  // followed by the type and then the actual
tag.<a name="line.46"></a>
-<span class="sourceLineNo">047</span>  // So every time the length part is parsed
we need to add + 1 byte to it to<a name="line.47"></a>
-<span class="sourceLineNo">048</span>  // get the type and then get the actual
tag.<a name="line.48"></a>
-<span class="sourceLineNo">049</span>  public Tag(byte tagType, String tag) {<a
name="line.49"></a>
-<span class="sourceLineNo">050</span>    this(tagType, Bytes.toBytes(tag));<a
name="line.50"></a>
-<span class="sourceLineNo">051</span>  }<a name="line.51"></a>
-<span class="sourceLineNo">052</span><a name="line.52"></a>
-<span class="sourceLineNo">053</span>  /**<a name="line.53"></a>
-<span class="sourceLineNo">054</span>   * @param tagType<a name="line.54"></a>
-<span class="sourceLineNo">055</span>   * @param tag<a name="line.55"></a>
-<span class="sourceLineNo">056</span>   */<a name="line.56"></a>
-<span class="sourceLineNo">057</span>  public Tag(byte tagType, byte[] tag) {<a
name="line.57"></a>
-<span class="sourceLineNo">058</span>    /**<a name="line.58"></a>
-<span class="sourceLineNo">059</span>     * Format for a tag : &lt;length
of tag - 2 bytes&gt;&lt;type code - 1 byte&gt;&lt;tag&gt; taglength is
serialized<a name="line.59"></a>
-<span class="sourceLineNo">060</span>     * using 2 bytes only but as this will
be unsigned, we can have max taglength of<a name="line.60"></a>
-<span class="sourceLineNo">061</span>     * (Short.MAX_SIZE * 2) +1. It includes
1 byte type length and actual tag bytes length.<a name="line.61"></a>
-<span class="sourceLineNo">062</span>     */<a name="line.62"></a>
-<span class="sourceLineNo">063</span>    int tagLength = tag.length + TYPE_LENGTH_SIZE;<a
name="line.63"></a>
-<span class="sourceLineNo">064</span>    if (tagLength &gt; MAX_TAG_LENGTH)
{<a name="line.64"></a>
-<span class="sourceLineNo">065</span>      throw new IllegalArgumentException(<a
name="line.65"></a>
-<span class="sourceLineNo">066</span>          "Invalid tag data being passed.
Its length can not exceed " + MAX_TAG_LENGTH);<a name="line.66"></a>
-<span class="sourceLineNo">067</span>    }<a name="line.67"></a>
-<span class="sourceLineNo">068</span>    length = TAG_LENGTH_SIZE + tagLength;<a
name="line.68"></a>
-<span class="sourceLineNo">069</span>    bytes = new byte[length];<a name="line.69"></a>
-<span class="sourceLineNo">070</span>    int pos = Bytes.putAsShort(bytes, 0,
tagLength);<a name="line.70"></a>
-<span class="sourceLineNo">071</span>    pos = Bytes.putByte(bytes, pos, tagType);<a
name="line.71"></a>
-<span class="sourceLineNo">072</span>    Bytes.putBytes(bytes, pos, tag, 0, tag.length);<a
name="line.72"></a>
-<span class="sourceLineNo">073</span>    this.type = tagType;<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>   * Creates a Tag from the specified byte
array and offset. Presumes<a name="line.77"></a>
-<span class="sourceLineNo">078</span>   * &lt;code&gt;bytes&lt;/code&gt;
content starting at &lt;code&gt;offset&lt;/code&gt; is formatted as<a name="line.78"></a>
-<span class="sourceLineNo">079</span>   * a Tag blob.<a name="line.79"></a>
-<span class="sourceLineNo">080</span>   * The bytes to include the tag type,
tag length and actual tag bytes.<a name="line.80"></a>
-<span class="sourceLineNo">081</span>   * @param bytes<a name="line.81"></a>
-<span class="sourceLineNo">082</span>   *          byte array<a name="line.82"></a>
-<span class="sourceLineNo">083</span>   * @param offset<a name="line.83"></a>
-<span class="sourceLineNo">084</span>   *          offset to start of Tag<a
name="line.84"></a>
-<span class="sourceLineNo">085</span>   */<a name="line.85"></a>
-<span class="sourceLineNo">086</span>  public Tag(byte[] bytes, int offset) {<a
name="line.86"></a>
-<span class="sourceLineNo">087</span>    this(bytes, offset, getLength(bytes,
offset));<a name="line.87"></a>
+<span class="sourceLineNo">045</span>  /**<a name="line.45"></a>
+<span class="sourceLineNo">046</span>   * The special tag will write the length
of each tag and that will be<a name="line.46"></a>
+<span class="sourceLineNo">047</span>   * followed by the type and then the actual
tag.<a name="line.47"></a>
+<span class="sourceLineNo">048</span>   * So every time the length part is parsed
we need to add + 1 byte to it to<a name="line.48"></a>
+<span class="sourceLineNo">049</span>   * get the type and then get the actual
tag.<a name="line.49"></a>
+<span class="sourceLineNo">050</span>   */<a name="line.50"></a>
+<span class="sourceLineNo">051</span>  public Tag(byte tagType, String tag) {<a
name="line.51"></a>
+<span class="sourceLineNo">052</span>    this(tagType, Bytes.toBytes(tag));<a
name="line.52"></a>
+<span class="sourceLineNo">053</span>  }<a name="line.53"></a>
+<span class="sourceLineNo">054</span><a name="line.54"></a>
+<span class="sourceLineNo">055</span>  /**<a name="line.55"></a>
+<span class="sourceLineNo">056</span>   * Format for a tag :<a name="line.56"></a>
+<span class="sourceLineNo">057</span>   * {@code &lt;length of tag - 2 bytes&gt;&lt;type
code - 1 byte&gt;&lt;tag&gt;} tag length is serialized<a name="line.57"></a>
+<span class="sourceLineNo">058</span>   * using 2 bytes only but as this will
be unsigned, we can have max tag length of<a name="line.58"></a>
+<span class="sourceLineNo">059</span>   * (Short.MAX_SIZE * 2) +1. It includes
1 byte type length and actual tag bytes length.<a name="line.59"></a>
+<span class="sourceLineNo">060</span>   */<a name="line.60"></a>
+<span class="sourceLineNo">061</span>  public Tag(byte tagType, byte[] tag) {<a
name="line.61"></a>
+<span class="sourceLineNo">062</span>    int tagLength = tag.length + TYPE_LENGTH_SIZE;<a
name="line.62"></a>
+<span class="sourceLineNo">063</span>    if (tagLength &gt; MAX_TAG_LENGTH)
{<a name="line.63"></a>
+<span class="sourceLineNo">064</span>      throw new IllegalArgumentException(<a
name="line.64"></a>
+<span class="sourceLineNo">065</span>          "Invalid tag data being passed.
Its length can not exceed " + MAX_TAG_LENGTH);<a name="line.65"></a>
+<span class="sourceLineNo">066</span>    }<a name="line.66"></a>
+<span class="sourceLineNo">067</span>    length = TAG_LENGTH_SIZE + tagLength;<a
name="line.67"></a>
+<span class="sourceLineNo">068</span>    bytes = new byte[length];<a name="line.68"></a>
+<span class="sourceLineNo">069</span>    int pos = Bytes.putAsShort(bytes, 0,
tagLength);<a name="line.69"></a>
+<span class="sourceLineNo">070</span>    pos = Bytes.putByte(bytes, pos, tagType);<a
name="line.70"></a>
+<span class="sourceLineNo">071</span>    Bytes.putBytes(bytes, pos, tag, 0, tag.length);<a
name="line.71"></a>
+<span class="sourceLineNo">072</span>    this.type = tagType;<a name="line.72"></a>
+<span class="sourceLineNo">073</span>  }<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>   * Creates a Tag from the specified byte
array and offset. Presumes<a name="line.76"></a>
+<span class="sourceLineNo">077</span>   * &lt;code&gt;bytes&lt;/code&gt;
content starting at &lt;code&gt;offset&lt;/code&gt; is formatted as<a name="line.77"></a>
+<span class="sourceLineNo">078</span>   * a Tag blob.<a name="line.78"></a>
+<span class="sourceLineNo">079</span>   * The bytes to include the tag type,
tag length and actual tag bytes.<a name="line.79"></a>
+<span class="sourceLineNo">080</span>   * @param offset offset to start of Tag<a
name="line.80"></a>
+<span class="sourceLineNo">081</span>   */<a name="line.81"></a>
+<span class="sourceLineNo">082</span>  public Tag(byte[] bytes, int offset) {<a
name="line.82"></a>
+<span class="sourceLineNo">083</span>    this(bytes, offset, getLength(bytes,
offset));<a name="line.83"></a>
+<span class="sourceLineNo">084</span>  }<a name="line.84"></a>
+<span class="sourceLineNo">085</span><a name="line.85"></a>
+<span class="sourceLineNo">086</span>  private static int getLength(byte[] bytes,
int offset) {<a name="line.86"></a>
+<span class="sourceLineNo">087</span>    return TAG_LENGTH_SIZE + Bytes.readAsInt(bytes,
offset, TAG_LENGTH_SIZE);<a name="line.87"></a>
 <span class="sourceLineNo">088</span>  }<a name="line.88"></a>
 <span class="sourceLineNo">089</span><a name="line.89"></a>
-<span class="sourceLineNo">090</span>  private static int getLength(byte[] bytes,
int offset) {<a name="line.90"></a>
-<span class="sourceLineNo">091</span>    return TAG_LENGTH_SIZE + Bytes.readAsInt(bytes,
offset, TAG_LENGTH_SIZE);<a name="line.91"></a>
-<span class="sourceLineNo">092</span>  }<a name="line.92"></a>
-<span class="sourceLineNo">093</span><a name="line.93"></a>
-<span class="sourceLineNo">094</span>  /**<a name="line.94"></a>
-<span class="sourceLineNo">095</span>   * Creates a Tag from the specified byte
array, starting at offset, and for length<a name="line.95"></a>
-<span class="sourceLineNo">096</span>   * &lt;code&gt;length&lt;/code&gt;.
Presumes &lt;code&gt;bytes&lt;/code&gt; content starting at &lt;code&gt;offset&lt;/code&gt;
is<a name="line.96"></a>
-<span class="sourceLineNo">097</span>   * formatted as a Tag blob.<a name="line.97"></a>
-<span class="sourceLineNo">098</span>   * @param bytes<a name="line.98"></a>
-<span class="sourceLineNo">099</span>   *          byte array<a name="line.99"></a>
-<span class="sourceLineNo">100</span>   * @param offset<a name="line.100"></a>
-<span class="sourceLineNo">101</span>   *          offset to start of the Tag<a
name="line.101"></a>
-<span class="sourceLineNo">102</span>   * @param length<a name="line.102"></a>
-<span class="sourceLineNo">103</span>   *          length of the Tag<a name="line.103"></a>
-<span class="sourceLineNo">104</span>   */<a name="line.104"></a>
-<span class="sourceLineNo">105</span>  public Tag(byte[] bytes, int offset, int
length) {<a name="line.105"></a>
-<span class="sourceLineNo">106</span>    if (length &gt; MAX_TAG_LENGTH)
{<a name="line.106"></a>
-<span class="sourceLineNo">107</span>      throw new IllegalArgumentException(<a
name="line.107"></a>
-<span class="sourceLineNo">108</span>          "Invalid tag data being passed.
Its length can not exceed " + MAX_TAG_LENGTH);<a name="line.108"></a>
-<span class="sourceLineNo">109</span>    }<a name="line.109"></a>
-<span class="sourceLineNo">110</span>    this.bytes = bytes;<a name="line.110"></a>
-<span class="sourceLineNo">111</span>    this.offset = offset;<a name="line.111"></a>
-<span class="sourceLineNo">112</span>    this.length = length;<a name="line.112"></a>
-<span class="sourceLineNo">113</span>    this.type = bytes[offset + TAG_LENGTH_SIZE];<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>  /**<a name="line.116"></a>
-<span class="sourceLineNo">117</span>   * @return The byte array backing this
Tag.<a name="line.117"></a>
-<span class="sourceLineNo">118</span>   */<a name="line.118"></a>
-<span class="sourceLineNo">119</span>  public byte[] getBuffer() {<a name="line.119"></a>
-<span class="sourceLineNo">120</span>    return this.bytes;<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">123</span>  /**<a name="line.123"></a>
-<span class="sourceLineNo">124</span>   * @return the tag type<a name="line.124"></a>
-<span class="sourceLineNo">125</span>   */<a name="line.125"></a>
-<span class="sourceLineNo">126</span>  public byte getType() {<a name="line.126"></a>
-<span class="sourceLineNo">127</span>    return this.type;<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>
-<span class="sourceLineNo">130</span>  /**<a name="line.130"></a>
-<span class="sourceLineNo">131</span>   * @return Length of actual tag bytes
within the backed buffer<a name="line.131"></a>
-<span class="sourceLineNo">132</span>   */<a name="line.132"></a>
-<span class="sourceLineNo">133</span>  public int getTagLength() {<a name="line.133"></a>
-<span class="sourceLineNo">134</span>    return this.length - INFRASTRUCTURE_SIZE;<a
name="line.134"></a>
-<span class="sourceLineNo">135</span>  }<a name="line.135"></a>
-<span class="sourceLineNo">136</span><a name="line.136"></a>
-<span class="sourceLineNo">137</span>  /**<a name="line.137"></a>
-<span class="sourceLineNo">138</span>   * @return Offset of actual tag bytes
within the backed buffer<a name="line.138"></a>
-<span class="sourceLineNo">139</span>   */<a name="line.139"></a>
-<span class="sourceLineNo">140</span>  public int getTagOffset() {<a name="line.140"></a>
-<span class="sourceLineNo">141</span>    return this.offset + INFRASTRUCTURE_SIZE;<a
name="line.141"></a>
-<span class="sourceLineNo">142</span>  }<a name="line.142"></a>
-<span class="sourceLineNo">143</span><a name="line.143"></a>
-<span class="sourceLineNo">144</span>  /**<a name="line.144"></a>
-<span class="sourceLineNo">145</span>   * Returns tag value in a new byte array.<a
name="line.145"></a>
-<span class="sourceLineNo">146</span>   * Primarily for use client-side. If server-side,
use<a name="line.146"></a>
-<span class="sourceLineNo">147</span>   * {@link #getBuffer()} with appropriate
{@link #getTagOffset()} and {@link #getTagLength()}<a name="line.147"></a>
-<span class="sourceLineNo">148</span>   * instead to save on allocations.<a
name="line.148"></a>
-<span class="sourceLineNo">149</span>   * @return tag value in a new byte array.<a
name="line.149"></a>
-<span class="sourceLineNo">150</span>   */<a name="line.150"></a>
-<span class="sourceLineNo">151</span>  public byte[] getValue() {<a name="line.151"></a>
-<span class="sourceLineNo">152</span>    int tagLength = getTagLength();<a
name="line.152"></a>
-<span class="sourceLineNo">153</span>    byte[] tag = new byte[tagLength];<a
name="line.153"></a>
-<span class="sourceLineNo">154</span>    Bytes.putBytes(tag, 0, bytes, getTagOffset(),
tagLength);<a name="line.154"></a>
-<span class="sourceLineNo">155</span>    return tag;<a name="line.155"></a>
-<span class="sourceLineNo">156</span>  }<a name="line.156"></a>
-<span class="sourceLineNo">157</span><a name="line.157"></a>
-<span class="sourceLineNo">158</span>  /**<a name="line.158"></a>
-<span class="sourceLineNo">159</span>   * Creates the list of tags from the byte
array b. Expected that b is in the<a name="line.159"></a>
-<span class="sourceLineNo">160</span>   * expected tag format<a name="line.160"></a>
-<span class="sourceLineNo">161</span>   * @param b<a name="line.161"></a>
-<span class="sourceLineNo">162</span>   * @param offset<a name="line.162"></a>
-<span class="sourceLineNo">163</span>   * @param length<a name="line.163"></a>
-<span class="sourceLineNo">164</span>   * @return List of tags<a name="line.164"></a>
-<span class="sourceLineNo">165</span>   */<a name="line.165"></a>
-<span class="sourceLineNo">166</span>  public static List&lt;Tag&gt;
asList(byte[] b, int offset, int length) {<a name="line.166"></a>
-<span class="sourceLineNo">167</span>    List&lt;Tag&gt; tags = new ArrayList&lt;Tag&gt;();<a
name="line.167"></a>
-<span class="sourceLineNo">168</span>    int pos = offset;<a name="line.168"></a>
-<span class="sourceLineNo">169</span>    while (pos &lt; offset + length)
{<a name="line.169"></a>
-<span class="sourceLineNo">170</span>      int tagLen = Bytes.readAsInt(b, pos,
TAG_LENGTH_SIZE);<a name="line.170"></a>
-<span class="sourceLineNo">171</span>      tags.add(new Tag(b, pos, tagLen +
TAG_LENGTH_SIZE));<a name="line.171"></a>
-<span class="sourceLineNo">172</span>      pos += TAG_LENGTH_SIZE + tagLen;<a
name="line.172"></a>
-<span class="sourceLineNo">173</span>    }<a name="line.173"></a>
-<span class="sourceLineNo">174</span>    return tags;<a name="line.174"></a>
-<span class="sourceLineNo">175</span>  }<a name="line.175"></a>
-<span class="sourceLineNo">176</span><a name="line.176"></a>
-<span class="sourceLineNo">177</span>  /**<a name="line.177"></a>
-<span class="sourceLineNo">178</span>   * Write a list of tags into a byte array<a
name="line.178"></a>
-<span class="sourceLineNo">179</span>   * @param tags<a name="line.179"></a>
-<span class="sourceLineNo">180</span>   * @return the serialized tag data as
bytes<a name="line.180"></a>
-<span class="sourceLineNo">181</span>   */<a name="line.181"></a>
-<span class="sourceLineNo">182</span>  public static byte[] fromList(List&lt;Tag&gt;
tags) {<a name="line.182"></a>
-<span class="sourceLineNo">183</span>    int length = 0;<a name="line.183"></a>
-<span class="sourceLineNo">184</span>    for (Tag tag: tags) {<a name="line.184"></a>
-<span class="sourceLineNo">185</span>      length += tag.length;<a name="line.185"></a>
-<span class="sourceLineNo">186</span>    }<a name="line.186"></a>
-<span class="sourceLineNo">187</span>    byte[] b = new byte[length];<a name="line.187"></a>
-<span class="sourceLineNo">188</span>    int pos = 0;<a name="line.188"></a>
-<span class="sourceLineNo">189</span>    for (Tag tag: tags) {<a name="line.189"></a>
-<span class="sourceLineNo">190</span>      System.arraycopy(tag.bytes, tag.offset,
b, pos, tag.length);<a name="line.190"></a>
-<span class="sourceLineNo">191</span>      pos += tag.length;<a name="line.191"></a>
-<span class="sourceLineNo">192</span>    }<a name="line.192"></a>
-<span class="sourceLineNo">193</span>    return b;<a name="line.193"></a>
-<span class="sourceLineNo">194</span>  }<a name="line.194"></a>
-<span class="sourceLineNo">195</span><a name="line.195"></a>
-<span class="sourceLineNo">196</span>  /**<a name="line.196"></a>
-<span class="sourceLineNo">197</span>   * Retrieve the first tag from the tags
byte array matching the passed in tag type<a name="line.197"></a>
-<span class="sourceLineNo">198</span>   * @param b<a name="line.198"></a>
-<span class="sourceLineNo">199</span>   * @param offset<a name="line.199"></a>
-<span class="sourceLineNo">200</span>   * @param length<a name="line.200"></a>
-<span class="sourceLineNo">201</span>   * @param type<a name="line.201"></a>
-<span class="sourceLineNo">202</span>   * @return null if there is no tag of
the passed in tag type<a name="line.202"></a>
-<span class="sourceLineNo">203</span>   */<a name="line.203"></a>
-<span class="sourceLineNo">204</span>  public static Tag getTag(byte[] b, int
offset, int length, byte type) {<a name="line.204"></a>
-<span class="sourceLineNo">205</span>    int pos = offset;<a name="line.205"></a>
-<span class="sourceLineNo">206</span>    while (pos &lt; offset + length)
{<a name="line.206"></a>
-<span class="sourceLineNo">207</span>      int tagLen = Bytes.readAsInt(b, pos,
TAG_LENGTH_SIZE);<a name="line.207"></a>
-<span class="sourceLineNo">208</span>      if(b[pos + TAG_LENGTH_SIZE] == type)
{<a name="line.208"></a>
-<span class="sourceLineNo">209</span>        return new Tag(b, pos, tagLen +
TAG_LENGTH_SIZE);<a name="line.209"></a>
-<span class="sourceLineNo">210</span>      }<a name="line.210"></a>
-<span class="sourceLineNo">211</span>      pos += TAG_LENGTH_SIZE + tagLen;<a
name="line.211"></a>
-<span class="sourceLineNo">212</span>    }<a name="line.212"></a>
-<span class="sourceLineNo">213</span>    return null;<a name="line.213"></a>
-<span class="sourceLineNo">214</span>  }<a name="line.214"></a>
-<span class="sourceLineNo">215</span><a name="line.215"></a>
-<span class="sourceLineNo">216</span>  /**<a name="line.216"></a>
-<span class="sourceLineNo">217</span>   * Returns the total length of the entire
tag entity<a name="line.217"></a>
-<span class="sourceLineNo">218</span>   */<a name="line.218"></a>
-<span class="sourceLineNo">219</span>  int getLength() {<a name="line.219"></a>
-<span class="sourceLineNo">220</span>    return this.length;<a name="line.220"></a>
-<span class="sourceLineNo">221</span>  }<a name="line.221"></a>
-<span class="sourceLineNo">222</span><a name="line.222"></a>
-<span class="sourceLineNo">223</span>  /**<a name="line.223"></a>
-<span class="sourceLineNo">224</span>   * Returns the offset of the entire tag
entity<a name="line.224"></a>
-<span class="sourceLineNo">225</span>   */<a name="line.225"></a>
-<span class="sourceLineNo">226</span>  int getOffset() {<a name="line.226"></a>
-<span class="sourceLineNo">227</span>    return this.offset;<a name="line.227"></a>
-<span class="sourceLineNo">228</span>  }<a name="line.228"></a>
-<span class="sourceLineNo">229</span>}<a name="line.229"></a>
+<span class="sourceLineNo">090</span>  /**<a name="line.90"></a>
+<span class="sourceLineNo">091</span>   * Creates a Tag from the specified byte
array, starting at offset, and for length<a name="line.91"></a>
+<span class="sourceLineNo">092</span>   * &lt;code&gt;length&lt;/code&gt;.
Presumes &lt;code&gt;bytes&lt;/code&gt; content starting at &lt;code&gt;offset&lt;/code&gt;
is<a name="line.92"></a>
+<span class="sourceLineNo">093</span>   * formatted as a Tag blob.<a name="line.93"></a>
+<span class="sourceLineNo">094</span>   */<a name="line.94"></a>
+<span class="sourceLineNo">095</span>  public Tag(byte[] bytes, int offset, int
length) {<a name="line.95"></a>
+<span class="sourceLineNo">096</span>    if (length &gt; MAX_TAG_LENGTH)
{<a name="line.96"></a>
+<span class="sourceLineNo">097</span>      throw new IllegalArgumentException(<a
name="line.97"></a>
+<span class="sourceLineNo">098</span>          "Invalid tag data being passed.
Its length can not exceed " + MAX_TAG_LENGTH);<a name="line.98"></a>
+<span class="sourceLineNo">099</span>    }<a name="line.99"></a>
+<span class="sourceLineNo">100</span>    this.bytes = bytes;<a name="line.100"></a>
+<span class="sourceLineNo">101</span>    this.offset = offset;<a name="line.101"></a>
+<span class="sourceLineNo">102</span>    this.length = length;<a name="line.102"></a>
+<span class="sourceLineNo">103</span>    this.type = bytes[offset + TAG_LENGTH_SIZE];<a
name="line.103"></a>
+<span class="sourceLineNo">104</span>  }<a name="line.104"></a>
+<span class="sourceLineNo">105</span><a name="line.105"></a>
+<span class="sourceLineNo">106</span>  /**<a name="line.106"></a>
+<span class="sourceLineNo">107</span>   * @return The byte array backing this
Tag.<a name="line.107"></a>
+<span class="sourceLineNo">108</span>   */<a name="line.108"></a>
+<span class="sourceLineNo">109</span>  public byte[] getBuffer() {<a name="line.109"></a>
+<span class="sourceLineNo">110</span>    return this.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>   * @return the tag type<a name="line.114"></a>
+<span class="sourceLineNo">115</span>   */<a name="line.115"></a>
+<span class="sourceLineNo">116</span>  public byte getType() {<a name="line.116"></a>
+<span class="sourceLineNo">117</span>    return this.type;<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>  /**<a name="line.120"></a>
+<span class="sourceLineNo">121</span>   * @return Length of actual tag bytes
within the backed buffer<a name="line.121"></a>
+<span class="sourceLineNo">122</span>   */<a name="line.122"></a>
+<span class="sourceLineNo">123</span>  public int getTagLength() {<a name="line.123"></a>
+<span class="sourceLineNo">124</span>    return this.length - INFRASTRUCTURE_SIZE;<a
name="line.124"></a>
+<span class="sourceLineNo">125</span>  }<a name="line.125"></a>
+<span class="sourceLineNo">126</span><a name="line.126"></a>
+<span class="sourceLineNo">127</span>  /**<a name="line.127"></a>
+<span class="sourceLineNo">128</span>   * @return Offset of actual tag bytes
within the backed buffer<a name="line.128"></a>
+<span class="sourceLineNo">129</span>   */<a name="line.129"></a>
+<span class="sourceLineNo">130</span>  public int getTagOffset() {<a name="line.130"></a>
+<span class="sourceLineNo">131</span>    return this.offset + INFRASTRUCTURE_SIZE;<a
name="line.131"></a>
+<span class="sourceLineNo">132</span>  }<a name="line.132"></a>
+<span class="sourceLineNo">133</span><a name="line.133"></a>
+<span class="sourceLineNo">134</span>  /**<a name="line.134"></a>
+<span class="sourceLineNo">135</span>   * Returns tag value in a new byte array.<a
name="line.135"></a>
+<span class="sourceLineNo">136</span>   * Primarily for use client-side. If server-side,
use<a name="line.136"></a>
+<span class="sourceLineNo">137</span>   * {@link #getBuffer()} with appropriate
{@link #getTagOffset()} and {@link #getTagLength()}<a name="line.137"></a>
+<span class="sourceLineNo">138</span>   * instead to save on allocations.<a
name="line.138"></a>
+<span class="sourceLineNo">139</span>   * @return tag value in a new byte array.<a
name="line.139"></a>
+<span class="sourceLineNo">140</span>   */<a name="line.140"></a>
+<span class="sourceLineNo">141</span>  public byte[] getValue() {<a name="line.141"></a>
+<span class="sourceLineNo">142</span>    int tagLength = getTagLength();<a
name="line.142"></a>
+<span class="sourceLineNo">143</span>    byte[] tag = new byte[tagLength];<a
name="line.143"></a>
+<span class="sourceLineNo">144</span>    Bytes.putBytes(tag, 0, bytes, getTagOffset(),
tagLength);<a name="line.144"></a>
+<span class="sourceLineNo">145</span>    return tag;<a name="line.145"></a>
+<span class="sourceLineNo">146</span>  }<a name="line.146"></a>
+<span class="sourceLineNo">147</span><a name="line.147"></a>
+<span class="sourceLineNo">148</span>  /**<a name="line.148"></a>
+<span class="sourceLineNo">149</span>   * Creates the list of tags from the byte
array b. Expected that b is in the<a name="line.149"></a>
+<span class="sourceLineNo">150</span>   * expected tag format<a name="line.150"></a>
+<span class="sourceLineNo">151</span>   * @param b<a name="line.151"></a>
+<span class="sourceLineNo">152</span>   * @param offset<a name="line.152"></a>
+<span class="sourceLineNo">153</span>   * @param length<a name="line.153"></a>
+<span class="sourceLineNo">154</span>   * @return List of tags<a name="line.154"></a>
+<span class="sourceLineNo">155</span>   */<a name="line.155"></a>
+<span class="sourceLineNo">156</span>  public static List&lt;Tag&gt;
asList(byte[] b, int offset, int length) {<a name="line.156"></a>
+<span class="sourceLineNo">157</span>    List&lt;Tag&gt; tags = new ArrayList&lt;Tag&gt;();<a
name="line.157"></a>
+<span class="sourceLineNo">158</span>    int pos = offset;<a name="line.158"></a>
+<span class="sourceLineNo">159</span>    while (pos &lt; offset + length)
{<a name="line.159"></a>
+<span class="sourceLineNo">160</span>      int tagLen = Bytes.readAsInt(b, pos,
TAG_LENGTH_SIZE);<a name="line.160"></a>
+<span class="sourceLineNo">161</span>      tags.add(new Tag(b, pos, tagLen +
TAG_LENGTH_SIZE));<a name="line.161"></a>
+<span class="sourceLineNo">162</span>      pos += TAG_LENGTH_SIZE + tagLen;<a
name="line.162"></a>
+<span class="sourceLineNo">163</span>    }<a name="line.163"></a>
+<span class="sourceLineNo">164</span>    return tags;<a name="line.164"></a>
+<span class="sourceLineNo">165</span>  }<a name="line.165"></a>
+<span class="sourceLineNo">166</span><a name="line.166"></a>
+<span class="sourceLineNo">167</span>  /**<a name="line.167"></a>
+<span class="sourceLineNo">168</span>   * Write a list of tags into a byte array<a
name="line.168"></a>
+<span class="sourceLineNo">169</span>   * @param tags<a name="line.169"></a>
+<span class="sourceLineNo">170</span>   * @return the serialized tag data as
bytes<a name="line.170"></a>
+<span class="sourceLineNo">171</span>   */<a name="line.171"></a>
+<span class="sourceLineNo">172</span>  public static byte[] fromList(List&lt;Tag&gt;
tags) {<a name="line.172"></a>
+<span class="sourceLineNo">173</span>    int length = 0;<a name="line.173"></a>
+<span class="sourceLineNo">174</span>    for (Tag tag: tags) {<a name="line.174"></a>
+<span class="sourceLineNo">175</span>      length += tag.length;<a name="line.175"></a>
+<span class="sourceLineNo">176</span>    }<a name="line.176"></a>
+<span class="sourceLineNo">177</span>    byte[] b = new byte[length];<a name="line.177"></a>
+<span class="sourceLineNo">178</span>    int pos = 0;<a name="line.178"></a>
+<span class="sourceLineNo">179</span>    for (Tag tag: tags) {<a name="line.179"></a>
+<span class="sourceLineNo">180</span>      System.arraycopy(tag.bytes, tag.offset,
b, pos, tag.length);<a name="line.180"></a>
+<span class="sourceLineNo">181</span>      pos += tag.length;<a name="line.181"></a>
+<span class="sourceLineNo">182</span>    }<a name="line.182"></a>
+<span class="sourceLineNo">183</span>    return b;<a name="line.183"></a>
+<span class="sourceLineNo">184</span>  }<a name="line.184"></a>
+<span class="sourceLineNo">185</span><a name="line.185"></a>
+<span class="sourceLineNo">186</span>  /**<a name="line.186"></a>
+<span class="sourceLineNo">187</span>   * Retrieve the first tag from the tags
byte array matching the passed in tag type<a name="line.187"></a>
+<span class="sourceLineNo">188</span>   * @param b<a name="line.188"></a>
+<span class="sourceLineNo">189</span>   * @param offset<a name="line.189"></a>
+<span class="sourceLineNo">190</span>   * @param length<a name="line.190"></a>
+<span class="sourceLineNo">191</span>   * @param type<a name="line.191"></a>
+<span class="sourceLineNo">192</span>   * @return null if there is no tag of
the passed in tag type<a name="line.192"></a>
+<span class="sourceLineNo">193</span>   */<a name="line.193"></a>
+<span class="sourceLineNo">194</span>  public static Tag getTag(byte[] b, int
offset, int length, byte type) {<a name="line.194"></a>
+<span class="sourceLineNo">195</span>    int pos = offset;<a name="line.195"></a>
+<span class="sourceLineNo">196</span>    while (pos &lt; offset + length)
{<a name="line.196"></a>
+<span class="sourceLineNo">197</span>      int tagLen = Bytes.readAsInt(b, pos,
TAG_LENGTH_SIZE);<a name="line.197"></a>
+<span class="sourceLineNo">198</span>      if(b[pos + TAG_LENGTH_SIZE] == type)
{<a name="line.198"></a>
+<span class="sourceLineNo">199</span>        return new Tag(b, pos, tagLen +
TAG_LENGTH_SIZE);<a name="line.199"></a>
+<span class="sourceLineNo">200</span>      }<a name="line.200"></a>
+<span class="sourceLineNo">201</span>      pos += TAG_LENGTH_SIZE + tagLen;<a
name="line.201"></a>
+<span class="sourceLineNo">202</span>    }<a name="line.202"></a>
+<span class="sourceLineNo">203</span>    return null;<a name="line.203"></a>
+<span class="sourceLineNo">204</span>  }<a name="line.204"></a>
+<span class="sourceLineNo">205</span><a name="line.205"></a>
+<span class="sourceLineNo">206</span>  /**<a name="line.206"></a>
+<span class="sourceLineNo">207</span>   * Returns the total length of the entire
tag entity<a name="line.207"></a>
+<span class="sourceLineNo">208</span>   */<a name="line.208"></a>
+<span class="sourceLineNo">209</span>  int getLength() {<a name="line.209"></a>
+<span class="sourceLineNo">210</span>    return this.length;<a name="line.210"></a>
+<span class="sourceLineNo">211</span>  }<a name="line.211"></a>
+<span class="sourceLineNo">212</span><a name="line.212"></a>
+<span class="sourceLineNo">213</span>  /**<a name="line.213"></a>
+<span class="sourceLineNo">214</span>   * Returns the offset of the entire tag
entity<a name="line.214"></a>
+<span class="sourceLineNo">215</span>   */<a name="line.215"></a>
+<span class="sourceLineNo">216</span>  int getOffset() {<a name="line.216"></a>
+<span class="sourceLineNo">217</span>    return this.offset;<a name="line.217"></a>
+<span class="sourceLineNo">218</span>  }<a name="line.218"></a>
+<span class="sourceLineNo">219</span>}<a name="line.219"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/ef7355e1/devapidocs/src-html/org/apache/hadoop/hbase/client/Query.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/client/Query.html b/devapidocs/src-html/org/apache/hadoop/hbase/client/Query.html
index e79f305..c186ad9 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/client/Query.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/client/Query.html
@@ -206,7 +206,7 @@
 <span class="sourceLineNo">198</span>  }<a name="line.198"></a>
 <span class="sourceLineNo">199</span><a name="line.199"></a>
 <span class="sourceLineNo">200</span>  /**<a name="line.200"></a>
-<span class="sourceLineNo">201</span>   * @return Map&lt;byte[], TimeRange&gt;
a map of column families to time ranges<a name="line.201"></a>
+<span class="sourceLineNo">201</span>   * @return A map of column families to
time ranges<a name="line.201"></a>
 <span class="sourceLineNo">202</span>   */<a name="line.202"></a>
 <span class="sourceLineNo">203</span>  public Map&lt;byte[], TimeRange&gt;
getColumnFamilyTimeRange() {<a name="line.203"></a>
 <span class="sourceLineNo">204</span>    return this.colFamTimeRangeMap;<a
name="line.204"></a>


Mime
View raw message