Class CPFWriter

  • All Implemented Interfaces:
    EphemerisFileWriter

    public class CPFWriter
    extends Object
    implements EphemerisFileWriter
    An CPF Writer class that can take in a general EphemerisFile object and export it as a valid CPF file.

    It supports both 1.0 and 2.0 versions

    Note: By default, only required header keys are wrote (H1 and H2). Furthermore, only position data can be written. Other keys (i.e. in header and other types of ephemeris entries) are simply ignored. Contributions are welcome to support more fields in the format.

    Since:
    10.3
    Author:
    Bryan Cazabonne
    See Also:
    1.0 file format, 2.0 file format
    • Constructor Detail

      • CPFWriter

        public CPFWriter​(CPFHeader header,
                         TimeScale timescale,
                         boolean velocityFlag)
        Constructor.
        Parameters:
        header - container for header data
        timescale - time scale for dates
        velocityFlag - true if velocity must be written
        Since:
        11.2
    • Method Detail

      • write

        public <C extends TimeStampedPVCoordinates,​S extends EphemerisFile.EphemerisSegment<C>> void write​(Appendable writer,
                                                                                                                 EphemerisFile<C,​S> ephemerisFile)
                                                                                                          throws IOException
        Write the passed in EphemerisFile using the passed in Appendable.
        Specified by:
        write in interface EphemerisFileWriter
        Type Parameters:
        C - type of the Cartesian coordinates
        S - type of the segment
        Parameters:
        writer - a configured Appendable to feed with text
        ephemerisFile - a populated ephemeris file to serialize into the buffer
        Throws:
        IOException - if any buffer writing operations fail or if the underlying format doesn't support a configuration in the EphemerisFile (for example having multiple satellites in one file, having the origin at an unspecified celestial body, etc.)