public abstract class CdmMessageWriter extends Object implements MessageWriter<CdmHeader,CdmSegment,Cdm>
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ORIGINATOR
Default value for
HeaderKey.ORIGINATOR . |
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
ContextBinding |
getContext()
Get the current context.
|
double |
getDefaultVersion()
Get the default format version.
|
TimeConverter |
getTimeConverter()
Get the current time converter.
|
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).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
writeMessage
public static final String DEFAULT_ORIGINATOR
HeaderKey.ORIGINATOR
.public CdmMessageWriter(String root, String formatVersionKey, double defaultVersion, ContextBinding context)
If creation date and originator are not present in header, built-in defaults will be used
root
- root element for XML filesformatVersionKey
- key for format versiondefaultVersion
- default format versioncontext
- context binding (may be reset for each segment)public void setContext(ContextBinding context)
context
- context binding to usepublic ContextBinding getContext()
public TimeConverter getTimeConverter()
public double getDefaultVersion()
public void writeHeader(Generator generator, CdmHeader header) throws IOException
writeHeader
in interface MessageWriter<CdmHeader,CdmSegment,Cdm>
generator
- generator to use for producing outputheader
- header to write (creation date and originator will be added if missing)IOException
- if the stream cannot write to streampublic void writeSegment(Generator generator, CdmSegment segment) throws IOException
writeSegment
in interface MessageWriter<CdmHeader,CdmSegment,Cdm>
generator
- generator to use for producing outputsegment
- segment to writeIOException
- if any buffer writing operations failspublic abstract void writeRelativeMetadataContent(Generator generator, double formatVersion, CdmRelativeMetadata relativeMetadata) throws IOException
generator
- generator to use for producing outputformatVersion
- format version to userelativeMetadata
- relative metadata to writeIOException
- if any buffer writing operations failspublic abstract void writeSegmentContent(Generator generator, double formatVersion, Segment<CdmMetadata,CdmData> segment) throws IOException
generator
- generator to use for producing outputformatVersion
- format version to usesegment
- segment to writeIOException
- if any buffer writing operations failspublic void writeFooter(Generator generator) throws IOException
writeFooter
in interface MessageWriter<CdmHeader,CdmSegment,Cdm>
generator
- generator to use for producing outputIOException
- if the stream cannot write to streamCopyright © 2002-2022 CS GROUP. All rights reserved.