Class DAFWriter


  • public class DAFWriter
    extends Object
    Writer for generic DAF binary files. Note that this class is not thread-safe since it uses an internal buffer.
    Since:
    14.0
    Author:
    Rafael Ayala
    • Constructor Detail

      • DAFWriter

        public DAFWriter​(boolean bigEndian)
        Basic constructor to set up endianness.
        Parameters:
        bigEndian - flag indicating if the writer should use big endianness
      • DAFWriter

        public DAFWriter()
        Basic constructor with default little endianness (bigEndian flag set to false).
    • Method Detail

      • write

        public void write​(DataOutputStream dos,
                          DAF daf)
                   throws IOException
        Write a full DAF object to the stream. This method handles multiple summaries per summary record as SPICE does, with the corresponding multiple names per name record, record linking through control words and calculation of data records and data addresses for each data array. Data is written contiguously (like CSPICE) without padding between arrays, only padding at the end of the data records for a given batch. For example, if we have a summary record with 20 summaries, and each array has 1500 doubles, then we will have the following structure: - Summary record with 20 summaries - Name record with 20 names - Data records for arrays 1 to 20, each with 1500 doubles, written contiguously Since each data record can contain up to 128 doubles, this means we will have as many data records as needed to store all 20 arrays contiguously. So a total of 20 * 1500 = 30000 doubles, 30000 / 128 = 235 data records (round up) The last data record will be padded with null bytes after the last double of array 20. Note that this method is not thread-safe since it uses an internal buffer.
        Parameters:
        dos - data output stream to write to
        daf - the DAF object to write
        Throws:
        IOException - if an I/O error occurs