Class AbstractMessageWriter<H extends Header,S extends Segment<?,?>,F extends NdmConstituent<H,S>>
- java.lang.Object
-
- org.orekit.files.ccsds.utils.generation.AbstractMessageWriter<H,S,F>
-
- Type Parameters:
H
- type of the headerS
- type of the segmentsF
- type of the NDM constituent
- All Implemented Interfaces:
MessageWriter<H,S,F>
- Direct Known Subclasses:
AcmWriter
,AemWriter
,ApmWriter
,OcmWriter
,OemWriter
,OmmWriter
,OpmWriter
,TdmWriter
public abstract class AbstractMessageWriter<H extends Header,S extends Segment<?,?>,F extends NdmConstituent<H,S>> extends Object implements MessageWriter<H,S,F>
Base class for Navigation Data Message (NDM) files.- Since:
- 11.0
- Author:
- Luc Maisonobe
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_ORIGINATOR
Default value forHeaderKey.ORIGINATOR
.
-
Constructor Summary
Constructors Constructor Description AbstractMessageWriter(String root, String formatVersionKey, double defaultVersion, ContextBinding context)
Constructor used to create a new NDM writer configured with the necessary parameters to successfully fill in all required fields that aren't part of a standard object.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ContextBinding
getContext()
Get the current context.double
getDefaultVersion()
Get the default format version.String
getFormatVersionKey()
Get key for format version.String
getRoot()
Get root element for XML files.TimeConverter
getTimeConverter()
Get the current time converter.double
getVersion()
Get current format version.void
setContext(ContextBinding context)
Reset context binding.void
writeFooter(Generator generator)
Write footer for the file.void
writeHeader(Generator generator, H header)
Write header for the file.void
writeSegment(Generator generator, S segment)
Write one segment.protected abstract void
writeSegmentContent(Generator generator, double formatVersion, S segment)
Write one segment content (without XML wrapping).-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.orekit.files.ccsds.utils.generation.MessageWriter
writeMessage
-
-
-
-
Field Detail
-
DEFAULT_ORIGINATOR
public static final String DEFAULT_ORIGINATOR
Default value forHeaderKey.ORIGINATOR
.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractMessageWriter
public AbstractMessageWriter(String root, String formatVersionKey, double defaultVersion, ContextBinding context)
Constructor used to create a new NDM writer configured with the necessary parameters to successfully fill in all required fields that aren't part of a standard object.If creation date and originator are not present in header, built-in defaults will be used
- Parameters:
root
- root element for XML filesformatVersionKey
- key for format versiondefaultVersion
- default format versioncontext
- context binding (may be reset for each segment)
-
-
Method Detail
-
setContext
public void setContext(ContextBinding context)
Reset context binding.- Parameters:
context
- context binding to use
-
getContext
public ContextBinding getContext()
Get the current context.- Returns:
- current context
-
getTimeConverter
public TimeConverter getTimeConverter()
Get the current time converter.- Returns:
- current time converter
-
getDefaultVersion
public double getDefaultVersion()
Get the default format version.- Returns:
- default format version
-
writeHeader
public void writeHeader(Generator generator, H header) throws IOException
Write header for the file.- Specified by:
writeHeader
in interfaceMessageWriter<H extends Header,S extends Segment<?,?>,F extends NdmConstituent<H,S>>
- Parameters:
generator
- generator to use for producing outputheader
- header to write (creation date and originator will be added if missing)- Throws:
IOException
- if the stream cannot write to stream
-
writeSegment
public void writeSegment(Generator generator, S segment) throws IOException
Write one segment.- Specified by:
writeSegment
in interfaceMessageWriter<H extends Header,S extends Segment<?,?>,F extends NdmConstituent<H,S>>
- Parameters:
generator
- generator to use for producing outputsegment
- segment to write- Throws:
IOException
- if any buffer writing operations fails
-
writeSegmentContent
protected abstract void writeSegmentContent(Generator generator, double formatVersion, S segment) throws IOException
Write one segment content (without XML wrapping).- Parameters:
generator
- generator to use for producing outputformatVersion
- format version to usesegment
- segment to write- Throws:
IOException
- if any buffer writing operations fails
-
writeFooter
public void writeFooter(Generator generator) throws IOException
Write footer for the file.- Specified by:
writeFooter
in interfaceMessageWriter<H extends Header,S extends Segment<?,?>,F extends NdmConstituent<H,S>>
- Parameters:
generator
- generator to use for producing output- Throws:
IOException
- if the stream cannot write to stream
-
getRoot
public String getRoot()
Get root element for XML files.- Specified by:
getRoot
in interfaceMessageWriter<H extends Header,S extends Segment<?,?>,F extends NdmConstituent<H,S>>
- Returns:
- root element for XML files
-
getFormatVersionKey
public String getFormatVersionKey()
Get key for format version.- Specified by:
getFormatVersionKey
in interfaceMessageWriter<H extends Header,S extends Segment<?,?>,F extends NdmConstituent<H,S>>
- Returns:
- key for format version
-
getVersion
public double getVersion()
Get current format version.- Specified by:
getVersion
in interfaceMessageWriter<H extends Header,S extends Segment<?,?>,F extends NdmConstituent<H,S>>
- Returns:
- current format version
-
-