Class FitsHduWriter
- Namespace
- FitsModel.FitsStream.Writer
- Assembly
- FitsModel.dll
Writes FitsDataBlocks until a complete FitsHdu is formed, then forwards it to any registered IFitsHduReader instances.
public class FitsHduWriter : DataBlockWriterBase, IFitsDataBlockWriter, IFitsHeaderReader, IFitsDataReader
- Inheritance
-
FitsHduWriter
- Implements
- Inherited Members
Constructors
FitsHduWriter()
Initializes a new instance of the FitsHduWriter class.
public FitsHduWriter()
Properties
AccumulateValues
If true, data values will be accumulated as they are read from the stream.
public bool AccumulateValues { get; set; }
Property Value
CalculateStatistics
If true, statistics will be calculated for HDU data as it is read.
public bool CalculateStatistics { get; set; }
Property Value
Hdu
If set, the full FitsHdu that was read from the data blocks.
public FitsHdu? Hdu { get; }
Property Value
Header
If set, contains the FitsHeader that was read from the data blocks.
public FitsHeader? Header { get; }
Property Value
ValueWriter
If CalculateStatistics or AccumulateValues is true, this will be set to a value writer that performs those tasks.
public IFitsValueWriter? ValueWriter { get; }
Property Value
Methods
AddHduReader(IFitsHduReader)
Adds a new IFitsHduReader instance that will be called when a complete FitsHdu is read from the data blocks.
public void AddHduReader(IFitsHduReader hduReader)
Parameters
hduReader
IFitsHduReader
AddHeaderReader(IFitsHeaderReader)
Registers a new IFitsHeaderReader instance that will be called when a complete FitsHeader is read from the data blocks.
public void AddHeaderReader(IFitsHeaderReader headerReader)
Parameters
headerReader
IFitsHeaderReader
AddValueParser(IFitsDataBlockWriter)
Value parsers receive FitsDataBlocks for the current HDU's data section.
public void AddValueParser(IFitsDataBlockWriter dataBlockWriter)
Parameters
dataBlockWriter
IFitsDataBlockWriter
Exceptions
- FitsModelException
Thrown if we have not yet read a FitsHeader and no FitsModel.FitsStream.Writer.FitsHduWriter.DataWriter is set.
ReadData(FitsData)
Called when the FitsDataWriter has read all of the data defined in Header.
public void ReadData(FitsData data)
Parameters
data
FitsData
Exceptions
ReadHeader(FitsHeader)
Called when the FitsHeaderWriter has read a complete FitsHeader.
If the header
indicates that there is no data, the FitsHdu is created and forwarded to all registered IFitsHduReader instances.
If there is data, a FitsDataWriter is initialized and all future data blocks are forwarded to it.
public void ReadHeader(FitsHeader header)
Parameters
header
FitsHeaderHeader that was parsed from the block stream.
WriteDataBlock(FitsDataBlock)
Writes data blocks to first create a FitsHeader. If the header indicates that data is present, data blocks are then written to create a FitsData object. After a complete FitsHdu is formed, it is forwarded to all registered IFitsHduReader instances. An exception is thrown if a data block is written after the HDU is set.
public override void WriteDataBlock(FitsDataBlock dataBlock)
Parameters
dataBlock
FitsDataBlock