Class ByteBufferByteSource
- Namespace
- FellowOakDicom.IO.Buffer
- Assembly
- fo-dicom.core.dll
Byte source for reading in form of byte buffer.
public class ByteBufferByteSource : IByteSource
- Inheritance
-
ByteBufferByteSource
- Implements
- Inherited Members
- Extension Methods
Constructors
ByteBufferByteSource()
Initializes a new instance of ByteBufferByteSource. Internal list of buffers is empty.
public ByteBufferByteSource()
ByteBufferByteSource(params IByteBuffer[])
Initializes a new instance of ByteBufferByteSource.
public ByteBufferByteSource(params IByteBuffer[] buffers)
Parameters
buffers
IByteBuffer[]Initial collection of buffers.
Properties
Endian
Gets or sets the endianness.
public Endian Endian { get; set; }
Property Value
IsEOF
Gets whether end-of-source is reached.
public bool IsEOF { get; }
Property Value
Position
Gets the current read position.
public long Position { get; }
Property Value
Methods
Add(IByteBuffer, bool)
Add byte buffer to byte source.
public void Add(IByteBuffer buffer, bool last)
Parameters
buffer
IByteBufferByte buffer to add.
last
booltrue if added buffer is the last to add, false otherwise.
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
uintNumber 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
uintNumber 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
intThe index in the buffer at which to start writing
count
intNumber 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
intNumber 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
longthe position to seek to
Require(uint)
Verifies that there is a sufficient number of bytes to read.
public bool Require(uint count)
Parameters
count
uintRequired 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
uintRequired number of bytes.
callback
ByteSourceCallbackByte source callback.
state
objectCallback 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
uintNumber of bytes to skip.