Class RawPDU
Encapsulates PDU data for reading or writing
Implements
Inherited Members
Namespace: Dicom.Network
Assembly: cs.temp.dll.dll
Syntax
public class RawPDU : IDisposable
Constructors
RawPDU(Byte, Encoding)
Initializes new PDU for writing
Declaration
public RawPDU(byte type, Encoding encoding = null)
Parameters
Type | Name | Description |
---|---|---|
Byte | type | Type of PDU |
Encoding | encoding | The encoding to use for encoding text |
RawPDU(Byte[], Encoding)
Initializes new PDU reader from buffer
Declaration
public RawPDU(byte[] buffer, Encoding encoding = null)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | Buffer |
Encoding | encoding | The encoding to use for decoding text |
Properties
Length
PDU length
Declaration
public uint Length { get; }
Property Value
Type | Description |
---|---|
UInt32 |
Type
PDU type
Declaration
public byte Type { get; }
Property Value
Type | Description |
---|---|
Byte |
Methods
Dispose()
Declaration
public void Dispose()
MarkLength16(String)
Marks position to write 16-bit length value
Declaration
public void MarkLength16(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Field name |
MarkLength32(String)
Marks position to write 32-bit length value
Declaration
public void MarkLength32(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Field name |
ReadByte(String)
Read byte from PDU
Declaration
public byte ReadByte(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of field |
Returns
Type | Description |
---|---|
Byte | Field value |
ReadBytes(String, Int32)
Read bytes from PDU
Declaration
public byte[] ReadBytes(string name, int count)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of field |
Int32 | count | Number of bytes to read |
Returns
Type | Description |
---|---|
Byte[] | Field value |
ReadString(String, Int32)
Reads string from PDU
Declaration
public string ReadString(string name, int numberOfBytes)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of field |
Int32 | numberOfBytes | Number of bytes to read |
Returns
Type | Description |
---|---|
String | Field value |
ReadUInt16(String)
Read ushort from PDU
Declaration
public ushort ReadUInt16(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of field |
Returns
Type | Description |
---|---|
UInt16 | Field value |
ReadUInt32(String)
Reads uint from PDU
Declaration
public uint ReadUInt32(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of field |
Returns
Type | Description |
---|---|
UInt32 | Field value |
Reset()
Reset PDU read stream
Declaration
public void Reset()
Save(String)
Saves PDU to file
Declaration
public void Save(string file)
Parameters
Type | Name | Description |
---|---|---|
String | file | Filename |
SkipBytes(String, Int32)
Skips ahead in PDU
Declaration
public void SkipBytes(string name, int count)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of field |
Int32 | count | Number of bytes to skip |
ToString()
Gets string describing this PDU
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | PDU description |
Overrides
Write(String, Byte)
Writes byte to PDU
Declaration
public void Write(string name, byte value)
Parameters
Type | Name | Description |
---|---|---|
String | name | Field name |
Byte | value | Field value |
Write(String, Byte, Int32)
Writes byte to PDU multiple times
Declaration
public void Write(string name, byte value, int count)
Parameters
Type | Name | Description |
---|---|---|
String | name | Field name |
Byte | value | Field value |
Int32 | count | Number of times to write PDU value |
Write(String, Byte[])
Writes byte[] to PDU
Declaration
public void Write(string name, byte[] value)
Parameters
Type | Name | Description |
---|---|---|
String | name | Field name |
Byte[] | value | Field value |
Write(String, String)
Writes string to PDU
Declaration
public void Write(string name, string value)
Parameters
Type | Name | Description |
---|---|---|
String | name | Field name |
String | value | Field value |
Write(String, String, Int32, Char)
Writes string to PDU
Declaration
public void Write(string name, string value, int count, char pad)
Parameters
Type | Name | Description |
---|---|---|
String | name | Field name |
String | value | Field value |
Int32 | count | Number of characters to write |
Char | pad | Padding character |
Write(String, UInt16)
Writes ushort to PDU
Declaration
public void Write(string name, ushort value)
Parameters
Type | Name | Description |
---|---|---|
String | name | Field name |
UInt16 | value | Field value |
Write(String, UInt32)
Writes uint to PDU
Declaration
public void Write(string name, uint value)
Parameters
Type | Name | Description |
---|---|---|
String | name | Field name |
UInt32 | value | Field value |
WriteLength16()
Writes 16-bit length to top length marker
Declaration
public void WriteLength16()
WriteLength32()
Writes 32-bit length to top length marker
Declaration
public void WriteLength32()
WritePDU(Stream)
Writes PDU to stream
Declaration
public void WritePDU(Stream s)
Parameters
Type | Name | Description |
---|---|---|
Stream | s | Output stream |