org.apache.hadoop.hbase
Class Tag

java.lang.Object
  extended by org.apache.hadoop.hbase.Tag

@InterfaceAudience.Private
@InterfaceStability.Evolving
public class Tag
extends Object

Tags are part of cells and helps to add metadata about the KVs. Metadata could be ACLs per cells, visibility labels, etc.


Field Summary
static int INFRASTRUCTURE_SIZE
           
static int MAX_TAG_LENGTH
           
static int TAG_LENGTH_SIZE
           
static int TYPE_LENGTH_SIZE
           
 
Constructor Summary
Tag(byte[] bytes, int offset)
          Creates a Tag from the specified byte array and offset.
Tag(byte[] bytes, int offset, int length)
          Creates a Tag from the specified byte array, starting at offset, and for length length.
Tag(byte[] bytes, int offset, short length)
          Deprecated. Use Tag(byte[], int, int)
Tag(byte tagType, byte[] tag)
           
Tag(byte tagType, String tag)
           
 
Method Summary
static List<Tag> asList(byte[] b, int offset, int length)
          Creates the list of tags from the byte array b.
static byte[] fromList(List<Tag> tags)
          Write a list of tags into a byte array
 byte[] getBuffer()
           
static Tag getTag(byte[] b, int offset, int length, byte type)
          Retrieve the first tag from the tags byte array matching the passed in tag type
 int getTagLength()
           
 int getTagOffset()
           
 byte getType()
           
 byte[] getValue()
          Returns tag value in a new byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_LENGTH_SIZE

public static final int TYPE_LENGTH_SIZE
See Also:
Constant Field Values

TAG_LENGTH_SIZE

public static final int TAG_LENGTH_SIZE
See Also:
Constant Field Values

INFRASTRUCTURE_SIZE

public static final int INFRASTRUCTURE_SIZE
See Also:
Constant Field Values

MAX_TAG_LENGTH

public static final int MAX_TAG_LENGTH
See Also:
Constant Field Values
Constructor Detail

Tag

public Tag(byte tagType,
           String tag)

Tag

public Tag(byte tagType,
           byte[] tag)
Parameters:
tagType -
tag -

Tag

public Tag(byte[] bytes,
           int offset)
Creates a Tag from the specified byte array and offset. Presumes bytes content starting at offset is formatted as a Tag blob. The bytes to include the tag type, tag length and actual tag bytes.

Parameters:
bytes - byte array
offset - offset to start of Tag

Tag

@Deprecated
public Tag(byte[] bytes,
                      int offset,
                      short length)
Deprecated. Use Tag(byte[], int, int)

Creates a Tag from the specified byte array, starting at offset, and for length length. Presumes bytes content starting at offset is formatted as a Tag blob.

Parameters:
bytes - byte array
offset - offset to start of the Tag
length - length of the Tag

Tag

public Tag(byte[] bytes,
           int offset,
           int length)
Creates a Tag from the specified byte array, starting at offset, and for length length. Presumes bytes content starting at offset is formatted as a Tag blob.

Parameters:
bytes - byte array
offset - offset to start of the Tag
length - length of the Tag
Method Detail

getBuffer

public byte[] getBuffer()
Returns:
The byte array backing this Tag.

getType

public byte getType()
Returns:
the tag type

getTagLength

public int getTagLength()
Returns:
Length of actual tag bytes within the backed buffer

getTagOffset

public int getTagOffset()
Returns:
Offset of actual tag bytes within the backed buffer

getValue

public byte[] getValue()
Returns tag value in a new byte array. Primarily for use client-side. If server-side, use getBuffer() with appropriate getTagOffset() and getTagLength() instead to save on allocations.

Returns:
tag value in a new byte array.

asList

public static List<Tag> asList(byte[] b,
                               int offset,
                               int length)
Creates the list of tags from the byte array b. Expected that b is in the expected tag format

Parameters:
b -
offset -
length -
Returns:
List of tags

fromList

public static byte[] fromList(List<Tag> tags)
Write a list of tags into a byte array

Parameters:
tags -
Returns:
the serialized tag data as bytes

getTag

public static Tag getTag(byte[] b,
                         int offset,
                         int length,
                         byte type)
Retrieve the first tag from the tags byte array matching the passed in tag type

Parameters:
b -
offset -
length -
type -
Returns:
null if there is no tag of the passed in tag type


Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.