Table of Contents

Class FitsDataBlockStream

Namespace
FitsModel.FitsStream
Assembly
FitsModel.dll

Reads FitsDataBlocks from a stream and forwards them to any registered DataBlockWriterBase instances.

public class FitsDataBlockStream : Stream, IDisposable, IAsyncDisposable
Inheritance
FitsDataBlockStream
Implements
Inherited Members

Constructors

FitsDataBlockStream(DataBlockWriterBase)

Reads FitsDataBlocks from a stream and forwards them to any registered DataBlockWriterBase instances.

public FitsDataBlockStream(DataBlockWriterBase dataBlockWriter)

Parameters

dataBlockWriter DataBlockWriterBase

Data block writer that will receive data blocks as they are read from the stream.

Properties

CanRead

Not implemented.

public override bool CanRead { get; }

Property Value

bool

CanSeek

Not implemented.

public override bool CanSeek { get; }

Property Value

bool

CanWrite

This stream will continuously accept data and write them to FitsDataBlocks.

public override bool CanWrite { get; }

Property Value

bool

CancelToken

Cancellation token that can be used to flag any streams writing to this stream to stop.

public CancellationToken CancelToken { get; }

Property Value

CancellationToken

DataBlockWriter

Writer that will receive full FitsDataBlocks as they are formed.

public IFitsDataBlockWriter DataBlockWriter { get; }

Property Value

IFitsDataBlockWriter

Length

Not implemented.

public override long Length { get; }

Property Value

long

Position

Not implemented.

public override long Position { get; set; }

Property Value

long

Methods

ChunkMemoryStream(MemoryStream, int)

Splits a MemoryStream into chunks of size n.

public static List<byte[]> ChunkMemoryStream(MemoryStream stream, int n)

Parameters

stream MemoryStream
n int

Returns

List<byte[]>

Flush()

Not implemented.

public override void Flush()

Read(byte[], int, int)

Not implemented.

public override int Read(byte[] buffer, int offset, int count)

Parameters

buffer byte[]
offset int
count int

Returns

int

ReadFromFile(FileInfo, bool)

Reads a full FitsFile from the specified fileInfo.

public static Task<FitsFile> ReadFromFile(FileInfo fileInfo, bool readImageOnly)

Parameters

fileInfo FileInfo

File name to read.

readImageOnly bool

If true, only the primary HDU and the first image HDU will be read. All other HDUs will be ignored.

Returns

Task<FitsFile>

Exceptions

FitsModelException

Thrown if no file was found.

Seek(long, SeekOrigin)

Not implemented.

public override long Seek(long offset, SeekOrigin origin)

Parameters

offset long
origin SeekOrigin

Returns

long

SetLength(long)

Not implemented.

public override void SetLength(long value)

Parameters

value long

Write(byte[], int, int)

Writes data to this stream. Data is buffered and chunked into 2880-byte FitsDataBlocks. Once a complete block is formed, it is forwarded to all registered DataBlockWriterBase instances.

public override void Write(byte[] buffer, int offset, int count)

Parameters

buffer byte[]
offset int
count int