Class StreamByteSource
Stream byte source for reading.
Inheritance
Implements
Inherited Members
Namespace: FellowOakDicom.IO
Assembly: fo-dicom.core.dll
Syntax
public class StreamByteSource : IByteSource
Constructors
StreamByteSource(Stream, FileReadOption, Int32)
Initializes a new instance of StreamByteSource.
Declaration
public StreamByteSource(Stream stream, FileReadOption readOption = FileReadOption.Default, int largeObjectSize = 0)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Stream to read from. |
FileReadOption | readOption | Defines how large values are handled. |
System.Int32 | largeObjectSize | Custom limit of what are large values and what are not. If 0 is passed, then the default of 64k is used. |
Properties
Endian
Gets or sets the endianness.
Declaration
public Endian Endian { get; set; }
Property Value
Type | Description |
---|---|
Endian |
IsEOF
Gets whether end-of-source is reached.
Declaration
public bool IsEOF { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
LargeObjectSize
Gets or sets the size of what is considered a large object.
Declaration
public int LargeObjectSize { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Position
Gets the current read position.
Declaration
public long Position { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
ReadOption
Gets the mode for handling large values.
Declaration
public FileReadOption ReadOption { get; }
Property Value
Type | Description |
---|---|
FileReadOption |
Methods
GetBuffer(UInt32)
Gets a byte buffer of specified length from the current position and moves to subsequent position.
Declaration
public IByteBuffer GetBuffer(uint count)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | count | Number of bytes to read. |
Returns
Type | Description |
---|---|
IByteBuffer | Byte buffer containing the read bytes. |
GetBufferAsync(UInt32)
Asynchronously gets a byte buffer of specified length from the current position and moves to subsequent position.
Declaration
public Task<IByteBuffer> GetBufferAsync(uint count)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | count | Number of bytes to read. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IByteBuffer> | Awaitable byte buffer containing the read bytes. |
GetBytes(Byte[], Int32, Int32)
Declaration
public int GetBytes(byte[] buffer, int index, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | |
System.Int32 | index | |
System.Int32 | count |
Returns
Type | Description |
---|---|
System.Int32 |
GetBytes(Int32)
Gets a specified number of bytes from the current position and moves to subsequent position.
Declaration
public byte[] GetBytes(int count)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | count | Number of bytes to read. |
Returns
Type | Description |
---|---|
System.Byte[] | Array of bytes. |
GetDouble()
Gets a double precision floating point value (64 bits) from the current position and moves to subsequent position.
Declaration
public double GetDouble()
Returns
Type | Description |
---|---|
System.Double | Double precision floating point value. |
GetInt16()
Gets a signed short (16 bits) from the current position and moves to subsequent position.
Declaration
public short GetInt16()
Returns
Type | Description |
---|---|
System.Int16 | Signed short. |
GetInt32()
Gets a signed integer (32 bits) from the current position and moves to subsequent position.
Declaration
public int GetInt32()
Returns
Type | Description |
---|---|
System.Int32 | Signed integer. |
GetInt64()
Gets a signed long (64 bits) from the current position and moves to subsequent position.
Declaration
public long GetInt64()
Returns
Type | Description |
---|---|
System.Int64 | Signed long. |
GetSingle()
Gets a single precision floating point value (32 bits) from the current position and moves to subsequent position.
Declaration
public float GetSingle()
Returns
Type | Description |
---|---|
System.Single | Single precision floating point value. |
GetStream()
Declaration
public Stream GetStream()
Returns
Type | Description |
---|---|
System.IO.Stream |
GetUInt16()
Gets an unsigned short (16 bits) from the current position and moves to subsequent position.
Declaration
public ushort GetUInt16()
Returns
Type | Description |
---|---|
System.UInt16 | Unsigned short. |
GetUInt32()
Gets an unsigned integer (32 bits) from the current position and moves to subsequent position.
Declaration
public uint GetUInt32()
Returns
Type | Description |
---|---|
System.UInt32 | Unsigned integer. |
GetUInt64()
Gets an unsigned long (64 bits) from the current position and moves to subsequent position.
Declaration
public ulong GetUInt64()
Returns
Type | Description |
---|---|
System.UInt64 | Unsigned long. |
GetUInt8()
Gets one byte from the current position and moves to subsequent position.
Declaration
public byte GetUInt8()
Returns
Type | Description |
---|---|
System.Byte | Single byte. |
GoTo(Int64)
Declaration
public void GoTo(long position)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | position |
Require(UInt32)
Verifies that there is a sufficient number of bytes to read.
Declaration
public bool Require(uint count)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | count | Required number of bytes. |
Returns
Type | Description |
---|---|
System.Boolean | true if source contains sufficient number of remaining bytes, false otherwise. |
Require(UInt32, ByteSourceCallback, Object)
Verifies that there is a sufficient number of bytes to read.
Declaration
public bool Require(uint count, ByteSourceCallback callback, object state)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | count | Required number of bytes. |
ByteSourceCallback | callback | Byte source callback. |
System.Object | state | Callback state. |
Returns
Type | Description |
---|---|
System.Boolean | true if source contains sufficient number of remaining bytes, false otherwise. |
Skip(UInt32)
Skip position count
number of bytes.
Declaration
public void Skip(uint count)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | count | Number of bytes to skip. |