Table of Contents

Class EndianBinaryReader

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

Endian aware binary reader.

public class EndianBinaryReader : BinaryReader, IDisposable
Inheritance
EndianBinaryReader
Implements
Inherited Members
Extension Methods

Constructors

EndianBinaryReader(Stream, Endian, bool)

Initializes an instance of the EndianBinaryReader class.

public EndianBinaryReader(Stream input, Endian endian, bool leaveOpen)

Parameters

input Stream

Stream from which to read.

endian Endian

Endianness of the input.

leaveOpen bool

true to leave the stream open after the EndianBinaryReaderr object is disposed; otherwise, false.

EndianBinaryReader(Stream, bool)

Initializes an instance of the EndianBinaryReader class.

public EndianBinaryReader(Stream input, bool leaveOpen)

Parameters

input Stream

Stream from which to read.

leaveOpen bool

true to leave the stream open after the EndianBinaryReaderr object is disposed; otherwise, false.

EndianBinaryReader(Stream, Encoding, Endian, bool)

Initializes an instance of the EndianBinaryReader class.

public EndianBinaryReader(Stream input, Encoding encoding, Endian endian, bool leaveOpen)

Parameters

input Stream

Stream from which to read.

encoding Encoding

Encoding of the input.

endian Endian

Endianness of the input.

leaveOpen bool

true to leave the stream open after the EndianBinaryReaderr object is disposed; otherwise, false.

EndianBinaryReader(Stream, Encoding, bool)

Initializes an instance of the EndianBinaryReader class.

public EndianBinaryReader(Stream input, Encoding encoding, bool leaveOpen)

Parameters

input Stream

Stream from which to read.

encoding Encoding

Encoding of the input.

leaveOpen bool

true to leave the stream open after the EndianBinaryReaderr object is disposed; otherwise, false.

Properties

Endian

Gets or sets the endianness of the binary reader.

public Endian Endian { get; protected set; }

Property Value

Endian

UseInternalBuffer

public bool UseInternalBuffer { get; set; }

Property Value

bool

Methods

Create(Stream, Endian, bool)

Convenience method for creating a binary reader with requested endian.

public static BinaryReader Create(Stream input, Endian endian, bool leaveOpen)

Parameters

input Stream

Stream from which to read.

endian Endian

Endianness of the input.

leaveOpen bool

true to leave the stream open after the EndianBinaryReaderr object is disposed; otherwise, false.

Returns

BinaryReader

Binary reader with requested endian.

Create(Stream, Encoding, Endian, bool)

Convenience method for creating a binary reader with requested endian.

public static BinaryReader Create(Stream input, Encoding encoding, Endian endian, bool leaveOpen)

Parameters

input Stream

Stream from which to read.

encoding Encoding

Encoding of the input.

endian Endian

Endianness of the input.

leaveOpen bool

true to leave the stream open after the EndianBinaryReaderr object is disposed; otherwise, false.

Returns

BinaryReader

Binary reader with requested endian.

ReadDouble()

Reads an 8-byte floating point value from the current stream and advances the current position of the stream by eight bytes.

public override double ReadDouble()

Returns

double

An 8-byte floating point value read from the current stream.

Exceptions

EndOfStreamException

The end of the stream is reached.

ObjectDisposedException

The stream is closed.

IOException

An I/O error occurred.

ReadInt16()

Reads a 2-byte signed integer from the current stream and advances the current position of the stream by two bytes.

public override short ReadInt16()

Returns

short

A 2-byte signed integer read from the current stream.

Exceptions

EndOfStreamException

The end of the stream is reached.

ObjectDisposedException

The stream is closed.

IOException

An I/O error occurred.

ReadInt32()

Reads a 4-byte signed integer from the current stream and advances the current position of the stream by four bytes.

public override int ReadInt32()

Returns

int

A 4-byte signed integer read from the current stream.

Exceptions

EndOfStreamException

The end of the stream is reached.

ObjectDisposedException

The stream is closed.

IOException

An I/O error occurred.

ReadInt64()

Reads an 8-byte signed integer from the current stream and advances the current position of the stream by eight bytes.

public override long ReadInt64()

Returns

long

An 8-byte signed integer read from the current stream.

Exceptions

EndOfStreamException

The end of the stream is reached.

ObjectDisposedException

The stream is closed.

IOException

An I/O error occurred.

ReadSingle()

Reads a 4-byte floating point value from the current stream and advances the current position of the stream by four bytes.

public override float ReadSingle()

Returns

float

A 4-byte floating point value read from the current stream.

Exceptions

EndOfStreamException

The end of the stream is reached.

ObjectDisposedException

The stream is closed.

IOException

An I/O error occurred.

ReadUInt16()

Reads a 2-byte unsigned integer from the current stream using little-endian encoding and advances the position of the stream by two bytes.

public override ushort ReadUInt16()

Returns

ushort

A 2-byte unsigned integer read from this stream.

Exceptions

EndOfStreamException

The end of the stream is reached.

ObjectDisposedException

The stream is closed.

IOException

An I/O error occurred.

ReadUInt32()

Reads a 4-byte unsigned integer from the current stream and advances the position of the stream by four bytes.

public override uint ReadUInt32()

Returns

uint

A 4-byte unsigned integer read from this stream.

Exceptions

EndOfStreamException

The end of the stream is reached.

ObjectDisposedException

The stream is closed.

IOException

An I/O error occurred.

ReadUInt64()

Reads an 8-byte unsigned integer from the current stream and advances the position of the stream by eight bytes.

public override ulong ReadUInt64()

Returns

ulong

An 8-byte unsigned integer read from this stream.

Exceptions

EndOfStreamException

The end of the stream is reached.

IOException

An I/O error occurred.

ObjectDisposedException

The stream is closed.