Package org.orekit.files.ccsds.ndm.cdm
Class CdmMessageWriter
- java.lang.Object
-
- org.orekit.files.ccsds.ndm.cdm.CdmMessageWriter
-
- All Implemented Interfaces:
MessageWriter<CdmHeader,CdmSegment,Cdm>
- Direct Known Subclasses:
CdmWriter
public abstract class CdmMessageWriter extends Object implements MessageWriter<CdmHeader,CdmSegment,Cdm>
Cdm message writer.- Since:
- 11.2
- Author:
- Melina Vanel
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_ORIGINATOR
Default value forHeaderKey.ORIGINATOR
.
-
Constructor Summary
Constructors Constructor Description CdmMessageWriter(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, CdmHeader header)
Write header for the file.abstract void
writeRelativeMetadataContent(Generator generator, double formatVersion, CdmRelativeMetadata relativeMetadata)
Write RelativeMetadata part only once after header.void
writeSegment(Generator generator, CdmSegment segment)
Write one segment.abstract void
writeSegmentContent(Generator generator, double formatVersion, Segment<CdmMetadata,CdmData> 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
-
CdmMessageWriter
public CdmMessageWriter(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, CdmHeader header) throws IOException
Write header for the file.- Specified by:
writeHeader
in interfaceMessageWriter<CdmHeader,CdmSegment,Cdm>
- 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, CdmSegment segment) throws IOException
Write one segment.- Specified by:
writeSegment
in interfaceMessageWriter<CdmHeader,CdmSegment,Cdm>
- Parameters:
generator
- generator to use for producing outputsegment
- segment to write- Throws:
IOException
- if any buffer writing operations fails
-
writeRelativeMetadataContent
public abstract void writeRelativeMetadataContent(Generator generator, double formatVersion, CdmRelativeMetadata relativeMetadata) throws IOException
Write RelativeMetadata part only once after header.- Parameters:
generator
- generator to use for producing outputformatVersion
- format version to userelativeMetadata
- relative metadata to write- Throws:
IOException
- if any buffer writing operations fails
-
writeSegmentContent
public abstract void writeSegmentContent(Generator generator, double formatVersion, Segment<CdmMetadata,CdmData> 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<CdmHeader,CdmSegment,Cdm>
- 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<CdmHeader,CdmSegment,Cdm>
- Returns:
- root element for XML files
-
getFormatVersionKey
public String getFormatVersionKey()
Get key for format version.- Specified by:
getFormatVersionKey
in interfaceMessageWriter<CdmHeader,CdmSegment,Cdm>
- Returns:
- key for format version
-
getVersion
public double getVersion()
Get current format version.- Specified by:
getVersion
in interfaceMessageWriter<CdmHeader,CdmSegment,Cdm>
- Returns:
- current format version
-
-