Post

SpecDataPoint.Write

Writes the data point to a BinaryWriter as two doubles.


Remarks

Writes 16 bytes at the writer’s current position: Mz first, then Intensity, each as a double. No length prefix, no type tag, no terminator.

This is the layout SpecDataPoint.Read expects. SpecDataPointEx uses a different one, with six fields.


Syntax

SyntaxDescription
Write(BinaryWriter writer)Writes the m/z then the intensity to the stream, each as a double.

Parameters

NameTypeDescription
writerBinaryWriterA writer positioned where this data point’s values should go.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
using System.IO;
using Nova.Data;

SpecDataPoint peak = new SpecDataPoint(445.12, 10523.0);

using (MemoryStream stream = new MemoryStream())
using (BinaryWriter writer = new BinaryWriter(stream))
{
  peak.Write(writer);

  // 16 bytes: Mz then Intensity, each a little-endian double.
  byte[] bytes = stream.ToArray();
}
This post is licensed under CC BY 4.0 by the author.

Trending Tags