org.das2.qstream.QdsToD2sStream

Write QDataSets that vary over at most 2 independent variables as a Das2 stream. Since Das2 streams can have at most 2 independent variables, higher dimensional (not necessarily higher rank) QDataSets can't be written using this code. Streams that can be written have the following plane structure X Y [Y Y Y Y ... ] X YScan [YScan YScan YScan ... ] X Y Z [Z Z Z Z ... ] All binary output is streamed in machine-native order. Since datasets written on one architecture are most likely to be read on the same architecture this choice causes the least amount of byte swapping. This is a direct seralization of QDataSet and does not require any legacy das2 dataset classes such as VectorDataset or TableDataset.

QdsToD2sStream( String version )

Initialize a binary QDataSet to das2 stream exporter

QdsToD2sStream( String version, int genSigDigits, int fracSecDigits )

Initialize a text QDataSet to das2 stream exporter


FORMAT_2_2


FORMAT_2_3_BASIC


FORMAT_2_3_GENERAL


formats


DEFAUT_FRAC_SEC


DEFAUT_SIG_DIGIT


canWrite

canWrite( QDataSet qds ) → boolean

Determine if a given dataset be serialized as a das2 stream

Parameters

qds - The dataset to write

Returns:

true if this dataset can be serialized as a das2 stream, false otherwise

[search for examples] [view on GitHub] [view on old javadoc] [view source]


qd2DataAxis

qd2DataAxis( QDataSet qds ) → String

Determine the name of the das2 axis on which values from a dataset would typically be plotted. This is a duck-typing check. Which looks at the number of dependencies and planes in a dataset. If the dataset has a PLANE_0 property, the axis of the PLANE_0 values is returned instead of the axis of the primary dataset. The output of this function is an educated guess since coordinates are not denoted as separate from data values in QDataSets or CDFs.

Parameters

qds - a QDataSet

Returns:

one of "x", "y", "z" or null if we can't figure it out.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


write

write( QDataSet qds, java.io.OutputStream os ) → boolean

Write a QDataSet as a das2 stream To test whether it looks like this code could stream a dataset use the canWrite() function. This function may be called multiple times to add additional data to the stream. If a compatible header has already been emitted for a particular dataset it is not re-sent.

Parameters

qds - The dataset to write, may have join's bundles etc. but no rank 3 or higher component datasets.
os - an open output stream, which is not closed by this code.

Returns:

true if the entire dataset could be written, false otherwise. IO failures do not return false, they throw. False simply means that this code does not know how (or can't) stream the given dataset. Since deeper inspection occurs when actually writing the data then when testing, false may be returned even if canWrite() returned true.

[search for examples] [view on GitHub] [view on old javadoc] [view source]