http://git-wip-us.apache.org/repos/asf/hbase-site/blob/2cef721c/devapidocs/src-html/org/apache/hadoop/hbase/CellUtil.html ---------------------------------------------------------------------- diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/CellUtil.html b/devapidocs/src-html/org/apache/hadoop/hbase/CellUtil.html index b492d9f..435b2b3 100644 --- a/devapidocs/src-html/org/apache/hadoop/hbase/CellUtil.html +++ b/devapidocs/src-html/org/apache/hadoop/hbase/CellUtil.html @@ -901,599 +901,608 @@ <span class="sourceLineNo">893</span> * {KeyValue.Type#DeleteFamily} or a<a name="line.893"></a> <span class="sourceLineNo">894</span> * {@link KeyValue.Type#DeleteColumn} KeyValue type.<a name="line.894"></a> <span class="sourceLineNo">895</span> */<a name="line.895"></a> -<span class="sourceLineNo">896</span> public static boolean isDelete(final Cell cell) {<a name="line.896"></a> -<span class="sourceLineNo">897</span> return PrivateCellUtil.isDelete(cell.getTypeByte());<a name="line.897"></a> -<span class="sourceLineNo">898</span> }<a name="line.898"></a> -<span class="sourceLineNo">899</span><a name="line.899"></a> -<span class="sourceLineNo">900</span> /**<a name="line.900"></a> -<span class="sourceLineNo">901</span> * @return True if a delete type, a {@link KeyValue.Type#Delete} or a<a name="line.901"></a> -<span class="sourceLineNo">902</span> * {KeyValue.Type#DeleteFamily} or a<a name="line.902"></a> -<span class="sourceLineNo">903</span> * {@link KeyValue.Type#DeleteColumn} KeyValue type.<a name="line.903"></a> -<span class="sourceLineNo">904</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.904"></a> -<span class="sourceLineNo">905</span> */<a name="line.905"></a> -<span class="sourceLineNo">906</span> @Deprecated<a name="line.906"></a> -<span class="sourceLineNo">907</span> public static boolean isDelete(final byte type) {<a name="line.907"></a> -<span class="sourceLineNo">908</span> return Type.Delete.getCode() <= type<a name="line.908"></a> -<span class="sourceLineNo">909</span> && type <= Type.DeleteFamily.getCode();<a name="line.909"></a> -<span class="sourceLineNo">910</span> }<a name="line.910"></a> -<span class="sourceLineNo">911</span><a name="line.911"></a> -<span class="sourceLineNo">912</span> /**<a name="line.912"></a> -<span class="sourceLineNo">913</span> * @return True if this cell is a {@link KeyValue.Type#Delete} type.<a name="line.913"></a> -<span class="sourceLineNo">914</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.914"></a> -<span class="sourceLineNo">915</span> */<a name="line.915"></a> -<span class="sourceLineNo">916</span> @Deprecated<a name="line.916"></a> -<span class="sourceLineNo">917</span> public static boolean isDeleteType(Cell cell) {<a name="line.917"></a> -<span class="sourceLineNo">918</span> return cell.getTypeByte() == Type.Delete.getCode();<a name="line.918"></a> -<span class="sourceLineNo">919</span> }<a name="line.919"></a> -<span class="sourceLineNo">920</span><a name="line.920"></a> -<span class="sourceLineNo">921</span> /**<a name="line.921"></a> -<span class="sourceLineNo">922</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. <a name="line.922"></a> -<span class="sourceLineNo">923</span> */<a name="line.923"></a> -<span class="sourceLineNo">924</span> @Deprecated<a name="line.924"></a> -<span class="sourceLineNo">925</span> public static boolean isDeleteFamily(final Cell cell) {<a name="line.925"></a> -<span class="sourceLineNo">926</span> return cell.getTypeByte() == Type.DeleteFamily.getCode();<a name="line.926"></a> -<span class="sourceLineNo">927</span> }<a name="line.927"></a> -<span class="sourceLineNo">928</span><a name="line.928"></a> -<span class="sourceLineNo">929</span> /**<a name="line.929"></a> -<span class="sourceLineNo">930</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. <a name="line.930"></a> -<span class="sourceLineNo">931</span> */<a name="line.931"></a> -<span class="sourceLineNo">932</span> @Deprecated<a name="line.932"></a> -<span class="sourceLineNo">933</span> public static boolean isDeleteFamilyVersion(final Cell cell) {<a name="line.933"></a> -<span class="sourceLineNo">934</span> return cell.getTypeByte() == Type.DeleteFamilyVersion.getCode();<a name="line.934"></a> -<span class="sourceLineNo">935</span> }<a name="line.935"></a> -<span class="sourceLineNo">936</span><a name="line.936"></a> -<span class="sourceLineNo">937</span> /**<a name="line.937"></a> -<span class="sourceLineNo">938</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. <a name="line.938"></a> -<span class="sourceLineNo">939</span> */<a name="line.939"></a> -<span class="sourceLineNo">940</span> @Deprecated<a name="line.940"></a> -<span class="sourceLineNo">941</span> public static boolean isDeleteColumns(final Cell cell) {<a name="line.941"></a> -<span class="sourceLineNo">942</span> return cell.getTypeByte() == Type.DeleteColumn.getCode();<a name="line.942"></a> -<span class="sourceLineNo">943</span> }<a name="line.943"></a> -<span class="sourceLineNo">944</span><a name="line.944"></a> -<span class="sourceLineNo">945</span> /**<a name="line.945"></a> -<span class="sourceLineNo">946</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. <a name="line.946"></a> -<span class="sourceLineNo">947</span> */<a name="line.947"></a> -<span class="sourceLineNo">948</span> @Deprecated<a name="line.948"></a> -<span class="sourceLineNo">949</span> public static boolean isDeleteColumnVersion(final Cell cell) {<a name="line.949"></a> -<span class="sourceLineNo">950</span> return cell.getTypeByte() == Type.Delete.getCode();<a name="line.950"></a> -<span class="sourceLineNo">951</span> }<a name="line.951"></a> -<span class="sourceLineNo">952</span><a name="line.952"></a> -<span class="sourceLineNo">953</span> /**<a name="line.953"></a> -<span class="sourceLineNo">954</span> *<a name="line.954"></a> -<span class="sourceLineNo">955</span> * @return True if this cell is a delete family or column type.<a name="line.955"></a> -<span class="sourceLineNo">956</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.956"></a> -<span class="sourceLineNo">957</span> */<a name="line.957"></a> -<span class="sourceLineNo">958</span> @Deprecated<a name="line.958"></a> -<span class="sourceLineNo">959</span> public static boolean isDeleteColumnOrFamily(Cell cell) {<a name="line.959"></a> -<span class="sourceLineNo">960</span> int t = cell.getTypeByte();<a name="line.960"></a> -<span class="sourceLineNo">961</span> return t == Type.DeleteColumn.getCode() || t == Type.DeleteFamily.getCode();<a name="line.961"></a> -<span class="sourceLineNo">962</span> }<a name="line.962"></a> -<span class="sourceLineNo">963</span><a name="line.963"></a> -<span class="sourceLineNo">964</span> /**<a name="line.964"></a> -<span class="sourceLineNo">965</span> * Estimate based on keyvalue's serialization format in the RPC layer. Note that there is an extra<a name="line.965"></a> -<span class="sourceLineNo">966</span> * SIZEOF_INT added to the size here that indicates the actual length of the cell for cases where<a name="line.966"></a> -<span class="sourceLineNo">967</span> * cell's are serialized in a contiguous format (For eg in RPCs).<a name="line.967"></a> -<span class="sourceLineNo">968</span> * @param cell<a name="line.968"></a> -<span class="sourceLineNo">969</span> * @return Estimate of the <code>cell</code> size in bytes plus an extra SIZEOF_INT indicating the<a name="line.969"></a> -<span class="sourceLineNo">970</span> * actual cell length.<a name="line.970"></a> -<span class="sourceLineNo">971</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.971"></a> -<span class="sourceLineNo">972</span> */<a name="line.972"></a> -<span class="sourceLineNo">973</span> @Deprecated<a name="line.973"></a> -<span class="sourceLineNo">974</span> public static int estimatedSerializedSizeOf(final Cell cell) {<a name="line.974"></a> -<span class="sourceLineNo">975</span> return PrivateCellUtil.estimatedSerializedSizeOf(cell);<a name="line.975"></a> -<span class="sourceLineNo">976</span> }<a name="line.976"></a> -<span class="sourceLineNo">977</span><a name="line.977"></a> -<span class="sourceLineNo">978</span> /**<a name="line.978"></a> -<span class="sourceLineNo">979</span> * Calculates the serialized key size. We always serialize in the KeyValue's serialization<a name="line.979"></a> -<span class="sourceLineNo">980</span> * format.<a name="line.980"></a> -<span class="sourceLineNo">981</span> * @param cell the cell for which the key size has to be calculated.<a name="line.981"></a> -<span class="sourceLineNo">982</span> * @return the key size<a name="line.982"></a> -<span class="sourceLineNo">983</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.983"></a> -<span class="sourceLineNo">984</span> */<a name="line.984"></a> -<span class="sourceLineNo">985</span> @Deprecated<a name="line.985"></a> -<span class="sourceLineNo">986</span> public static int estimatedSerializedSizeOfKey(final Cell cell) {<a name="line.986"></a> -<span class="sourceLineNo">987</span> return PrivateCellUtil.estimatedSerializedSizeOfKey(cell);<a name="line.987"></a> -<span class="sourceLineNo">988</span> }<a name="line.988"></a> -<span class="sourceLineNo">989</span><a name="line.989"></a> -<span class="sourceLineNo">990</span> /**<a name="line.990"></a> -<span class="sourceLineNo">991</span> * This is an estimate of the heap space occupied by a cell. When the cell is of type<a name="line.991"></a> -<span class="sourceLineNo">992</span> * {@link HeapSize} we call {@link HeapSize#heapSize()} so cell can give a correct value. In other<a name="line.992"></a> -<span class="sourceLineNo">993</span> * cases we just consider the bytes occupied by the cell components ie. row, CF, qualifier,<a name="line.993"></a> -<span class="sourceLineNo">994</span> * timestamp, type, value and tags.<a name="line.994"></a> -<span class="sourceLineNo">995</span> * @param cell<a name="line.995"></a> -<span class="sourceLineNo">996</span> * @return estimate of the heap space<a name="line.996"></a> -<span class="sourceLineNo">997</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.997"></a> -<span class="sourceLineNo">998</span> */<a name="line.998"></a> -<span class="sourceLineNo">999</span> @Deprecated<a name="line.999"></a> -<span class="sourceLineNo">1000</span> public static long estimatedHeapSizeOf(final Cell cell) {<a name="line.1000"></a> -<span class="sourceLineNo">1001</span> return PrivateCellUtil.estimatedHeapSizeOf(cell);<a name="line.1001"></a> -<span class="sourceLineNo">1002</span> }<a name="line.1002"></a> -<span class="sourceLineNo">1003</span><a name="line.1003"></a> -<span class="sourceLineNo">1004</span> /********************* tags *************************************/<a name="line.1004"></a> -<span class="sourceLineNo">1005</span> /**<a name="line.1005"></a> -<span class="sourceLineNo">1006</span> * Util method to iterate through the tags<a name="line.1006"></a> -<span class="sourceLineNo">1007</span> *<a name="line.1007"></a> -<span class="sourceLineNo">1008</span> * @param tags<a name="line.1008"></a> -<span class="sourceLineNo">1009</span> * @param offset<a name="line.1009"></a> -<span class="sourceLineNo">1010</span> * @param length<a name="line.1010"></a> -<span class="sourceLineNo">1011</span> * @return iterator for the tags<a name="line.1011"></a> -<span class="sourceLineNo">1012</span> * @deprecated As of 2.0.0 and will be removed in 3.0.0<a name="line.1012"></a> -<span class="sourceLineNo">1013</span> * Instead use {@link #tagsIterator(Cell)}<a name="line.1013"></a> -<span class="sourceLineNo">1014</span> */<a name="line.1014"></a> -<span class="sourceLineNo">1015</span> @Deprecated<a name="line.1015"></a> -<span class="sourceLineNo">1016</span> public static Iterator<Tag> tagsIterator(final byte[] tags, final int offset, final int length) {<a name="line.1016"></a> -<span class="sourceLineNo">1017</span> return new Iterator<Tag>() {<a name="line.1017"></a> -<span class="sourceLineNo">1018</span> private int pos = offset;<a name="line.1018"></a> -<span class="sourceLineNo">1019</span> private int endOffset = offset + length - 1;<a name="line.1019"></a> -<span class="sourceLineNo">1020</span><a name="line.1020"></a> -<span class="sourceLineNo">1021</span> @Override<a name="line.1021"></a> -<span class="sourceLineNo">1022</span> public boolean hasNext() {<a name="line.1022"></a> -<span class="sourceLineNo">1023</span> return this.pos < endOffset;<a name="line.1023"></a> -<span class="sourceLineNo">1024</span> }<a name="line.1024"></a> -<span class="sourceLineNo">1025</span><a name="line.1025"></a> -<span class="sourceLineNo">1026</span> @Override<a name="line.1026"></a> -<span class="sourceLineNo">1027</span> public Tag next() {<a name="line.1027"></a> -<span class="sourceLineNo">1028</span> if (hasNext()) {<a name="line.1028"></a> -<span class="sourceLineNo">1029</span> int curTagLen = Bytes.readAsInt(tags, this.pos, Tag.TAG_LENGTH_SIZE);<a name="line.1029"></a> -<span class="sourceLineNo">1030</span> Tag tag = new ArrayBackedTag(tags, pos, curTagLen + TAG_LENGTH_SIZE);<a name="line.1030"></a> -<span class="sourceLineNo">1031</span> this.pos += Bytes.SIZEOF_SHORT + curTagLen;<a name="line.1031"></a> -<span class="sourceLineNo">1032</span> return tag;<a name="line.1032"></a> -<span class="sourceLineNo">1033</span> }<a name="line.1033"></a> -<span class="sourceLineNo">1034</span> return null;<a name="line.1034"></a> -<span class="sourceLineNo">1035</span> }<a name="line.1035"></a> -<span class="sourceLineNo">1036</span><a name="line.1036"></a> -<span class="sourceLineNo">1037</span> @Override<a name="line.1037"></a> -<span class="sourceLineNo">1038</span> public void remove() {<a name="line.1038"></a> -<span class="sourceLineNo">1039</span> throw new UnsupportedOperationException();<a name="line.1039"></a> -<span class="sourceLineNo">1040</span> }<a name="line.1040"></a> -<span class="sourceLineNo">1041</span> };<a name="line.1041"></a> -<span class="sourceLineNo">1042</span> }<a name="line.1042"></a> -<span class="sourceLineNo">1043</span><a name="line.1043"></a> -<span class="sourceLineNo">1044</span> /**<a name="line.1044"></a> -<span class="sourceLineNo">1045</span> * @param cell The Cell<a name="line.1045"></a> -<span class="sourceLineNo">1046</span> * @return Tags in the given Cell as a List<a name="line.1046"></a> -<span class="sourceLineNo">1047</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1047"></a> -<span class="sourceLineNo">1048</span> */<a name="line.1048"></a> -<span class="sourceLineNo">1049</span> @Deprecated<a name="line.1049"></a> -<span class="sourceLineNo">1050</span> public static List<Tag> getTags(Cell cell) {<a name="line.1050"></a> -<span class="sourceLineNo">1051</span> return PrivateCellUtil.getTags(cell);<a name="line.1051"></a> -<span class="sourceLineNo">1052</span> }<a name="line.1052"></a> -<span class="sourceLineNo">1053</span><a name="line.1053"></a> -<span class="sourceLineNo">1054</span> /**<a name="line.1054"></a> -<span class="sourceLineNo">1055</span> * Retrieve Cell's first tag, matching the passed in type<a name="line.1055"></a> -<span class="sourceLineNo">1056</span> *<a name="line.1056"></a> -<span class="sourceLineNo">1057</span> * @param cell The Cell<a name="line.1057"></a> -<span class="sourceLineNo">1058</span> * @param type Type of the Tag to retrieve<a name="line.1058"></a> -<span class="sourceLineNo">1059</span> * @return null if there is no tag of the passed in tag type<a name="line.1059"></a> -<span class="sourceLineNo">1060</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1060"></a> -<span class="sourceLineNo">1061</span> */<a name="line.1061"></a> -<span class="sourceLineNo">1062</span> @Deprecated<a name="line.1062"></a> -<span class="sourceLineNo">1063</span> public static Tag getTag(Cell cell, byte type){<a name="line.1063"></a> -<span class="sourceLineNo">1064</span> return PrivateCellUtil.getTag(cell, type);<a name="line.1064"></a> -<span class="sourceLineNo">1065</span> }<a name="line.1065"></a> -<span class="sourceLineNo">1066</span><a name="line.1066"></a> -<span class="sourceLineNo">1067</span> /**<a name="line.1067"></a> -<span class="sourceLineNo">1068</span> * Returns true if the first range start1...end1 overlaps with the second range<a name="line.1068"></a> -<span class="sourceLineNo">1069</span> * start2...end2, assuming the byte arrays represent row keys<a name="line.1069"></a> -<span class="sourceLineNo">1070</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1070"></a> -<span class="sourceLineNo">1071</span> */<a name="line.1071"></a> -<span class="sourceLineNo">1072</span> @Deprecated<a name="line.1072"></a> -<span class="sourceLineNo">1073</span> public static boolean overlappingKeys(final byte[] start1, final byte[] end1,<a name="line.1073"></a> -<span class="sourceLineNo">1074</span> final byte[] start2, final byte[] end2) {<a name="line.1074"></a> -<span class="sourceLineNo">1075</span> return PrivateCellUtil.overlappingKeys(start1, end1, start2, end2);<a name="line.1075"></a> -<span class="sourceLineNo">1076</span> }<a name="line.1076"></a> -<span class="sourceLineNo">1077</span><a name="line.1077"></a> -<span class="sourceLineNo">1078</span> /**<a name="line.1078"></a> -<span class="sourceLineNo">1079</span> * Sets the given seqId to the cell.<a name="line.1079"></a> -<span class="sourceLineNo">1080</span> * Marked as audience Private as of 1.2.0.<a name="line.1080"></a> -<span class="sourceLineNo">1081</span> * Setting a Cell sequenceid is an internal implementation detail not for general public use.<a name="line.1081"></a> -<span class="sourceLineNo">1082</span> * @param cell<a name="line.1082"></a> -<span class="sourceLineNo">1083</span> * @param seqId<a name="line.1083"></a> -<span class="sourceLineNo">1084</span> * @throws IOException when the passed cell is not of type {@link SettableSequenceId}<a name="line.1084"></a> -<span class="sourceLineNo">1085</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1085"></a> -<span class="sourceLineNo">1086</span> */<a name="line.1086"></a> -<span class="sourceLineNo">1087</span> @Deprecated<a name="line.1087"></a> -<span class="sourceLineNo">1088</span> public static void setSequenceId(Cell cell, long seqId) throws IOException {<a name="line.1088"></a> -<span class="sourceLineNo">1089</span> PrivateCellUtil.setSequenceId(cell, seqId);<a name="line.1089"></a> -<span class="sourceLineNo">1090</span> }<a name="line.1090"></a> -<span class="sourceLineNo">1091</span><a name="line.1091"></a> -<span class="sourceLineNo">1092</span> /**<a name="line.1092"></a> -<span class="sourceLineNo">1093</span> * Sets the given timestamp to the cell.<a name="line.1093"></a> -<span class="sourceLineNo">1094</span> * @param cell<a name="line.1094"></a> -<span class="sourceLineNo">1095</span> * @param ts<a name="line.1095"></a> -<span class="sourceLineNo">1096</span> * @throws IOException when the passed cell is not of type {@link SettableTimestamp}<a name="line.1096"></a> -<span class="sourceLineNo">1097</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1097"></a> -<span class="sourceLineNo">1098</span> */<a name="line.1098"></a> -<span class="sourceLineNo">1099</span> @Deprecated<a name="line.1099"></a> -<span class="sourceLineNo">1100</span> public static void setTimestamp(Cell cell, long ts) throws IOException {<a name="line.1100"></a> -<span class="sourceLineNo">1101</span> PrivateCellUtil.setTimestamp(cell, ts);<a name="line.1101"></a> -<span class="sourceLineNo">1102</span> }<a name="line.1102"></a> -<span class="sourceLineNo">1103</span><a name="line.1103"></a> -<span class="sourceLineNo">1104</span> /**<a name="line.1104"></a> -<span class="sourceLineNo">1105</span> * Sets the given timestamp to the cell.<a name="line.1105"></a> -<span class="sourceLineNo">1106</span> * @param cell<a name="line.1106"></a> -<span class="sourceLineNo">1107</span> * @param ts buffer containing the timestamp value<a name="line.1107"></a> -<span class="sourceLineNo">1108</span> * @param tsOffset offset to the new timestamp<a name="line.1108"></a> -<span class="sourceLineNo">1109</span> * @throws IOException when the passed cell is not of type {@link SettableTimestamp}<a name="line.1109"></a> -<span class="sourceLineNo">1110</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1110"></a> -<span class="sourceLineNo">1111</span> */<a name="line.1111"></a> -<span class="sourceLineNo">1112</span> @Deprecated<a name="line.1112"></a> -<span class="sourceLineNo">1113</span> public static void setTimestamp(Cell cell, byte[] ts, int tsOffset) throws IOException {<a name="line.1113"></a> -<span class="sourceLineNo">1114</span> PrivateCellUtil.setTimestamp(cell, ts, tsOffset);<a name="line.1114"></a> -<span class="sourceLineNo">1115</span> }<a name="line.1115"></a> -<span class="sourceLineNo">1116</span><a name="line.1116"></a> -<span class="sourceLineNo">1117</span> /**<a name="line.1117"></a> -<span class="sourceLineNo">1118</span> * Sets the given timestamp to the cell iff current timestamp is<a name="line.1118"></a> -<span class="sourceLineNo">1119</span> * {@link HConstants#LATEST_TIMESTAMP}.<a name="line.1119"></a> -<span class="sourceLineNo">1120</span> * @param cell<a name="line.1120"></a> -<span class="sourceLineNo">1121</span> * @param ts<a name="line.1121"></a> -<span class="sourceLineNo">1122</span> * @return True if cell timestamp is modified.<a name="line.1122"></a> -<span class="sourceLineNo">1123</span> * @throws IOException when the passed cell is not of type {@link SettableTimestamp}<a name="line.1123"></a> -<span class="sourceLineNo">1124</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1124"></a> -<span class="sourceLineNo">1125</span> */<a name="line.1125"></a> -<span class="sourceLineNo">1126</span> @Deprecated<a name="line.1126"></a> -<span class="sourceLineNo">1127</span> public static boolean updateLatestStamp(Cell cell, long ts) throws IOException {<a name="line.1127"></a> -<span class="sourceLineNo">1128</span> return PrivateCellUtil.updateLatestStamp(cell, ts);<a name="line.1128"></a> -<span class="sourceLineNo">1129</span> }<a name="line.1129"></a> -<span class="sourceLineNo">1130</span><a name="line.1130"></a> -<span class="sourceLineNo">1131</span> /**<a name="line.1131"></a> -<span class="sourceLineNo">1132</span> * Sets the given timestamp to the cell iff current timestamp is<a name="line.1132"></a> -<span class="sourceLineNo">1133</span> * {@link HConstants#LATEST_TIMESTAMP}.<a name="line.1133"></a> -<span class="sourceLineNo">1134</span> * @param cell<a name="line.1134"></a> -<span class="sourceLineNo">1135</span> * @param ts buffer containing the timestamp value<a name="line.1135"></a> -<span class="sourceLineNo">1136</span> * @param tsOffset offset to the new timestamp<a name="line.1136"></a> -<span class="sourceLineNo">1137</span> * @return True if cell timestamp is modified.<a name="line.1137"></a> -<span class="sourceLineNo">1138</span> * @throws IOException when the passed cell is not of type {@link SettableTimestamp}<a name="line.1138"></a> -<span class="sourceLineNo">1139</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1139"></a> -<span class="sourceLineNo">1140</span> */<a name="line.1140"></a> -<span class="sourceLineNo">1141</span> @Deprecated<a name="line.1141"></a> -<span class="sourceLineNo">1142</span> public static boolean updateLatestStamp(Cell cell, byte[] ts, int tsOffset) throws IOException {<a name="line.1142"></a> -<span class="sourceLineNo">1143</span> return PrivateCellUtil.updateLatestStamp(cell, ts, tsOffset);<a name="line.1143"></a> -<span class="sourceLineNo">1144</span> }<a name="line.1144"></a> -<span class="sourceLineNo">1145</span><a name="line.1145"></a> -<span class="sourceLineNo">1146</span><a name="line.1146"></a> -<span class="sourceLineNo">1147</span> /**<a name="line.1147"></a> +<span class="sourceLineNo">896</span> @SuppressWarnings("deprecation")<a name="line.896"></a> +<span class="sourceLineNo">897</span> public static boolean isDelete(final Cell cell) {<a name="line.897"></a> +<span class="sourceLineNo">898</span> return PrivateCellUtil.isDelete(cell.getTypeByte());<a name="line.898"></a> +<span class="sourceLineNo">899</span> }<a name="line.899"></a> +<span class="sourceLineNo">900</span><a name="line.900"></a> +<span class="sourceLineNo">901</span> /**<a name="line.901"></a> +<span class="sourceLineNo">902</span> * @return True if a delete type, a {@link KeyValue.Type#Delete} or a<a name="line.902"></a> +<span class="sourceLineNo">903</span> * {KeyValue.Type#DeleteFamily} or a<a name="line.903"></a> +<span class="sourceLineNo">904</span> * {@link KeyValue.Type#DeleteColumn} KeyValue type.<a name="line.904"></a> +<span class="sourceLineNo">905</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.905"></a> +<span class="sourceLineNo">906</span> */<a name="line.906"></a> +<span class="sourceLineNo">907</span> @Deprecated<a name="line.907"></a> +<span class="sourceLineNo">908</span> public static boolean isDelete(final byte type) {<a name="line.908"></a> +<span class="sourceLineNo">909</span> return Type.Delete.getCode() <= type<a name="line.909"></a> +<span class="sourceLineNo">910</span> && type <= Type.DeleteFamily.getCode();<a name="line.910"></a> +<span class="sourceLineNo">911</span> }<a name="line.911"></a> +<span class="sourceLineNo">912</span><a name="line.912"></a> +<span class="sourceLineNo">913</span> /**<a name="line.913"></a> +<span class="sourceLineNo">914</span> * @return True if this cell is a {@link KeyValue.Type#Delete} type.<a name="line.914"></a> +<span class="sourceLineNo">915</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.915"></a> +<span class="sourceLineNo">916</span> */<a name="line.916"></a> +<span class="sourceLineNo">917</span> @Deprecated<a name="line.917"></a> +<span class="sourceLineNo">918</span> public static boolean isDeleteType(Cell cell) {<a name="line.918"></a> +<span class="sourceLineNo">919</span> return cell.getTypeByte() == Type.Delete.getCode();<a name="line.919"></a> +<span class="sourceLineNo">920</span> }<a name="line.920"></a> +<span class="sourceLineNo">921</span><a name="line.921"></a> +<span class="sourceLineNo">922</span> /**<a name="line.922"></a> +<span class="sourceLineNo">923</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. <a name="line.923"></a> +<span class="sourceLineNo">924</span> */<a name="line.924"></a> +<span class="sourceLineNo">925</span> @Deprecated<a name="line.925"></a> +<span class="sourceLineNo">926</span> public static boolean isDeleteFamily(final Cell cell) {<a name="line.926"></a> +<span class="sourceLineNo">927</span> return cell.getTypeByte() == Type.DeleteFamily.getCode();<a name="line.927"></a> +<span class="sourceLineNo">928</span> }<a name="line.928"></a> +<span class="sourceLineNo">929</span><a name="line.929"></a> +<span class="sourceLineNo">930</span> /**<a name="line.930"></a> +<span class="sourceLineNo">931</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. <a name="line.931"></a> +<span class="sourceLineNo">932</span> */<a name="line.932"></a> +<span class="sourceLineNo">933</span> @Deprecated<a name="line.933"></a> +<span class="sourceLineNo">934</span> public static boolean isDeleteFamilyVersion(final Cell cell) {<a name="line.934"></a> +<span class="sourceLineNo">935</span> return cell.getTypeByte() == Type.DeleteFamilyVersion.getCode();<a name="line.935"></a> +<span class="sourceLineNo">936</span> }<a name="line.936"></a> +<span class="sourceLineNo">937</span><a name="line.937"></a> +<span class="sourceLineNo">938</span> /**<a name="line.938"></a> +<span class="sourceLineNo">939</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. <a name="line.939"></a> +<span class="sourceLineNo">940</span> */<a name="line.940"></a> +<span class="sourceLineNo">941</span> @Deprecated<a name="line.941"></a> +<span class="sourceLineNo">942</span> public static boolean isDeleteColumns(final Cell cell) {<a name="line.942"></a> +<span class="sourceLineNo">943</span> return cell.getTypeByte() == Type.DeleteColumn.getCode();<a name="line.943"></a> +<span class="sourceLineNo">944</span> }<a name="line.944"></a> +<span class="sourceLineNo">945</span><a name="line.945"></a> +<span class="sourceLineNo">946</span> /**<a name="line.946"></a> +<span class="sourceLineNo">947</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. <a name="line.947"></a> +<span class="sourceLineNo">948</span> */<a name="line.948"></a> +<span class="sourceLineNo">949</span> @Deprecated<a name="line.949"></a> +<span class="sourceLineNo">950</span> public static boolean isDeleteColumnVersion(final Cell cell) {<a name="line.950"></a> +<span class="sourceLineNo">951</span> return cell.getTypeByte() == Type.Delete.getCode();<a name="line.951"></a> +<span class="sourceLineNo">952</span> }<a name="line.952"></a> +<span class="sourceLineNo">953</span><a name="line.953"></a> +<span class="sourceLineNo">954</span> /**<a name="line.954"></a> +<span class="sourceLineNo">955</span> *<a name="line.955"></a> +<span class="sourceLineNo">956</span> * @return True if this cell is a delete family or column type.<a name="line.956"></a> +<span class="sourceLineNo">957</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.957"></a> +<span class="sourceLineNo">958</span> */<a name="line.958"></a> +<span class="sourceLineNo">959</span> @Deprecated<a name="line.959"></a> +<span class="sourceLineNo">960</span> public static boolean isDeleteColumnOrFamily(Cell cell) {<a name="line.960"></a> +<span class="sourceLineNo">961</span> int t = cell.getTypeByte();<a name="line.961"></a> +<span class="sourceLineNo">962</span> return t == Type.DeleteColumn.getCode() || t == Type.DeleteFamily.getCode();<a name="line.962"></a> +<span class="sourceLineNo">963</span> }<a name="line.963"></a> +<span class="sourceLineNo">964</span><a name="line.964"></a> +<span class="sourceLineNo">965</span> /**<a name="line.965"></a> +<span class="sourceLineNo">966</span> * @return True if this cell is a Put.<a name="line.966"></a> +<span class="sourceLineNo">967</span> */<a name="line.967"></a> +<span class="sourceLineNo">968</span> @SuppressWarnings("deprecation")<a name="line.968"></a> +<span class="sourceLineNo">969</span> public static boolean isPut(Cell cell) {<a name="line.969"></a> +<span class="sourceLineNo">970</span> return cell.getTypeByte() == Type.Put.getCode();<a name="line.970"></a> +<span class="sourceLineNo">971</span> }<a name="line.971"></a> +<span class="sourceLineNo">972</span><a name="line.972"></a> +<span class="sourceLineNo">973</span> /**<a name="line.973"></a> +<span class="sourceLineNo">974</span> * Estimate based on keyvalue's serialization format in the RPC layer. Note that there is an extra<a name="line.974"></a> +<span class="sourceLineNo">975</span> * SIZEOF_INT added to the size here that indicates the actual length of the cell for cases where<a name="line.975"></a> +<span class="sourceLineNo">976</span> * cell's are serialized in a contiguous format (For eg in RPCs).<a name="line.976"></a> +<span class="sourceLineNo">977</span> * @param cell<a name="line.977"></a> +<span class="sourceLineNo">978</span> * @return Estimate of the <code>cell</code> size in bytes plus an extra SIZEOF_INT indicating the<a name="line.978"></a> +<span class="sourceLineNo">979</span> * actual cell length.<a name="line.979"></a> +<span class="sourceLineNo">980</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.980"></a> +<span class="sourceLineNo">981</span> */<a name="line.981"></a> +<span class="sourceLineNo">982</span> @Deprecated<a name="line.982"></a> +<span class="sourceLineNo">983</span> public static int estimatedSerializedSizeOf(final Cell cell) {<a name="line.983"></a> +<span class="sourceLineNo">984</span> return PrivateCellUtil.estimatedSerializedSizeOf(cell);<a name="line.984"></a> +<span class="sourceLineNo">985</span> }<a name="line.985"></a> +<span class="sourceLineNo">986</span><a name="line.986"></a> +<span class="sourceLineNo">987</span> /**<a name="line.987"></a> +<span class="sourceLineNo">988</span> * Calculates the serialized key size. We always serialize in the KeyValue's serialization<a name="line.988"></a> +<span class="sourceLineNo">989</span> * format.<a name="line.989"></a> +<span class="sourceLineNo">990</span> * @param cell the cell for which the key size has to be calculated.<a name="line.990"></a> +<span class="sourceLineNo">991</span> * @return the key size<a name="line.991"></a> +<span class="sourceLineNo">992</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.992"></a> +<span class="sourceLineNo">993</span> */<a name="line.993"></a> +<span class="sourceLineNo">994</span> @Deprecated<a name="line.994"></a> +<span class="sourceLineNo">995</span> public static int estimatedSerializedSizeOfKey(final Cell cell) {<a name="line.995"></a> +<span class="sourceLineNo">996</span> return PrivateCellUtil.estimatedSerializedSizeOfKey(cell);<a name="line.996"></a> +<span class="sourceLineNo">997</span> }<a name="line.997"></a> +<span class="sourceLineNo">998</span><a name="line.998"></a> +<span class="sourceLineNo">999</span> /**<a name="line.999"></a> +<span class="sourceLineNo">1000</span> * This is an estimate of the heap space occupied by a cell. When the cell is of type<a name="line.1000"></a> +<span class="sourceLineNo">1001</span> * {@link HeapSize} we call {@link HeapSize#heapSize()} so cell can give a correct value. In other<a name="line.1001"></a> +<span class="sourceLineNo">1002</span> * cases we just consider the bytes occupied by the cell components ie. row, CF, qualifier,<a name="line.1002"></a> +<span class="sourceLineNo">1003</span> * timestamp, type, value and tags.<a name="line.1003"></a> +<span class="sourceLineNo">1004</span> * @param cell<a name="line.1004"></a> +<span class="sourceLineNo">1005</span> * @return estimate of the heap space<a name="line.1005"></a> +<span class="sourceLineNo">1006</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1006"></a> +<span class="sourceLineNo">1007</span> */<a name="line.1007"></a> +<span class="sourceLineNo">1008</span> @Deprecated<a name="line.1008"></a> +<span class="sourceLineNo">1009</span> public static long estimatedHeapSizeOf(final Cell cell) {<a name="line.1009"></a> +<span class="sourceLineNo">1010</span> return PrivateCellUtil.estimatedHeapSizeOf(cell);<a name="line.1010"></a> +<span class="sourceLineNo">1011</span> }<a name="line.1011"></a> +<span class="sourceLineNo">1012</span><a name="line.1012"></a> +<span class="sourceLineNo">1013</span> /********************* tags *************************************/<a name="line.1013"></a> +<span class="sourceLineNo">1014</span> /**<a name="line.1014"></a> +<span class="sourceLineNo">1015</span> * Util method to iterate through the tags<a name="line.1015"></a> +<span class="sourceLineNo">1016</span> *<a name="line.1016"></a> +<span class="sourceLineNo">1017</span> * @param tags<a name="line.1017"></a> +<span class="sourceLineNo">1018</span> * @param offset<a name="line.1018"></a> +<span class="sourceLineNo">1019</span> * @param length<a name="line.1019"></a> +<span class="sourceLineNo">1020</span> * @return iterator for the tags<a name="line.1020"></a> +<span class="sourceLineNo">1021</span> * @deprecated As of 2.0.0 and will be removed in 3.0.0<a name="line.1021"></a> +<span class="sourceLineNo">1022</span> * Instead use {@link #tagsIterator(Cell)}<a name="line.1022"></a> +<span class="sourceLineNo">1023</span> */<a name="line.1023"></a> +<span class="sourceLineNo">1024</span> @Deprecated<a name="line.1024"></a> +<span class="sourceLineNo">1025</span> public static Iterator<Tag> tagsIterator(final byte[] tags, final int offset, final int length) {<a name="line.1025"></a> +<span class="sourceLineNo">1026</span> return new Iterator<Tag>() {<a name="line.1026"></a> +<span class="sourceLineNo">1027</span> private int pos = offset;<a name="line.1027"></a> +<span class="sourceLineNo">1028</span> private int endOffset = offset + length - 1;<a name="line.1028"></a> +<span class="sourceLineNo">1029</span><a name="line.1029"></a> +<span class="sourceLineNo">1030</span> @Override<a name="line.1030"></a> +<span class="sourceLineNo">1031</span> public boolean hasNext() {<a name="line.1031"></a> +<span class="sourceLineNo">1032</span> return this.pos < endOffset;<a name="line.1032"></a> +<span class="sourceLineNo">1033</span> }<a name="line.1033"></a> +<span class="sourceLineNo">1034</span><a name="line.1034"></a> +<span class="sourceLineNo">1035</span> @Override<a name="line.1035"></a> +<span class="sourceLineNo">1036</span> public Tag next() {<a name="line.1036"></a> +<span class="sourceLineNo">1037</span> if (hasNext()) {<a name="line.1037"></a> +<span class="sourceLineNo">1038</span> int curTagLen = Bytes.readAsInt(tags, this.pos, Tag.TAG_LENGTH_SIZE);<a name="line.1038"></a> +<span class="sourceLineNo">1039</span> Tag tag = new ArrayBackedTag(tags, pos, curTagLen + TAG_LENGTH_SIZE);<a name="line.1039"></a> +<span class="sourceLineNo">1040</span> this.pos += Bytes.SIZEOF_SHORT + curTagLen;<a name="line.1040"></a> +<span class="sourceLineNo">1041</span> return tag;<a name="line.1041"></a> +<span class="sourceLineNo">1042</span> }<a name="line.1042"></a> +<span class="sourceLineNo">1043</span> return null;<a name="line.1043"></a> +<span class="sourceLineNo">1044</span> }<a name="line.1044"></a> +<span class="sourceLineNo">1045</span><a name="line.1045"></a> +<span class="sourceLineNo">1046</span> @Override<a name="line.1046"></a> +<span class="sourceLineNo">1047</span> public void remove() {<a name="line.1047"></a> +<span class="sourceLineNo">1048</span> throw new UnsupportedOperationException();<a name="line.1048"></a> +<span class="sourceLineNo">1049</span> }<a name="line.1049"></a> +<span class="sourceLineNo">1050</span> };<a name="line.1050"></a> +<span class="sourceLineNo">1051</span> }<a name="line.1051"></a> +<span class="sourceLineNo">1052</span><a name="line.1052"></a> +<span class="sourceLineNo">1053</span> /**<a name="line.1053"></a> +<span class="sourceLineNo">1054</span> * @param cell The Cell<a name="line.1054"></a> +<span class="sourceLineNo">1055</span> * @return Tags in the given Cell as a List<a name="line.1055"></a> +<span class="sourceLineNo">1056</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1056"></a> +<span class="sourceLineNo">1057</span> */<a name="line.1057"></a> +<span class="sourceLineNo">1058</span> @Deprecated<a name="line.1058"></a> +<span class="sourceLineNo">1059</span> public static List<Tag> getTags(Cell cell) {<a name="line.1059"></a> +<span class="sourceLineNo">1060</span> return PrivateCellUtil.getTags(cell);<a name="line.1060"></a> +<span class="sourceLineNo">1061</span> }<a name="line.1061"></a> +<span class="sourceLineNo">1062</span><a name="line.1062"></a> +<span class="sourceLineNo">1063</span> /**<a name="line.1063"></a> +<span class="sourceLineNo">1064</span> * Retrieve Cell's first tag, matching the passed in type<a name="line.1064"></a> +<span class="sourceLineNo">1065</span> *<a name="line.1065"></a> +<span class="sourceLineNo">1066</span> * @param cell The Cell<a name="line.1066"></a> +<span class="sourceLineNo">1067</span> * @param type Type of the Tag to retrieve<a name="line.1067"></a> +<span class="sourceLineNo">1068</span> * @return null if there is no tag of the passed in tag type<a name="line.1068"></a> +<span class="sourceLineNo">1069</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1069"></a> +<span class="sourceLineNo">1070</span> */<a name="line.1070"></a> +<span class="sourceLineNo">1071</span> @Deprecated<a name="line.1071"></a> +<span class="sourceLineNo">1072</span> public static Tag getTag(Cell cell, byte type){<a name="line.1072"></a> +<span class="sourceLineNo">1073</span> return PrivateCellUtil.getTag(cell, type);<a name="line.1073"></a> +<span class="sourceLineNo">1074</span> }<a name="line.1074"></a> +<span class="sourceLineNo">1075</span><a name="line.1075"></a> +<span class="sourceLineNo">1076</span> /**<a name="line.1076"></a> +<span class="sourceLineNo">1077</span> * Returns true if the first range start1...end1 overlaps with the second range<a name="line.1077"></a> +<span class="sourceLineNo">1078</span> * start2...end2, assuming the byte arrays represent row keys<a name="line.1078"></a> +<span class="sourceLineNo">1079</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1079"></a> +<span class="sourceLineNo">1080</span> */<a name="line.1080"></a> +<span class="sourceLineNo">1081</span> @Deprecated<a name="line.1081"></a> +<span class="sourceLineNo">1082</span> public static boolean overlappingKeys(final byte[] start1, final byte[] end1,<a name="line.1082"></a> +<span class="sourceLineNo">1083</span> final byte[] start2, final byte[] end2) {<a name="line.1083"></a> +<span class="sourceLineNo">1084</span> return PrivateCellUtil.overlappingKeys(start1, end1, start2, end2);<a name="line.1084"></a> +<span class="sourceLineNo">1085</span> }<a name="line.1085"></a> +<span class="sourceLineNo">1086</span><a name="line.1086"></a> +<span class="sourceLineNo">1087</span> /**<a name="line.1087"></a> +<span class="sourceLineNo">1088</span> * Sets the given seqId to the cell.<a name="line.1088"></a> +<span class="sourceLineNo">1089</span> * Marked as audience Private as of 1.2.0.<a name="line.1089"></a> +<span class="sourceLineNo">1090</span> * Setting a Cell sequenceid is an internal implementation detail not for general public use.<a name="line.1090"></a> +<span class="sourceLineNo">1091</span> * @param cell<a name="line.1091"></a> +<span class="sourceLineNo">1092</span> * @param seqId<a name="line.1092"></a> +<span class="sourceLineNo">1093</span> * @throws IOException when the passed cell is not of type {@link SettableSequenceId}<a name="line.1093"></a> +<span class="sourceLineNo">1094</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1094"></a> +<span class="sourceLineNo">1095</span> */<a name="line.1095"></a> +<span class="sourceLineNo">1096</span> @Deprecated<a name="line.1096"></a> +<span class="sourceLineNo">1097</span> public static void setSequenceId(Cell cell, long seqId) throws IOException {<a name="line.1097"></a> +<span class="sourceLineNo">1098</span> PrivateCellUtil.setSequenceId(cell, seqId);<a name="line.1098"></a> +<span class="sourceLineNo">1099</span> }<a name="line.1099"></a> +<span class="sourceLineNo">1100</span><a name="line.1100"></a> +<span class="sourceLineNo">1101</span> /**<a name="line.1101"></a> +<span class="sourceLineNo">1102</span> * Sets the given timestamp to the cell.<a name="line.1102"></a> +<span class="sourceLineNo">1103</span> * @param cell<a name="line.1103"></a> +<span class="sourceLineNo">1104</span> * @param ts<a name="line.1104"></a> +<span class="sourceLineNo">1105</span> * @throws IOException when the passed cell is not of type {@link SettableTimestamp}<a name="line.1105"></a> +<span class="sourceLineNo">1106</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1106"></a> +<span class="sourceLineNo">1107</span> */<a name="line.1107"></a> +<span class="sourceLineNo">1108</span> @Deprecated<a name="line.1108"></a> +<span class="sourceLineNo">1109</span> public static void setTimestamp(Cell cell, long ts) throws IOException {<a name="line.1109"></a> +<span class="sourceLineNo">1110</span> PrivateCellUtil.setTimestamp(cell, ts);<a name="line.1110"></a> +<span class="sourceLineNo">1111</span> }<a name="line.1111"></a> +<span class="sourceLineNo">1112</span><a name="line.1112"></a> +<span class="sourceLineNo">1113</span> /**<a name="line.1113"></a> +<span class="sourceLineNo">1114</span> * Sets the given timestamp to the cell.<a name="line.1114"></a> +<span class="sourceLineNo">1115</span> * @param cell<a name="line.1115"></a> +<span class="sourceLineNo">1116</span> * @param ts buffer containing the timestamp value<a name="line.1116"></a> +<span class="sourceLineNo">1117</span> * @param tsOffset offset to the new timestamp<a name="line.1117"></a> +<span class="sourceLineNo">1118</span> * @throws IOException when the passed cell is not of type {@link SettableTimestamp}<a name="line.1118"></a> +<span class="sourceLineNo">1119</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1119"></a> +<span class="sourceLineNo">1120</span> */<a name="line.1120"></a> +<span class="sourceLineNo">1121</span> @Deprecated<a name="line.1121"></a> +<span class="sourceLineNo">1122</span> public static void setTimestamp(Cell cell, byte[] ts, int tsOffset) throws IOException {<a name="line.1122"></a> +<span class="sourceLineNo">1123</span> PrivateCellUtil.setTimestamp(cell, ts, tsOffset);<a name="line.1123"></a> +<span class="sourceLineNo">1124</span> }<a name="line.1124"></a> +<span class="sourceLineNo">1125</span><a name="line.1125"></a> +<span class="sourceLineNo">1126</span> /**<a name="line.1126"></a> +<span class="sourceLineNo">1127</span> * Sets the given timestamp to the cell iff current timestamp is<a name="line.1127"></a> +<span class="sourceLineNo">1128</span> * {@link HConstants#LATEST_TIMESTAMP}.<a name="line.1128"></a> +<span class="sourceLineNo">1129</span> * @param cell<a name="line.1129"></a> +<span class="sourceLineNo">1130</span> * @param ts<a name="line.1130"></a> +<span class="sourceLineNo">1131</span> * @return True if cell timestamp is modified.<a name="line.1131"></a> +<span class="sourceLineNo">1132</span> * @throws IOException when the passed cell is not of type {@link SettableTimestamp}<a name="line.1132"></a> +<span class="sourceLineNo">1133</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1133"></a> +<span class="sourceLineNo">1134</span> */<a name="line.1134"></a> +<span class="sourceLineNo">1135</span> @Deprecated<a name="line.1135"></a> +<span class="sourceLineNo">1136</span> public static boolean updateLatestStamp(Cell cell, long ts) throws IOException {<a name="line.1136"></a> +<span class="sourceLineNo">1137</span> return PrivateCellUtil.updateLatestStamp(cell, ts);<a name="line.1137"></a> +<span class="sourceLineNo">1138</span> }<a name="line.1138"></a> +<span class="sourceLineNo">1139</span><a name="line.1139"></a> +<span class="sourceLineNo">1140</span> /**<a name="line.1140"></a> +<span class="sourceLineNo">1141</span> * Sets the given timestamp to the cell iff current timestamp is<a name="line.1141"></a> +<span class="sourceLineNo">1142</span> * {@link HConstants#LATEST_TIMESTAMP}.<a name="line.1142"></a> +<span class="sourceLineNo">1143</span> * @param cell<a name="line.1143"></a> +<span class="sourceLineNo">1144</span> * @param ts buffer containing the timestamp value<a name="line.1144"></a> +<span class="sourceLineNo">1145</span> * @param tsOffset offset to the new timestamp<a name="line.1145"></a> +<span class="sourceLineNo">1146</span> * @return True if cell timestamp is modified.<a name="line.1146"></a> +<span class="sourceLineNo">1147</span> * @throws IOException when the passed cell is not of type {@link SettableTimestamp}<a name="line.1147"></a> <span class="sourceLineNo">1148</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1148"></a> <span class="sourceLineNo">1149</span> */<a name="line.1149"></a> <span class="sourceLineNo">1150</span> @Deprecated<a name="line.1150"></a> -<span class="sourceLineNo">1151</span> public static int writeFlatKey(Cell cell, OutputStream out) throws IOException {<a name="line.1151"></a> -<span class="sourceLineNo">1152</span> return PrivateCellUtil.writeFlatKey(cell, out);<a name="line.1152"></a> +<span class="sourceLineNo">1151</span> public static boolean updateLatestStamp(Cell cell, byte[] ts, int tsOffset) throws IOException {<a name="line.1151"></a> +<span class="sourceLineNo">1152</span> return PrivateCellUtil.updateLatestStamp(cell, ts, tsOffset);<a name="line.1152"></a> <span class="sourceLineNo">1153</span> }<a name="line.1153"></a> <span class="sourceLineNo">1154</span><a name="line.1154"></a> -<span class="sourceLineNo">1155</span> /**<a name="line.1155"></a> -<span class="sourceLineNo">1156</span> * Writes the row from the given cell to the output stream excluding the common prefix<a name="line.1156"></a> -<span class="sourceLineNo">1157</span> * @param out The dataoutputstream to which the data has to be written<a name="line.1157"></a> -<span class="sourceLineNo">1158</span> * @param cell The cell whose contents has to be written<a name="line.1158"></a> -<span class="sourceLineNo">1159</span> * @param rlength the row length<a name="line.1159"></a> -<span class="sourceLineNo">1160</span> * @throws IOException<a name="line.1160"></a> -<span class="sourceLineNo">1161</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1161"></a> -<span class="sourceLineNo">1162</span> */<a name="line.1162"></a> -<span class="sourceLineNo">1163</span> @Deprecated<a name="line.1163"></a> -<span class="sourceLineNo">1164</span> public static void writeRowSkippingBytes(DataOutputStream out, Cell cell, short rlength,<a name="line.1164"></a> -<span class="sourceLineNo">1165</span> int commonPrefix) throws IOException {<a name="line.1165"></a> -<span class="sourceLineNo">1166</span> PrivateCellUtil.writeRowSkippingBytes(out, cell, rlength, commonPrefix);<a name="line.1166"></a> -<span class="sourceLineNo">1167</span> }<a name="line.1167"></a> -<span class="sourceLineNo">1168</span><a name="line.1168"></a> -<span class="sourceLineNo">1169</span> /**<a name="line.1169"></a> -<span class="sourceLineNo">1170</span> * Writes the qualifier from the given cell to the output stream excluding the common prefix<a name="line.1170"></a> -<span class="sourceLineNo">1171</span> * @param out The dataoutputstream to which the data has to be written<a name="line.1171"></a> -<span class="sourceLineNo">1172</span> * @param cell The cell whose contents has to be written<a name="line.1172"></a> -<span class="sourceLineNo">1173</span> * @param qlength the qualifier length<a name="line.1173"></a> -<span class="sourceLineNo">1174</span> * @throws IOException<a name="line.1174"></a> -<span class="sourceLineNo">1175</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1175"></a> -<span class="sourceLineNo">1176</span> */<a name="line.1176"></a> -<span class="sourceLineNo">1177</span> @Deprecated<a name="line.1177"></a> -<span class="sourceLineNo">1178</span> public static void writeQualifierSkippingBytes(DataOutputStream out, Cell cell,<a name="line.1178"></a> -<span class="sourceLineNo">1179</span> int qlength, int commonPrefix) throws IOException {<a name="line.1179"></a> -<span class="sourceLineNo">1180</span> if (cell instanceof ByteBufferCell) {<a name="line.1180"></a> -<span class="sourceLineNo">1181</span> ByteBufferUtils.copyBufferToStream((DataOutput)out, ((ByteBufferCell) cell).getQualifierByteBuffer(),<a name="line.1181"></a> -<span class="sourceLineNo">1182</span> ((ByteBufferCell) cell).getQualifierPosition() + commonPrefix, qlength - commonPrefix);<a name="line.1182"></a> -<span class="sourceLineNo">1183</span> } else {<a name="line.1183"></a> -<span class="sourceLineNo">1184</span> out.write(cell.getQualifierArray(), cell.getQualifierOffset() + commonPrefix,<a name="line.1184"></a> -<span class="sourceLineNo">1185</span> qlength - commonPrefix);<a name="line.1185"></a> -<span class="sourceLineNo">1186</span> }<a name="line.1186"></a> -<span class="sourceLineNo">1187</span> }<a name="line.1187"></a> -<span class="sourceLineNo">1188</span><a name="line.1188"></a> -<span class="sourceLineNo">1189</span> /**<a name="line.1189"></a> -<span class="sourceLineNo">1190</span> * @param cell<a name="line.1190"></a> -<span class="sourceLineNo">1191</span> * @return The Key portion of the passed <code>cell</code> as a String.<a name="line.1191"></a> -<span class="sourceLineNo">1192</span> */<a name="line.1192"></a> -<span class="sourceLineNo">1193</span> public static String getCellKeyAsString(Cell cell) {<a name="line.1193"></a> -<span class="sourceLineNo">1194</span> StringBuilder sb = new StringBuilder(Bytes.toStringBinary(<a name="line.1194"></a> -<span class="sourceLineNo">1195</span> cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()));<a name="line.1195"></a> -<span class="sourceLineNo">1196</span> sb.append('/');<a name="line.1196"></a> -<span class="sourceLineNo">1197</span> sb.append(cell.getFamilyLength() == 0? "":<a name="line.1197"></a> -<span class="sourceLineNo">1198</span> Bytes.toStringBinary(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength()));<a name="line.1198"></a> -<span class="sourceLineNo">1199</span> // KeyValue only added ':' if family is non-null. Do same.<a name="line.1199"></a> -<span class="sourceLineNo">1200</span> if (cell.getFamilyLength() > 0) sb.append(':');<a name="line.1200"></a> -<span class="sourceLineNo">1201</span> sb.append(cell.getQualifierLength() == 0? "":<a name="line.1201"></a> -<span class="sourceLineNo">1202</span> Bytes.toStringBinary(cell.getQualifierArray(), cell.getQualifierOffset(),<a name="line.1202"></a> -<span class="sourceLineNo">1203</span> cell.getQualifierLength()));<a name="line.1203"></a> -<span class="sourceLineNo">1204</span> sb.append('/');<a name="line.1204"></a> -<span class="sourceLineNo">1205</span> sb.append(KeyValue.humanReadableTimestamp(cell.getTimestamp()));<a name="line.1205"></a> -<span class="sourceLineNo">1206</span> sb.append('/');<a name="line.1206"></a> -<span class="sourceLineNo">1207</span> sb.append(Type.codeToType(cell.getTypeByte()));<a name="line.1207"></a> -<span class="sourceLineNo">1208</span> if (!(cell instanceof KeyValue.KeyOnlyKeyValue)) {<a name="line.1208"></a> -<span class="sourceLineNo">1209</span> sb.append("/vlen=");<a name="line.1209"></a> -<span class="sourceLineNo">1210</span> sb.append(cell.getValueLength());<a name="line.1210"></a> -<span class="sourceLineNo">1211</span> }<a name="line.1211"></a> -<span class="sourceLineNo">1212</span> sb.append("/seqid=");<a name="line.1212"></a> -<span class="sourceLineNo">1213</span> sb.append(cell.getSequenceId());<a name="line.1213"></a> -<span class="sourceLineNo">1214</span> return sb.toString();<a name="line.1214"></a> -<span class="sourceLineNo">1215</span> }<a name="line.1215"></a> -<span class="sourceLineNo">1216</span><a name="line.1216"></a> -<span class="sourceLineNo">1217</span> /**<a name="line.1217"></a> -<span class="sourceLineNo">1218</span> * This method exists just to encapsulate how we serialize keys. To be replaced by a factory<a name="line.1218"></a> -<span class="sourceLineNo">1219</span> * that we query to figure what the Cell implementation is and then, what serialization engine<a name="line.1219"></a> -<span class="sourceLineNo">1220</span> * to use and further, how to serialize the key for inclusion in hfile index. TODO.<a name="line.1220"></a> -<span class="sourceLineNo">1221</span> * @param cell<a name="line.1221"></a> -<span class="sourceLineNo">1222</span> * @return The key portion of the Cell serialized in the old-school KeyValue way or null if<a name="line.1222"></a> -<span class="sourceLineNo">1223</span> * passed a null <code>cell</code><a name="line.1223"></a> -<span class="sourceLineNo">1224</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1224"></a> -<span class="sourceLineNo">1225</span> */<a name="line.1225"></a> -<span class="sourceLineNo">1226</span> @Deprecated<a name="line.1226"></a> -<span class="sourceLineNo">1227</span> public static byte [] getCellKeySerializedAsKeyValueKey(final Cell cell) {<a name="line.1227"></a> -<span class="sourceLineNo">1228</span> return PrivateCellUtil.getCellKeySerializedAsKeyValueKey(cell);<a name="line.1228"></a> -<span class="sourceLineNo">1229</span> }<a name="line.1229"></a> -<span class="sourceLineNo">1230</span><a name="line.1230"></a> -<span class="sourceLineNo">1231</span> /**<a name="line.1231"></a> -<span class="sourceLineNo">1232</span> * Write rowkey excluding the common part.<a name="line.1232"></a> -<span class="sourceLineNo">1233</span> * @param cell<a name="line.1233"></a> -<span class="sourceLineNo">1234</span> * @param rLen<a name="line.1234"></a> -<span class="sourceLineNo">1235</span> * @param commonPrefix<a name="line.1235"></a> -<span class="sourceLineNo">1236</span> * @param out<a name="line.1236"></a> -<span class="sourceLineNo">1237</span> * @throws IOException<a name="line.1237"></a> -<span class="sourceLineNo">1238</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1238"></a> -<span class="sourceLineNo">1239</span> */<a name="line.1239"></a> -<span class="sourceLineNo">1240</span> @Deprecated<a name="line.1240"></a> -<span class="sourceLineNo">1241</span> public static void writeRowKeyExcludingCommon(Cell cell, short rLen, int commonPrefix,<a name="line.1241"></a> -<span class="sourceLineNo">1242</span> DataOutputStream out) throws IOException {<a name="line.1242"></a> -<span class="sourceLineNo">1243</span> PrivateCellUtil.writeRowKeyExcludingCommon(cell, rLen, commonPrefix, out);<a name="line.1243"></a> -<span class="sourceLineNo">1244</span> }<a name="line.1244"></a> -<span class="sourceLineNo">1245</span><a name="line.1245"></a> -<span class="sourceLineNo">1246</span> /**<a name="line.1246"></a> -<span class="sourceLineNo">1247</span> * Find length of common prefix in keys of the cells, considering key as byte[] if serialized in<a name="line.1247"></a> -<span class="sourceLineNo">1248</span> * {@link KeyValue}. The key format is &lt;2 bytes rk len&gt;&lt;rk&gt;&lt;1 byte cf<a name="line.1248"></a> -<span class="sourceLineNo">1249</span> * len&gt;&lt;cf&gt;&lt;qualifier&gt;&lt;8 bytes timestamp&gt;&lt;1 byte type&gt;<a name="line.1249"></a> -<span class="sourceLineNo">1250</span> * @param c1 the cell<a name="line.1250"></a> -<span class="sourceLineNo">1251</span> * @param c2 the cell<a name="line.1251"></a> -<span class="sourceLineNo">1252</span> * @param bypassFamilyCheck when true assume the family bytes same in both cells. Pass it as true<a name="line.1252"></a> -<span class="sourceLineNo">1253</span> * when dealing with Cells in same CF so as to avoid some checks<a name="line.1253"></a> -<span class="sourceLineNo">1254</span> * @param withTsType when true check timestamp and type bytes also.<a name="line.1254"></a> -<span class="sourceLineNo">1255</span> * @return length of common prefix<a name="line.1255"></a> -<span class="sourceLineNo">1256</span> * @deprecated As of HBase-2.0. Will be removed in HBase-3.0<a name="line.1256"></a> -<span class="sourceLineNo">1257</span> */<a name="line.1257"></a> -<span class="sourceLineNo">1258</span> @Deprecated<a name="line.1258"></a> -<span class="sourceLineNo">1259</span> public static int findCommonPrefixInFlatKey(Cell c1, Cell c2, boolean bypassFamilyCheck,<a name="line.1259"></a> -<span class="sourceLineNo">1260</span> boolean withTsType) {<a name="line.1260"></a> -<span class="sourceLineNo">1261</span> return PrivateCellUtil.findCommonPrefixInFlatKey(c1, c2, bypassFamilyCheck, withTsType);<a name="line.1261"></a> -<span class="sourceLineNo">1262</span> }<a name="line.1262"></a> -<span class="sourceLineNo">1263</span><a name="line.1263"></a> -<span class="sourceLineNo">1264</span> /** Returns a string representation of the cell */<a name="line.1264"></a> -<span class="sourceLineNo">1265</span> public static String toString(Cell cell, boolean verbose) {<a name="line.1265"></a> -<span class="sourceLineNo">1266</span> if (cell == null) {<a name="line.1266"></a> -<span class="sourceLineNo">1267</span> return "";<a name="line.1267"></a> -<span class="sourceLineNo">1268</span> }<a name="line.1268"></a> -<span class="sourceLineNo">1269</span> StringBuilder builder = new StringBuilder();<a name="line.1269"></a> -<span class="sourceLineNo">1270</span> String keyStr = getCellKeyAsString(cell);<a name="line.1270"></a> -<span class="sourceLineNo">1271</span><a name="line.1271"></a> -<span class="sourceLineNo">1272</span> String tag = null;<a name="line.1272"></a> -<span class="sourceLineNo">1273</span> String value = null;<a name="line.1273"></a> -<span class="sourceLineNo">1274</span> if (verbose) {<a name="line.1274"></a> -<span class="sourceLineNo">1275</span> // TODO: pretty print tags as well<a name="line.1275"></a> -<span class="sourceLineNo">1276</span> if (cell.getTagsLength() > 0) {<a name="line.1276"></a> -<span class="sourceLineNo">1277</span> tag = Bytes.toStringBinary(cell.getTagsArray(), cell.getTagsOffset(), cell.getTagsLength());<a name="line.1277"></a> -<span class="sourceLineNo">1278</span> }<a name="line.1278"></a> -<span class="sourceLineNo">1279</span> if (!(cell instanceof KeyValue.KeyOnlyKeyValue)) {<a name="line.1279"></a> -<span class="sourceLineNo">1280</span> value = Bytes.toStringBinary(cell.getValueArray(), cell.getValueOffset(),<a name="line.1280"></a> -<span class="sourceLineNo">1281</span> cell.getValueLength());<a name="line.1281"></a> -<span class="sourceLineNo">1282</span> }<a name="line.1282"></a> -<span class="sourceLineNo">1283</span> }<a name="line.1283"></a> -<span class="sourceLineNo">1284</span><a name="line.1284"></a> -<span class="sourceLineNo">1285</span> builder.append(keyStr);<a name="line.1285"></a> -<span class="sourceLineNo">1286</span> if (tag != null && !tag.isEmpty()) {<a name="line.1286"></a> -<span class="sourceLineNo">1287</span> builder.append("/").append(tag);<a name="line.1287"></a> -<span class="sourceLineNo">1288</span> }<a name="line.1288"></a> -<span class="sourceLineNo">1289</span> if (value != null) {<a name="line.1289"></a> -<span class="sourceLineNo">1290</span> builder.append("/").append(value);<a name="line.1290"></a> -<span class="sourceLineNo">1291</span> }<a name="line.1291"></a> -<span class="sourceLineNo">1292</span><a name="line.1292"></a> -<span class="sourceLineNo">1293</span> return builder.toString();<a name="line.1293"></a> -<span class="sourceLineNo">1294</span> }<a name="line.1294"></a> -<span class="sourceLineNo">1295</span><a name="line.1295"></a> -<span class="sourceLineNo">1296</span> /***************** special cases ****************************/<a name="line.1296"></a> -<span class="sourceLineNo">1297</span><a name="line.1297"></a> -<span class="sourceLineNo">1298</span> /**<a name="line.1298"></a> -<span class="sourceLineNo">1299</span> * special case for Cell.equals<a name="line.1299"></a> -<span class="sourceLineNo">1300</span> * @deprecated As of HBase-2.0. Will be removed in HBase-3.0<a name="line.1300"></a> -<span class="sourceLineNo">1301</span> */<a name="line.1301"></a> -<span class="sourceLineNo">1302</span> @Deprecated<a name="line.1302"></a> -<span class="sourceLineNo">1303</span> public static boolean equalsIgnoreMvccVersion(Cell a, Cell b) {<a name="line.1303"></a> -<span class="sourceLineNo">1304</span> return PrivateCellUtil.equalsIgnoreMvccVersion(a, b);<a name="line.1304"></a> -<span class="sourceLineNo">1305</span> }<a name="line.1305"></a> +<span class="sourceLineNo">1155</span><a name="line.1155"></a> +<span class="sourceLineNo">1156</span> /**<a name="line.1156"></a> +<span class="sourceLineNo">1157</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1157"></a> +<span class="sourceLineNo">1158</span> */<a name="line.1158"></a> +<span class="sourceLineNo">1159</span> @Deprecated<a name="line.1159"></a> +<span class="sourceLineNo">1160</span> public static int writeFlatKey(Cell cell, OutputStream out) throws IOException {<a name="line.1160"></a> +<span class="sourceLineNo">1161</span> return PrivateCellUtil.writeFlatKey(cell, out);<a name="line.1161"></a> +<span class="sourceLineNo">1162</span> }<a name="line.1162"></a> +<span class="sourceLineNo">1163</span><a name="line.1163"></a> +<span class="sourceLineNo">1164</span> /**<a name="line.1164"></a> +<span class="sourceLineNo">1165</span> * Writes the row from the given cell to the output stream excluding the common prefix<a name="line.1165"></a> +<span class="sourceLineNo">1166</span> * @param out The dataoutputstream to which the data has to be written<a name="line.1166"></a> +<span class="sourceLineNo">1167</span> * @param cell The cell whose contents has to be written<a name="line.1167"></a> +<span class="sourceLineNo">1168</span> * @param rlength the row length<a name="line.1168"></a> +<span class="sourceLineNo">1169</span> * @throws IOException<a name="line.1169"></a> +<span class="sourceLineNo">1170</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1170"></a> +<span class="sourceLineNo">1171</span> */<a name="line.1171"></a> +<span class="sourceLineNo">1172</span> @Deprecated<a name="line.1172"></a> +<span class="sourceLineNo">1173</span> public static void writeRowSkippingBytes(DataOutputStream out, Cell cell, short rlength,<a name="line.1173"></a> +<span class="sourceLineNo">1174</span> int commonPrefix) throws IOException {<a name="line.1174"></a> +<span class="sourceLineNo">1175</span> PrivateCellUtil.writeRowSkippingBytes(out, cell, rlength, commonPrefix);<a name="line.1175"></a> +<span class="sourceLineNo">1176</span> }<a name="line.1176"></a> +<span class="sourceLineNo">1177</span><a name="line.1177"></a> +<span class="sourceLineNo">1178</span> /**<a name="line.1178"></a> +<span class="sourceLineNo">1179</span> * Writes the qualifier from the given cell to the output stream excluding the common prefix<a name="line.1179"></a> +<span class="sourceLineNo">1180</span> * @param out The dataoutputstream to which the data has to be written<a name="line.1180"></a> +<span class="sourceLineNo">1181</span> * @param cell The cell whose contents has to be written<a name="line.1181"></a> +<span class="sourceLineNo">1182</span> * @param qlength the qualifier length<a name="line.1182"></a> +<span class="sourceLineNo">1183</span> * @throws IOException<a name="line.1183"></a> +<span class="sourceLineNo">1184</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1184"></a> +<span class="sourceLineNo">1185</span> */<a name="line.1185"></a> +<span class="sourceLineNo">1186</span> @Deprecated<a name="line.1186"></a> +<span class="sourceLineNo">1187</span> public static void writeQualifierSkippingBytes(DataOutputStream out, Cell cell,<a name="line.1187"></a> +<span class="sourceLineNo">1188</span> int qlength, int commonPrefix) throws IOException {<a name="line.1188"></a> +<span class="sourceLineNo">1189</span> if (cell instanceof ByteBufferCell) {<a name="line.1189"></a> +<span class="sourceLineNo">1190</span> ByteBufferUtils.copyBufferToStream((DataOutput)out, ((ByteBufferCell) cell).getQualifierByteBuffer(),<a name="line.1190"></a> +<span class="sourceLineNo">1191</span> ((ByteBufferCell) cell).getQualifierPosition() + commonPrefix, qlength - commonPrefix);<a name="line.1191"></a> +<span class="sourceLineNo">1192</span> } else {<a name="line.1192"></a> +<span class="sourceLineNo">1193</span> out.write(cell.getQualifierArray(), cell.getQualifierOffset() + commonPrefix,<a name="line.1193"></a> +<span class="sourceLineNo">1194</span> qlength - commonPrefix);<a name="line.1194"></a> +<span class="sourceLineNo">1195</span> }<a name="line.1195"></a> +<span class="sourceLineNo">1196</span> }<a name="line.1196"></a> +<span class="sourceLineNo">1197</span><a name="line.1197"></a> +<span class="sourceLineNo">1198</span> /**<a name="line.1198"></a> +<span class="sourceLineNo">1199</span> * @param cell<a name="line.1199"></a> +<span class="sourceLineNo">1200</span> * @return The Key portion of the passed <code>cell</code> as a String.<a name="line.1200"></a> +<span class="sourceLineNo">1201</span> */<a name="line.1201"></a> +<span class="sourceLineNo">1202</span> public static String getCellKeyAsString(Cell cell) {<a name="line.1202"></a> +<span class="sourceLineNo">1203</span> StringBuilder sb = new StringBuilder(Bytes.toStringBinary(<a name="line.1203"></a> +<span class="sourceLineNo">1204</span> cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()));<a name="line.1204"></a> +<span class="sourceLineNo">1205</span> sb.append('/');<a name="line.1205"></a> +<span class="sourceLineNo">1206</span> sb.append(cell.getFamilyLength() == 0? "":<a name="line.1206"></a> +<span class="sourceLineNo">1207</span> Bytes.toStringBinary(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength()));<a name="line.1207"></a> +<span class="sourceLineNo">1208</span> // KeyValue only added ':' if family is non-null. Do same.<a name="line.1208"></a> +<span class="sourceLineNo">1209</span> if (cell.getFamilyLength() > 0) sb.append(':');<a name="line.1209"></a> +<span class="sourceLineNo">1210</span> sb.append(cell.getQualifierLength() == 0? "":<a name="line.1210"></a> +<span class="sourceLineNo">1211</span> Bytes.toStringBinary(cell.getQualifierArray(), cell.getQualifierOffset(),<a name="line.1211"></a> +<span class="sourceLineNo">1212</span> cell.getQualifierLength()));<a name="line.1212"></a> +<span class="sourceLineNo">1213</span> sb.append('/');<a name="line.1213"></a> +<span class="sourceLineNo">1214</span> sb.append(KeyValue.humanReadableTimestamp(cell.getTimestamp()));<a name="line.1214"></a> +<span class="sourceLineNo">1215</span> sb.append('/');<a name="line.1215"></a> +<span class="sourceLineNo">1216</span> sb.append(Type.codeToType(cell.getTypeByte()));<a name="line.1216"></a> +<span class="sourceLineNo">1217</span> if (!(cell instanceof KeyValue.KeyOnlyKeyValue)) {<a name="line.1217"></a> +<span class="sourceLineNo">1218</span> sb.append("/vlen=");<a name="line.1218"></a> +<span class="sourceLineNo">1219</span> sb.append(cell.getValueLength());<a name="line.1219"></a> +<span class="sourceLineNo">1220</span> }<a name="line.1220"></a> +<span class="sourceLineNo">1221</span> sb.append("/seqid=");<a name="line.1221"></a> +<span class="sourceLineNo">1222</span> sb.append(cell.getSequenceId());<a name="line.1222"></a> +<span class="sourceLineNo">1223</span> return sb.toString();<a name="line.1223"></a> +<span class="sourceLineNo">1224</span> }<a name="line.1224"></a> +<span class="sourceLineNo">1225</span><a name="line.1225"></a> +<span class="sourceLineNo">1226</span> /**<a name="line.1226"></a> +<span class="sourceLineNo">1227</span> * This method exists just to encapsulate how we serialize keys. To be replaced by a factory<a name="line.1227"></a> +<span class="sourceLineNo">1228</span> * that we query to figure what the Cell implementation is and then, what serialization engine<a name="line.1228"></a> +<span class="sourceLineNo">1229</span> * to use and further, how to serialize the key for inclusion in hfile index. TODO.<a name="line.1229"></a> +<span class="sourceLineNo">1230</span> * @param cell<a name="line.1230"></a> +<span class="sourceLineNo">1231</span> * @return The key portion of the Cell serialized in the old-school KeyValue way or null if<a name="line.1231"></a> +<span class="sourceLineNo">1232</span> * passed a null <code>cell</code><a name="line.1232"></a> +<span class="sourceLineNo">1233</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1233"></a> +<span class="sourceLineNo">1234</span> */<a name="line.1234"></a> +<span class="sourceLineNo">1235</span> @Deprecated<a name="line.1235"></a> +<span class="sourceLineNo">1236</span> public static byte [] getCellKeySerializedAsKeyValueKey(final Cell cell) {<a name="line.1236"></a> +<span class="sourceLineNo">1237</span> return PrivateCellUtil.getCellKeySerializedAsKeyValueKey(cell);<a name="line.1237"></a> +<span class="sourceLineNo">1238</span> }<a name="line.1238"></a> +<span class="sourceLineNo">1239</span><a name="line.1239"></a> +<span class="sourceLineNo">1240</span> /**<a name="line.1240"></a> +<span class="sourceLineNo">1241</span> * Write rowkey excluding the common part.<a name="line.1241"></a> +<span class="sourceLineNo">1242</span> * @param cell<a name="line.1242"></a> +<span class="sourceLineNo">1243</span> * @param rLen<a name="line.1243"></a> +<span class="sourceLineNo">1244</span> * @param commonPrefix<a name="line.1244"></a> +<span class="sourceLineNo">1245</span> * @param out<a name="line.1245"></a> +<span class="sourceLineNo">1246</span> * @throws IOException<a name="line.1246"></a> +<span class="sourceLineNo">1247</span> * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.<a name="line.1247"></a> +<span class="sourceLineNo">1248</span> */<a name="line.1248"></a> +<span class="sourceLineNo">1249</span> @Deprecated<a name="line.1249"></a> +<span class="sourceLineNo">1250</span> public static void writeRowKeyExcludingCommon(Cell cell, short rLen, int commonPrefix,<a name="line.1250"></a> +<span class="sourceLineNo">1251</span> DataOutputStream out) throws IOException {<a name="line.1251"></a> +<span class="sourceLineNo">1252</span> PrivateCellUtil.writeRowKeyExcludingCommon(cell, rLen, commonPrefix, out);<a name="line.1252"></a> +<span class="sourceLineNo">1253</span> }<a name="line.1253"></a> +<span class="sourceLineNo">1254</span><a name="line.1254"></a> +<span class="sourceLineNo">1255</span> /**<a name="line.1255"></a> +<span class="sourceLineNo">1256</span> * Find length of common prefix in keys of the cells, considering key as byte[] if serialized in<a name="line.1256"></a> +<span class="sourceLineNo">1257</span> * {@link KeyValue}. The key format is &lt;2 bytes rk len&gt;&lt;rk&gt;&lt;1 byte cf<a name="line.1257"></a> +<span class="sourceLineNo">1258</span> * len&gt;&lt;cf&gt;&lt;qualifier&gt;&lt;8 bytes timestamp&gt;&lt;1 byte type&gt;<a name="line.1258"></a> +<span class="sourceLineNo">1259</span> * @param c1 the cell<a name="line.1259"></a> +<span class="sourceLineNo">1260</span> * @param c2 the cell<a name="line.1260"></a> +<span class="sourceLineNo">1261</span> * @param bypassFamilyCheck when true assume the family bytes same in both cells. Pass it as true<a name="line.1261"></a> +<span class="sourceLineNo">1262</span> * when dealing with Cells in same CF so as to avoid some checks<a name="line.1262"></a> +<span class="sourceLineNo">1263</span> * @param withTsType when true check timestamp and type bytes also.<a name="line.1263"></a> +<span class="sourceLineNo">1264</span> * @return length of common prefix<a name="line.1264"></a> +<span class="sourceLineNo">1265</span> * @deprecated As of HBase-2.0. Will be removed in HBase-3.0<a name="line.1265"></a> +<span class="sourceLineNo">1266</span> */<a name="line.1266"></a> +<span class="sourceLineNo">1267</span> @Deprecated<a name="line.1267"></a> +<span class="sourceLineNo">1268</span> public static int findCommonPrefixInFlatKey(Cell c1, Cell c2, boolean bypassFamilyCheck,<a name="line.1268"></a> +<span class="sourceLineNo">1269</span> boolean withTsType) {<a name="line.1269"></a> +<span class="sourceLineNo">1270</span> return PrivateCellUtil.findCommonPrefixInFlatKey(c1, c2, bypassFamilyCheck, withTsType);<a name="line.1270"></a> +<span class="sourceLineNo">1271</span> }<a name="line.1271"></a> +<span class="sourceLineNo">1272</span><a name="line.1272"></a> +<span class="sourceLineNo">1273</span> /** Returns a string representation of the cell */<a name="line.1273"></a> +<span class="sourceLineNo">1274</span> public static String toString(Cell cell, boolean verbose) {<a name="line.1274"></a> +<span class="sourceLineNo">1275</span> if (cell == null) {<a name="line.1275"></a> +<span class="sourceLineNo">1276</span> return "";<a name="line.1276"></a> +<span class="sourceLineNo">1277</span> }<a name="line.1277"></a> +<span class="sourceLineNo">1278</span> StringBuilder builder = new StringBuilder();<a name="line.1278"></a> +<span class="sourceLineNo">1279</span> String keyStr = getCellKeyAsString(cell);<a name="line.1279"></a> +<span class="sourceLineNo">1280</span><a name="line.1280"></a> +<span class="sourceLineNo">1281</span> String tag = null;<a name="line.1281"></a> +<span class="sourceLineNo">1282</span> String value = null;<a name="line.1282"></a> +<span class="sourceLineNo">1283</span> if (verbose) {<a name="line.1283"></a> +<span class="sourceLineNo">1284</span> // TODO: pretty print tags as well<a name="line.1284"></a> +<span class="sourceLineNo">1285</span> if (cell.getTagsLength() > 0) {<a name="line.1285"></a> +<span class="sourceLineNo">1286</span> tag = Bytes.toStringBinary(cell.getTagsArray(), cell.getTagsOffset(), cell.getTagsLength());<a name="line.1286"></a> +<span class="sourceLineNo">1287</span> }<a name="line.1287"></a> +<span class="sourceLineNo">1288</span> if (!(cell instanceof KeyValue.KeyOnlyKeyValue)) {<a name="line.1288"></a> +<span class="sourceLineNo">1289</span> value = Bytes.toStringBinary(cell.getValueArray(), cell.getValueOffset(),<a name="line.1289"></a> +<span class="sourceLineNo">1290</span> cell.getValueLength());<a name="line.1290"></a> +<span class="sourceLineNo">1291</span> }<a name="line.1291"></a> +<span class="sourceLineNo">1292</span> }<a name="line.1292"></a> +<span class="sourceLineNo">1293</span><a name="line.1293"></a> +<span class="sourceLineNo">1294</span> builder.append(keyStr);<a name="line.1294"></a> +<span class="sourceLineNo">1295</span> if (tag != null && !tag.isEmpty()) {<a name="line.1295"></a> +<span class="sourceLineNo">1296</span> builder.append("/").append(tag);<a name="line.1296"></a> +<span class="sourceLineNo">1297</span> }<a name="line.1297"></a> +<span class="sourceLineNo">1298</span> if (value != null) {<a name="line.1298"></a> +<span class="sourceLineNo">1299</span> builder.append("/").append(value);<a name="line.1299"></a> +<span class="sourceLineNo">1300</span> }<a name="line.1300"></a> +<span class="sourceLineNo">1301</span><a name="line.1301"></a> +<span class="sourceLineNo">1302</span> return builder.toString();<a name="line.1302"></a> +<span class="sourceLineNo">1303</span> }<a name="line.1303"></a> +<span class="sourceLineNo">1304</span><a name="line.1304"></a> +<span class="sourceLineNo">1305</span> /***************** special cases ****************************/<a name="line.1305"></a> <span class="sourceLineNo">1306</span><a name="line.1306"></a> -<span class="sourceLineNo">1307</span> /**************** equals ****************************/<a name="line.1307"></a> -<span class="sourceLineNo">1308</span><a name="line.1308"></a> -<span class="sourceLineNo">1309</span> public static boolean equals(Cell a, Cell b) {<a name="line.1309"></a> -<span class="sourceLineNo">1310</span> return matchingRows(a, b) && matchingFamily(a, b) && matchingQualifier(a, b)<a name="line.1310"></a> -<span class="sourceLineNo">1311</span> && matchingTimestamp(a, b) && PrivateCellUtil.matchingType(a, b);<a name="line.1311"></a> -<span class="sourceLineNo">1312</span> }<a name="line.1312"></a> -<span class="sourceLineNo">1313</span><a name="line.1313"></a> -<span class="sourceLineNo">1314</span> public static boolean matchingTimestamp(Cell a, Cell b) {<a name="line.1314"></a> -<span class="sourceLineNo">1315</span> return CellComparatorImpl.COMPARATOR.compareTimestamps(a.getTimestamp(), b.getTimestamp()) == 0;<a name="line.1315"></a> -<span class="sourceLineNo">1316</span> }<a name="line.1316"></a> +<span class="sourceLineNo">1307</span> /**<a name="line.1307"></a> +<span class="sourceLineNo">1308</span> * special case for Cell.equals<a name="line.1308"></a> +<span class="sourceLineNo">1309</span> * @deprecated As of HBase-2.0. Will be removed in HBase-3.0<a name="line.1309"></a> +<span class="sourceLineNo">1310</span> */<a name="line.1310"></a> +<span class="sourceLineNo">1311</span> @Deprecated<a name="line.1311"></a> +<span class="sourceLineNo">1312</span> public static boolean equalsIgnoreMvccVersion(Cell a, Cell b) {<a name="line.1312"></a> +<span class="sourceLineNo">1313</span> return PrivateCellUtil.equalsIgnoreMvccVersion(a, b);<a name="line.1313"></a> +<span class="sourceLineNo">1314</span> }<a name="line.1314"></a> +<span class="sourceLineNo">1315</span><a name="line.1315"></a> +<span class="sourceLineNo">1316</span> /**************** equals ****************************/<a name="line.1316"></a> <span class="sourceLineNo">1317</span><a name="line.1317"></a> -<span class="sourceLineNo">1318</span> /**<a name="line.1318"></a> -<span class="sourceLineNo">1319</span> * @deprecated As of HBase-2.0. Will be removed in HBase-3.0<a name="line.1319"></a> -<span class="sourceLineNo">1320</span> */<a name="line.1320"></a> -<span class="sourceLineNo">1321</span> @Deprecated<a name="line.1321"></a> -<span class="sourceLineNo">1322</span> public static boolean matchingType(Cell a, Cell b) {<a name="line.1322"></a> -<span class="sourceLineNo">1323</span> return PrivateCellUtil.matchingType(a, b);<a name="line.1323"></a> -<span class="sourceLineNo">1324</span> }<a name="line.1324"></a> -<span class="sourceLineNo">1325</span><a name="line.1325"></a> -<span class="sourceLineNo">1326</span> /**<a name="line.1326"></a> -<span class="sourceLineNo">1327</span> * Compares the row of two keyvalues for equality<a name="line.1327"></a> -<span class="sourceLineNo">1328</span> * @param left<a name="line.1328"></a> -<span class="sourceLineNo">1329</span> * @param right<a name="line.1329"></a> -<span class="sourceLineNo">1330</span> * @return True if rows match.<a name="line.1330"></a> -<span class="sourceLineNo">1331</span> */<a name="line.1331"></a> -<span class="sourceLineNo">1332</span> public static boolean matchingRows(final Cell left, final Cell right) {<a name="line.1332"></a> -<span class="sourceLineNo">1333</span> short lrowlength = left.getRowLength();<a name="line.1333"></a> -<span class="sourceLineNo">1334</span> short rrowlength = right.getRowLength();<a name="line.1334"></a> -<span class="sourceLineNo">1335</span> if (lrowlength != rrowlength) return false;<a name="line.1335"></a> -<span class="sourceLineNo">1336</span> if (left instanceof ByteBufferCell && right instanceof ByteBufferCell) {<a name="line.1336"></a> -<span class="sourceLineNo">1337</span> return ByteBufferUtils.equals(((ByteBufferCell) left).getRowByteBuffer(),<a name="line.1337"></a> -<span class="sourceLineNo">1338</span> ((ByteBufferCell) left).getRowPosition(), lrowlength,<a name="line.1338"></a> -<span class="sourceLineNo">1339</span> ((ByteBufferCell) right).getRowByteBuffer(), ((ByteBufferCell) right).getRowPosition(),<a name="line.1339"></a> -<span class="sourceLineNo">1340</span> rrowlength);<a name="line.1340"></a> -<span class="sourceLineNo">1341</span> }<a name="line.1341"></a> -<span class="sourceLineNo">1342</span> if (left instanceof ByteBufferCell) {<a name="line.1342"></a> -<span class="sourceLineNo">1343</span> return ByteBufferUtils.equals(((ByteBufferCell) left).getRowByteBuffer(),<a name="line.1343"></a> -<span class="sourceLineNo">1344</span> ((ByteBufferCell) left).getRowPosition(), lrowlength, right.getRowArray(),<a name="line.1344"></a> -<span class="sourceLineNo">1345</span> right.getRowOffset(), rrowlength);<a name="line.1345"></a> -<span class="sourceLineNo">1346</span> }<a name="line.1346"></a> -<span class="sourceLineNo">1347</span> if (right instanceof ByteBufferCell) {<a name="line.1347"></a> -<span class="sourceLineNo">1348</span> return ByteBufferUtils.equals(((ByteBufferCell) right).getRowByteBuffer(),<a name="line.1348"></a> -<span class="sourceLineNo">1349</span> ((ByteBufferCell) right).getRowPosition(), rrowlength, left.getRowArray(),<a name="line.1349"></a> -<span class="sourceLineNo">1350</span> left.getRowOffset(), lrowlength);<a name="line.1350"></a> -<span class="sourceLineNo">1351</span> }<a name="line.1351"></a> -<span class="sourceLineNo">1352</span> return Bytes.equals(left.getRowArray(), left.getRowOffset(), lrowlength, right.getRowArray(),<a name="line.1352"></a> -<span class="sourceLineNo">1353</span> right.getRowOffset(), rrowlength);<a name="line.1353"></a> -<span class="sourceLineNo">1354</span> }<a name="line.1354"></a> -<span class="sourceLineNo">1355</span><a name="line.1355"></a> -<span class="sourceLineNo">1356</span> /**<a name="line.1356"></a> -<span class="sourceLineNo">1357</span> * Compares the row and column of two keyvalues for equality<a name="line.1357"></a> -<span class="sourceLineNo">1358</span> * @param left<a name="line.1358"></a> -<span class="sourceLineNo">1359</span> * @param right<a name="line.1359"></a> -<span class="sourceLineNo">1360</span> * @return True if same row and column.<a name="line.1360"></a> -<span class="sourceLineNo">1361</span> */<a name="line.1361"></a> -<span class="sourceLineNo">1362</span> public static boolean matchingRowColumn(final Cell left, final Cell right) {<a name="line.1362"></a> -<span class="sourceLineNo">1363</span> if ((left.getRowLength() + left.getFamilyLength()<a name="line.1363"></a> -<span class="sourceLineNo">1364</span> + left.getQualifierLength()) != (right.getRowLength() + right.getFamilyLength()<a name="line.1364"></a> -<span class="sourceLineNo">1365</span> + right.getQualifierLength())) {<a name="line.1365"></a> -<span class="sourceLineNo">1366</span> return false;<a name="line.1366"></a> -<span class="sourceLineNo">1367</span> }<a name="line.1367"></a> -<span class="sourceLineNo">1368</span><a name="line.1368"></a> -<span class="sourceLineNo">1369</span> if (!matchingRows(left, right)) {<a name="line.1369"></a> -<span class="sourceLineNo">1370</span> return false;<a name="line.1370"></a> -<span class="sourceLineNo">1371</span> }<a name="line.1371"></a> -<span class="sourceLineNo">1372</span> return matchingColumn(left, right);<a name="line.1372"></a> -<span class="sourceLineNo">1373</span> }<a name="line.1373"></a> -<span class="sourceLineNo">1374</span><a name="line.1374"></a> -<span class="sourceLineNo">1375</span> public static boolean matchingRowColumnBytes(final Cell left, final Cell right) {<a name="line.1375"></a> -<span class="sourceL
<TRUNCATED>