/// <summary> /// Converts a string to an array of bytes by given DICOM /// character repertoire. /// </summary> public static byte[] ToBytes(string s, CharacterRepertoire characterRepertoire) { if (characterRepertoire != null) { return(characterRepertoire.Encoding.GetBytes(s)); } else { throw new EncodingException("characterRepertoire", "null"); } }
/// <summary> /// Converts count of bytes from a byte array starting at a /// specified offset into a string by given DICOM character /// repertoire. /// </summary> public static string ToString(byte[] bytes, int offset, int count, CharacterRepertoire characterRepertoire) { if (characterRepertoire != null) { return(characterRepertoire.Encoding.GetString(bytes, offset, count)); } else { throw new EncodingException("characterRepertoire", "null"); } }
/// <summary> /// Creates a new DICOM transfer syntax instance from specified data /// set containing a transfer syntax UID data element and specified /// character repertoire. /// </summary> public TransferSyntax(DataSet dataSet, CharacterRepertoire characterRepertoire) { CharacterRepertoire = characterRepertoire; LoadFrom(dataSet); }
/// <summary> /// Creates a new DICOM transfer syntax instance from specified /// transfer syntax UID data element and specified DICOM character /// repertoire. /// </summary> public TransferSyntax(DataElement transferSyntaxUid, CharacterRepertoire characterRepertoire) { CharacterRepertoire = characterRepertoire; LoadFrom(transferSyntaxUid); }
/// <summary> /// Creates a new DICOM transfer syntax instance from specified DICOM /// UID and default character repertoire. /// </summary> public TransferSyntax(Uid uid, CharacterRepertoire characterRepertoire) { Uid = uid; CharacterRepertoire = characterRepertoire; }
/// <summary> /// Creates a new DICOM transfer syntax instance from specified /// DICOM UID string representation and specified DICOM character /// repertoire. /// </summary> public TransferSyntax(string uid, CharacterRepertoire characterRepertoire) : this(new Uid(uid), characterRepertoire) { }
/// <summary> /// Converts count of bytes from a byte array into a string by /// given DICOM character repertoire. /// </summary> public static string ToString(byte[] bytes, int count, CharacterRepertoire characterRepertoire) { return(ToString(bytes, 0, count, characterRepertoire)); }
/// <summary> /// Converts an array of bytes into a string by given DICOM /// character repertoire. /// </summary> public static string ToString(byte[] bytes, CharacterRepertoire characterRepertoire) { return(ToString(bytes, 0, bytes.Length, characterRepertoire)); }