com.pixelmed.dicom

## Class OtherByteAttributeOnDisk

- java.lang.Object
- - com.pixelmed.dicom.Attribute
  - - com.pixelmed.dicom.OtherAttributeOnDisk
    - - com.pixelmed.dicom.OtherByteAttributeOnDisk

    public class OtherByteAttributeOnDisk
    extends OtherAttributeOnDisk

A concrete class specializing `Attribute` for Other Byte (OB) attributes whose values are not memory resident.

Though an instance of this class may be created using its constructors, there is also a factory class, `AttributeFactory`.

See Also:
  `Attribute`, `AttributeFactory`, `AttributeList`, `OtherWordAttributeOnDisk`

### Field Summary

### Fields inherited from class com.pixelmed.dicom.OtherAttributeOnDisk

`byteOffset, file`

### Fields inherited from class com.pixelmed.dicom.Attribute

`valueLength, valueMultiplicity`

### Constructor Summary

Constructors
Constructor and Description
`OtherByteAttributeOnDisk(AttributeTag t)` Construct an (empty) attribute.
`OtherByteAttributeOnDisk(AttributeTag t, long vl, DicomInputStream i, long byteOffset)` Read an attribute from an input stream.
`OtherByteAttributeOnDisk(AttributeTag t, java.lang.Long vl, DicomInputStream i, java.lang.Long byteOffset)` Read an attribute from an input stream.

### Method Summary

Methods
`byte[]` `getByteValues()` Get the values of this attribute as a byte array.
`long` `getPaddedVL()` Get the value length of this attribute, accounting for the need for even-length padding.
`byte[]` `getVR()` Get the value representation of this attribute (OB).
`void` `write(DicomOutputStream o)` Write the entire attribute (including values) to the output stream.

### Methods inherited from class com.pixelmed.dicom.OtherAttributeOnDisk

`getByteOffset, getFile, removeValues, setFile, toString`

### Methods inherited from class com.pixelmed.dicom.Attribute

`addValue, addValue, addValue, addValue, addValue, addValue, addValue, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDoubleValues, getDoubleValues, getDoubleValues, getElement, getFloatValues, getFloatValues, getFloatValues, getGroup, getIntegerValues, getIntegerValues, getIntegerValues, getLongValues, getLongValues, getLongValues, getOriginalStringValues, getShortValues, getSingleDoubleValueOrDefault, getSingleDoubleValueOrDefault, getSingleDoubleValueOrDefault, getSingleFloatValueOrDefault, getSingleFloatValueOrDefault, getSingleFloatValueOrDefault, getSingleIntegerValueOrDefault, getSingleIntegerValueOrDefault, getSingleIntegerValueOrDefault, getSingleLongValueOrDefault, getSingleLongValueOrDefault, getSingleLongValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrNull, getSingleStringValueOrNull, getSingleStringValueOrNull, getSingleStringValueOrNull, getSingleStringValueOrNull, getSingleStringValueOrNull, getStringValues, getStringValues, getStringValues, getStringValues, getStringValues, getStringValues, getTag, getVL, getVM, getVRAsString, isValid, repairValues, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValues, setValues, setValues, setValues, toString, writeBase`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### OtherByteAttributeOnDisk

    public OtherByteAttributeOnDisk(AttributeTag t)

Construct an (empty) attribute.

Parameters:
  `t` - the tag of the attribute

#### OtherByteAttributeOnDisk

    public OtherByteAttributeOnDisk(AttributeTag t,
                            long vl,
                            DicomInputStream i,
                            long byteOffset)
                             throws java.io.IOException,
                                    DicomException

Read an attribute from an input stream.

Parameters:
  `t` - the tag of the attribute
  `vl` - the value length of the attribute
  `i` - the input stream
  `byteOffset` - the byte offset in the input stream of the start of the data
Throws:
  `java.io.IOException`
  `DicomException`

#### OtherByteAttributeOnDisk

    public OtherByteAttributeOnDisk(AttributeTag t,
                            java.lang.Long vl,
                            DicomInputStream i,
                            java.lang.Long byteOffset)
                             throws java.io.IOException,
                                    DicomException

Read an attribute from an input stream.

Parameters:
  `t` - the tag of the attribute
  `vl` - the value length of the attribute
  `i` - the input stream
  `byteOffset` - the byte offset in the input stream of the start of the data
Throws:
  `java.io.IOException`
  `DicomException`

### Method Detail

#### getPaddedVL

    public long getPaddedVL()

Description copied from class: `Attribute`

Get the value length of this attribute, accounting for the need for even-length padding.

Overrides:
  `getPaddedVL` in class `Attribute`
Returns:
  the value length (padded to an even length)

#### write

    public void write(DicomOutputStream o)
               throws DicomException,
                      java.io.IOException

Description copied from class: `Attribute`

Write the entire attribute (including values) to the output stream.

Specified by:
  `write` in class `Attribute`
Parameters:
  `o` -
Throws:
  `java.io.IOException`
  `DicomException`

#### getByteValues

    public byte[] getByteValues()
                         throws DicomException

Get the values of this attribute as a byte array.

This allocates a new array of sufficient length, which may fail if it is too large, and defeats the point of leaving the byte values on disk in the first place. However, it is a fallback for when the caller does not want to go to the trouble of creating a `MappedByteBuffer` from the file, or more likely is not even aware that the attribute values have been left on disk, because `AttributeFactory` silently created an instance of this class rather than an in-memory `OtherByteAttribute`.

Overrides:
  `getByteValues` in class `Attribute`
Returns:
  the values as an array of bytes
Throws:
  `DicomException` - thrown if values cannot be read

#### getVR

    public byte[] getVR()

Get the value representation of this attribute (OB).

Overrides:
  `getVR` in class `Attribute`
Returns:
  'O','B' in ASCII as a two byte array; see `ValueRepresentation`