# Class SAMBinaryTagAndValue

java.lang.Object
htsjdk.samtools.SAMBinaryTagAndValue

All Implemented Interfaces:
  `Serializable`

Direct Known Subclasses:
  `SAMBinaryTagAndUnsignedArrayValue`

public class SAMBinaryTagAndValue extends Object implements Serializable
Holds a SAMRecord attribute and the tagname (in binary form) for that attribute. SAMRecord stores tag name and value in this form, because much String creation is avoided this way. See SAMTagUtil to convert the tag to String form. Values associated with attribute tags must be of a type that implements `Serializable` or else serialization will fail. Accepted types are String, scalar types Short, Integer, Character, Float, and Long (see below); array types byte[], short[], int[] and float[]. Cannot be null. Long valued attributes are constrained to the range [Integer.MIN_VALUE, BinaryCodec.MAX_UINT], which includes the entire range of signed ints [Integer.MIN_VALUE, Integer.MAX_VALUE] and the entire range of unsigned ints that can be stored per the BAM spec [0, (Integer.MAX_VALUE * 2) + 1].

See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`protected SAMBinaryTagAndValue`
`next`
`static final long`
`serialVersionUID`
`final short`
`tag`
`final Object`
`value`

## Constructor Summary

Constructors
Constructor
Description
`SAMBinaryTagAndValue(short tag, Object value)`

## Method Summary

Modifier and Type
Method
Description
`protected Object`
`cloneValue()`
`SAMBinaryTagAndValue`
`copy()`
Creates and returns a shallow copy of the list of tag/values.
`SAMBinaryTagAndValue`
`deepCopy()`
Creates and returns a deep copy of the list of tag/values.
`boolean`
`equals(Object o)`
`SAMBinaryTagAndValue`
`find(short tag)`
Returns the SAMBinaryTagAndValue that contains the required tag, or null if not contained.
`SAMBinaryTagAndValue`
`getNext()`
`int`
`hashCode()`
`SAMBinaryTagAndValue`
`insert(SAMBinaryTagAndValue attr)`
Inserts an item into the ordered list of attributes and returns the head of the list/sub-list
`protected static boolean`
`isAllowedAttributeValue(Object value)`
`boolean`
`isUnsignedArray()`
`SAMBinaryTagAndValue`
`remove(short tag)`
Removes a tag from the list and returns the new head of the list/sub-list.

### Methods inherited from class Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### serialVersionUID

public static final long serialVersionUID

See Also:
  - Constant Field Values

### tag

public final short tag

### value

public final Object value

### next

protected SAMBinaryTagAndValue next

## Constructor Details

### SAMBinaryTagAndValue

public SAMBinaryTagAndValue(short tag, Object value)

Parameters:
  `tag` - tagname (in binary form) for this attribute
  `value` - value for this attribute (must be of a type that implements `Serializable` or else serialization will fail). Cannot be null.

## Method Details

### isAllowedAttributeValue

protected static boolean isAllowedAttributeValue(Object value)

### equals

public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### copy

public SAMBinaryTagAndValue copy()
Creates and returns a shallow copy of the list of tag/values.

### deepCopy

public SAMBinaryTagAndValue deepCopy()
Creates and returns a deep copy of the list of tag/values.

### cloneValue

protected Object cloneValue()

### getNext

public SAMBinaryTagAndValue getNext()

### insert

public SAMBinaryTagAndValue insert(SAMBinaryTagAndValue attr)
Inserts an item into the ordered list of attributes and returns the head of the list/sub-list

### remove

public SAMBinaryTagAndValue remove(short tag)
Removes a tag from the list and returns the new head of the list/sub-list.

### find

public SAMBinaryTagAndValue find(short tag)
Returns the SAMBinaryTagAndValue that contains the required tag, or null if not contained.

### isUnsignedArray

public boolean isUnsignedArray()