org.dicom4j.data
Class SpecificCharacterSet

java.lang.Object
  extended by org.dicom4j.data.SpecificCharacterSet

public class SpecificCharacterSet
extends Object

A class to encapsulate the functionality defined by the DICOM Specific Character Set attribute, including the ability to parse the string values of the attribute and then apply the appropriate character conversions from byte array values into Java's internal Unicode representation contained in String.

Since:
0.0.3
Author:
Laurent Lecomte

Constructor Summary
SpecificCharacterSet(String[] specificCharacterSetAttributeValues)
          Construct a character set handler from the values of the Specific Character Set attribute.
 
Method Summary
 String translateByteArrayToString(byte[] bytes)
           
 String translateByteArrayToString(byte[] bytes, int offset, int length)
          Translate a byte array (such as a value from a DICOM attribute), using the specified Specific Character Set, into a String.
 byte[] translateStringToByteArray(String string)
          Encode a string into a byte array.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpecificCharacterSet

public SpecificCharacterSet(String[] specificCharacterSetAttributeValues)

Construct a character set handler from the values of the Specific Character Set attribute.

Parameters:
specificCharacterSetAttributeValues - the values of Specific Character Set
Method Detail

translateByteArrayToString

public String translateByteArrayToString(byte[] bytes)

translateByteArrayToString

public String translateByteArrayToString(byte[] bytes,
                                         int offset,
                                         int length)

Translate a byte array (such as a value from a DICOM attribute), using the specified Specific Character Set, into a String.

Parameters:
bytes - the bytes to translate
offset - the offset into the byte array to start translation
length - how many bytes to translate
Returns:
the string decoded according to the specific character set

translateStringToByteArray

public byte[] translateStringToByteArray(String string)
                                  throws UnsupportedEncodingException

Encode a string into a byte array.

Does not currently support ISO 2022 (or JIS 0208 or 0212 if 1.4.1 bug present).

Parameters:
string - the string to be encoded
Returns:
the byte array encoded according to the specific character set
Throws:
UnsupportedEncodingException


Copyright © 2009 dicom4j. All Rights Reserved.