Table of Contents

Class StreamByteSource

Namespace
FellowOakDicom.IO
Assembly
fo-dicom.core.dll

Stream byte source for reading.

public class StreamByteSource : IByteSource
Inheritance
StreamByteSource
Implements
Inherited Members
Extension Methods

Constructors

StreamByteSource(Stream, FileReadOption, int)

Initializes a new instance of StreamByteSource.

public StreamByteSource(Stream stream, FileReadOption readOption = FileReadOption.Default, int largeObjectSize = 0)

Parameters

stream Stream

Stream to read from.

readOption FileReadOption

Defines how large values are handled.

largeObjectSize int

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.

public Endian Endian { get; set; }

Property Value

Endian

IsEOF

Gets whether end-of-source is reached.

public bool IsEOF { get; }

Property Value

bool

LargeObjectSize

Gets or sets the size of what is considered a large object.

public int LargeObjectSize { get; set; }

Property Value

int

Position

Gets the current read position.

public long Position { get; }

Property Value

long

ReadOption

Gets the mode for handling large values.

public FileReadOption ReadOption { get; }

Property Value

FileReadOption

Methods

GetBuffer(uint)

Gets a byte buffer of specified length from the current position and moves to subsequent position.

public IByteBuffer GetBuffer(uint count)

Parameters

count uint

Number of bytes to read.

Returns

IByteBuffer

Byte buffer containing the read bytes.

GetBufferAsync(uint)

Asynchronously gets a byte buffer of specified length from the current position and moves to subsequent position.

public Task<IByteBuffer> GetBufferAsync(uint count)

Parameters

count uint

Number of bytes to read.

Returns

Task<IByteBuffer>

Awaitable byte buffer containing the read bytes.

GetBytes(byte[], int, int)

Gets a specified number of bytes from the current position and moves to subsequent position. The bytes will be written to buffer

public int GetBytes(byte[] buffer, int index, int count)

Parameters

buffer byte[]

The buffer to write the bytes to

index int

The index in the buffer at which to start writing

count int

Number of bytes to read.

Returns

int

The number of bytes that were filled in the buffer

GetBytes(int)

Gets a specified number of bytes from the current position and moves to subsequent position.

public byte[] GetBytes(int count)

Parameters

count int

Number of bytes to read.

Returns

byte[]

Array of bytes.

GetDouble()

Gets a double precision floating point value (64 bits) from the current position and moves to subsequent position.

public double GetDouble()

Returns

double

Double precision floating point value.

GetInt16()

Gets a signed short (16 bits) from the current position and moves to subsequent position.

public short GetInt16()

Returns

short

Signed short.

GetInt32()

Gets a signed integer (32 bits) from the current position and moves to subsequent position.

public int GetInt32()

Returns

int

Signed integer.

GetInt64()

Gets a signed long (64 bits) from the current position and moves to subsequent position.

public long GetInt64()

Returns

long

Signed long.

GetSingle()

Gets a single precision floating point value (32 bits) from the current position and moves to subsequent position.

public float GetSingle()

Returns

float

Single precision floating point value.

GetStream()

Get stream of this byte source.

public Stream GetStream()

Returns

Stream

The stream.

GetUInt16()

Gets an unsigned short (16 bits) from the current position and moves to subsequent position.

public ushort GetUInt16()

Returns

ushort

Unsigned short.

GetUInt32()

Gets an unsigned integer (32 bits) from the current position and moves to subsequent position.

public uint GetUInt32()

Returns

uint

Unsigned integer.

GetUInt64()

Gets an unsigned long (64 bits) from the current position and moves to subsequent position.

public ulong GetUInt64()

Returns

ulong

Unsigned long.

GetUInt8()

Gets one byte from the current position and moves to subsequent position.

public byte GetUInt8()

Returns

byte

Single byte.

GoTo(long)

Sets the current read position to the position position

public void GoTo(long position)

Parameters

position long

the position to seek to

Require(uint)

Verifies that there is a sufficient number of bytes to read.

public bool Require(uint count)

Parameters

count uint

Required number of bytes.

Returns

bool

true if source contains sufficient number of remaining bytes, false otherwise.

Require(uint, ByteSourceCallback, object)

Verifies that there is a sufficient number of bytes to read.

public bool Require(uint count, ByteSourceCallback callback, object state)

Parameters

count uint

Required number of bytes.

callback ByteSourceCallback

Byte source callback.

state object

Callback state.

Returns

bool

true if source contains sufficient number of remaining bytes, false otherwise.

Skip(uint)

Skip position count number of bytes.

public void Skip(uint count)

Parameters

count uint

Number of bytes to skip.