Class IIRVFileWriter

  • All Implemented Interfaces:
    EphemerisFileWriter

    public class IIRVFileWriter
    extends Object
    implements EphemerisFileWriter
    An EphemerisFileWriter for generating IIRV files.

    This class uses an inputted IIRVBuilder object to define the message metadata values that comprise an IIRV message.

    This class can be used to write a list of TimeStampedPVCoordinates as an IIRV file as follows:

    
    
     // 1. Create an IIRVBuilder class to define the spacecraft/mission metadata values
     IIRVBuilder iirvBuilder = new IIRVBuilder(TimeScalesFactory.getUTC());
     iirvBuilder.setSupportIdCode(1221);
     iirvBuilder.setDragCoefficient(2.2);
     iirvBuilder.setOriginIdentification(OriginIdentificationTerm.GSFC);
     iirvBuilder.setRoutingIndicator("MANY");
     // ... (additional fields here)
    
     // 2. Create an IIRVFileWriter with the builder object
     IIRVFileWriter writer = new IIRVFileWriter(iirvBuilder, IIRVMessage.IncludeMessageMetadata.ALL_VECTORS);
    
     // 3. Generate an IIRVEphemerisFile containing the ephemeris data
     IIRVEphemerisFile iirvFile = iirvBuilder.buildEphemerisFile(coordinates);
    
     // 4. Write to disk. Recommendation: embed the start year in the filename (year does not appear in the IIRV itself)
     String testFilename = "TestSatellite" + "_" +
          iirvFile.getStartYear() + "_" +
          iirvFile.getIIRV().get(0).getDayOfYear().toEncodedString() + "_" +
          iirvFile.getIIRV().get(0).getVectorEpoch().toEncodedString() + ".iirv";
     writer.write(testFilename, iirvFile);
      
     
    Since:
    13.0
    Author:
    Nick LaFarge
    See Also:
    StreamingIIRVFileWriter, IIRVMessage
    • Constructor Detail

      • IIRVFileWriter

        public IIRVFileWriter​(IIRVBuilder builder,
                              IIRVMessage.IncludeMessageMetadata includeMessageMetadataSetting)
        Constructor.
        Parameters:
        builder - Builder class for IIRV
        includeMessageMetadataSetting - Setting for when message metadata terms appear in the created IIRV message
    • 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.)