org.dicom4j.data.elements.support
Class StringElement

java.lang.Object
  extended by org.dicom4j.data.elements.support.DataElement
      extended by org.dicom4j.data.elements.support.StringElement
Direct Known Subclasses:
AgeString, ApplicationEntity, CodeString, DateElement, DateTime, DecimalString, IntegerString, LongString, PersonName, ShortString, Time, UniqueIdentifier

public abstract class StringElement
extends DataElement

Abstract class specializing DataElement for the family of string attributes.

Since:
0.0.0
Author:
Laurent Lecomte

Method Summary
 void addValue(String aValue)
          Add a(nother) String value after any existing values of this attribute.
 void clear()
          Clear Data contains in this Element
 long getPaddedVL()
           Get the value length of this attribute, accounting for the need for even-length padding.
 String[] getStringValues(NumberFormat format)
           Get the values of this attribute as strings.
 long getValueLength()
           Gets the value length
 int getValueMultiplicity()
           Get the value multiplicity of this element
 void read(DicomInputStream aStream, long length, SpecificCharacterSet aCharacterSet)
           Read a constructed attribute from an input stream; called only by concrete sub-classes.
 void setValue(String aValue)
           
 String toString()
           Dump the contents of the attribute as a human-readable string.
 void write(DicomOutputStream aOutputStream)
           Write the entire attribute (including values) to the output stream.
 
Methods inherited from class org.dicom4j.data.elements.support.DataElement
addValue, addValue, addValue, addValue, addValue, addValue, getByteValues, getDelimitedStringValues, getDelimitedStringValues, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDoubleValues, getDoubleValues, getFloatValues, getIntegerValues, getIntegerValues, getLongValues, getLongValues, getName, getOriginalStringValues, getShortValues, getSingleDoubleValueOrDefault, getSingleDoubleValueOrDefault, getSingleIntegerValue, getSingleIntegerValue, getSingleIntegerValue, getSingleIntegerValueOrDefault, getSingleLongValueOrDefault, getSingleLongValueOrDefault, getSingleStringValue, getSingleStringValue, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrNull, getSingleStringValueOrNull, getSingleStringValueOrNull, getSingleStringValueOrNull, getStringValues, getStringValues, getStringValues, getTag, getValueRepresentation, isAvailableAsString, isGroupLength, isValid, read, removeValues, setValues, setValues, setValues
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

clear

public void clear()
Description copied from class: DataElement
Clear Data contains in this Element

Overrides:
clear in class DataElement

getPaddedVL

public long getPaddedVL()
Description copied from class: DataElement

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

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

getStringValues

public String[] getStringValues(NumberFormat format)
                         throws DicomException

Get the values of this attribute as strings.

The strings are first cleaned up into a canonical form, to remove leading and trailing padding.

Overrides:
getStringValues in class DataElement
Parameters:
format - the format to use for each numerical or decimal value
Returns:
the values as an array of String
Throws:
DicomException - not thrown

getValueLength

public long getValueLength()
Description copied from class: DataElement

Gets the value length

Overrides:
getValueLength in class DataElement
Returns:
the value length (does not include need for even-length padding, hence may be odd length)

getValueMultiplicity

public int getValueMultiplicity()
Description copied from class: DataElement

Get the value multiplicity of this element

Overrides:
getValueMultiplicity in class DataElement
Returns:
the value multiplicity

read

public void read(DicomInputStream aStream,
                 long length,
                 SpecificCharacterSet aCharacterSet)
          throws IOException,
                 DicomException

Read a constructed attribute from an input stream; called only by concrete sub-classes.

Specified by:
read in class DataElement
Parameters:
length - the value length of the attribute
i - the input stream
aCharacterSet - the character set to be used for the text
Throws:
IOException
DicomException

write

public void write(DicomOutputStream aOutputStream)
           throws DicomException,
                  IOException
Description copied from class: DataElement

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

Specified by:
write in class DataElement
Parameters:
aOutputStream -
Throws:
IOException
DicomException

setValue

public void setValue(String aValue)

addValue

public void addValue(String aValue)
Description copied from class: DataElement
Add a(nother) String value after any existing values of this attribute.

Overrides:
addValue in class DataElement
Parameters:
aValue -
Throws:
DicomException

toString

public String toString()
Description copied from class: DataElement

Dump the contents of the attribute as a human-readable string.

No new line is appended.

The result is of the form:

 (0xgggg,0xeeee) VR=<XX> VL=<0xnnnn> <...>
 

For example:

 (0x0018,0x0020) VR=<CS> VL=<0x2> <GR>
 

Overrides:
toString in class DataElement
Returns:
a single String value


Copyright © 2009 dicom4j. All Rights Reserved.