Class FileByteSource
File byte source for reading.
Inherited Members
Namespace: Dicom.IO
Assembly: cs.temp.dll.dll
Syntax
public class FileByteSource : IByteSource, IDisposable
Constructors
FileByteSource(IFileReference, FileReadOption)
Initializes an instance of FileByteSource.
Declaration
public FileByteSource(IFileReference file, FileReadOption readOption)
Parameters
| Type | Name | Description |
|---|---|---|
| IFileReference | file | File to read from. |
| FileReadOption | readOption |
Properties
CanRewind
Gets whether its possible to rewind the source.
Declaration
public bool CanRewind { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
Endian
Gets or sets the endianess.
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 |
|---|---|
| Boolean |
LargeObjectSize
Gets or sets the size of what is considered a large object.
Declaration
public int LargeObjectSize { get; set; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Marker
Gets the position of the current marker.
Declaration
public long Marker { get; }
Property Value
| Type | Description |
|---|---|
| Int64 |
MilestonesCount
Gets the milestone levels count.
Declaration
public int MilestonesCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Position
Gets the current read position.
Declaration
public long Position { get; }
Property Value
| Type | Description |
|---|---|
| Int64 |
Methods
Dispose()
Declaration
public void Dispose()
Dispose(Boolean)
Perform disposal.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | disposing | true if disposal request originates from Dispose call, false if request originates from sestructor. |
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 |
|---|---|---|
| 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 |
|---|---|---|
| UInt32 | count | Number of bytes to read. |
Returns
| Type | Description |
|---|---|
| Task<IByteBuffer> | Awaitable byte buffer containing the read bytes. |
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 |
|---|---|---|
| Int32 | count | Number of bytes to read. |
Returns
| Type | Description |
|---|---|
| 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 |
|---|---|
| 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 |
|---|---|
| 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 |
|---|---|
| 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 |
|---|---|
| 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 |
|---|---|
| Single | Single precision floating point value. |
GetStream()
Declaration
public Stream GetStream()
Returns
| Type | Description |
|---|---|
| Stream |
GetUInt16()
Gets an unsigned short (16 bits) from the current position and moves to subsequent position.
Declaration
public ushort GetUInt16()
Returns
| Type | Description |
|---|---|
| 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 |
|---|---|
| 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 |
|---|---|
| UInt64 | Unsigned long. |
GetUInt8()
Gets one byte from the current position and moves to subsequent position.
Declaration
public byte GetUInt8()
Returns
| Type | Description |
|---|---|
| Byte | Single byte. |
HasReachedMilestone()
Checks whether the byte source position is at the uppermost milestone position.
Declaration
public bool HasReachedMilestone()
Returns
| Type | Description |
|---|---|
| Boolean | true if uppermost milestone is reached, false otherwise. |
Mark()
Set a mark at the current position.
Declaration
public void Mark()
PopMilestone()
Pop the uppermost level of milestone.
Declaration
public void PopMilestone()
PushMilestone(UInt32)
Mark the position of a new level of milestone.
Declaration
public void PushMilestone(uint count)
Parameters
| Type | Name | Description |
|---|---|---|
| UInt32 | count | Expected distance in bytes from the current position to the milestone. |
Require(UInt32)
Verifies that there is a sufficient number of bytes to read.
Declaration
public bool Require(uint count)
Parameters
| Type | Name | Description |
|---|---|---|
| UInt32 | count | Required number of bytes. |
Returns
| Type | Description |
|---|---|
| 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 |
|---|---|---|
| UInt32 | count | Required number of bytes. |
| ByteSourceCallback | callback | Byte source callback. |
| Object | state | Callback state. |
Returns
| Type | Description |
|---|---|
| Boolean | true if source contains sufficient number of remaining bytes, false otherwise. |
Rewind()
Rewind byte source to latest Marker.
Declaration
public void Rewind()
Skip(UInt32)
Skip position count number of bytes.
Declaration
public void Skip(uint count)
Parameters
| Type | Name | Description |
|---|---|---|
| UInt32 | count | Number of bytes to skip. |