Package org.orekit.files.rinex.utils
Class BaseRinexWriter<T extends RinexBaseHeader>
- java.lang.Object
-
- org.orekit.files.rinex.utils.BaseRinexWriter<T>
-
- Type Parameters:
T- type of the header
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
RinexClockWriter,RinexNavigationWriter,RinexObservationWriter
public abstract class BaseRinexWriter<T extends RinexBaseHeader> extends Object implements AutoCloseable
Base write for Rinex files.- Since:
- 14.0
- Author:
- Luc Maisonobe
-
-
Field Summary
Fields Modifier and Type Field Description static FastLongFormatterFOUR_DIGITS_INTEGERFormat for one 4 digits integer field.static FastDoubleFormatterNINE_TWO_DIGITS_FLOATFormat for one 9.2 digits float field.static FastDoubleFormatterNINETEEN_SCIENTIFIC_FLOATFormat for one 19 characters wide field in scientific notation.static FastLongFormatterPADDED_FOUR_DIGITS_INTEGERFormat for one 4 digits integer field.static FastLongFormatterPADDED_TWO_DIGITS_INTEGERFormat for one 2 digits integer field.static FastLongFormatterSIX_DIGITS_INTEGERFormat for one 6 digits integer field.static FastLongFormatterTHREE_DIGITS_INTEGERFormat for one 3 digits integer field.static FastLongFormatterTWO_DIGITS_INTEGERFormat for one 2 digits integer field.
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseRinexWriter(Appendable output, String outputName)Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckHeaderWritten()Check header has been written.voidclose()protected booleanexceedsHeaderLength(int tentative)Check if column exceeds header line length.protected voidfinishHeaderLine(Label label)Finish one header line.voidfinishLine()Finish one line.protected intgetColumn()Get column number.protected TgetHeader()Get the header.voidoutputField(char c, int next)Output one single character field.voidoutputField(String field, int next, boolean leftJustified)Output one field.voidoutputField(FastDoubleFormatter formatter, double value, int next)Output one double field.voidoutputField(FastLongFormatter formatter, int value, int next)Output one integer field.voidoutputField(FastLongFormatter formatter, long value, int next)Output one long integer field.voidprepareComments(List<RinexComment> comments)Prepare comments to be emitted at specified lines.protected voidwriteHeader(T header, int labelIndex)Write header.protected voidwriteHeaderLine(String s, Label label)Write one header string.protected voidwriteProgramRunByDate(RinexBaseHeader header)Write the PGM / RUN BY / DATE header line.
-
-
-
Field Detail
-
TWO_DIGITS_INTEGER
public static final FastLongFormatter TWO_DIGITS_INTEGER
Format for one 2 digits integer field.
-
PADDED_TWO_DIGITS_INTEGER
public static final FastLongFormatter PADDED_TWO_DIGITS_INTEGER
Format for one 2 digits integer field.
-
THREE_DIGITS_INTEGER
public static final FastLongFormatter THREE_DIGITS_INTEGER
Format for one 3 digits integer field.
-
FOUR_DIGITS_INTEGER
public static final FastLongFormatter FOUR_DIGITS_INTEGER
Format for one 4 digits integer field.
-
PADDED_FOUR_DIGITS_INTEGER
public static final FastLongFormatter PADDED_FOUR_DIGITS_INTEGER
Format for one 4 digits integer field.
-
SIX_DIGITS_INTEGER
public static final FastLongFormatter SIX_DIGITS_INTEGER
Format for one 6 digits integer field.
-
NINE_TWO_DIGITS_FLOAT
public static final FastDoubleFormatter NINE_TWO_DIGITS_FLOAT
Format for one 9.2 digits float field.
-
NINETEEN_SCIENTIFIC_FLOAT
public static final FastDoubleFormatter NINETEEN_SCIENTIFIC_FLOAT
Format for one 19 characters wide field in scientific notation.
-
-
Constructor Detail
-
BaseRinexWriter
protected BaseRinexWriter(Appendable output, String outputName)
Simple constructor.- Parameters:
output- destination of generated outputoutputName- output name for error messages
-
-
Method Detail
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-
prepareComments
public void prepareComments(List<RinexComment> comments)
Prepare comments to be emitted at specified lines.- Parameters:
comments- comments to be emitted
-
writeHeader
protected void writeHeader(T header, int labelIndex) throws IOException
Write header.- Parameters:
header- header to writelabelIndex- index of the label in header- Throws:
IOException- if an I/O error occurs.
-
getHeader
protected T getHeader()
Get the header.- Returns:
- header
-
getColumn
protected int getColumn()
Get column number.- Returns:
- column number
-
finishHeaderLine
protected void finishHeaderLine(Label label) throws IOException
Finish one header line.- Parameters:
label- line label- Throws:
IOException- if an I/O error occurs.
-
finishLine
public void finishLine() throws IOExceptionFinish one line.- Throws:
IOException- if an I/O error occurs.
-
writeHeaderLine
protected void writeHeaderLine(String s, Label label) throws IOException
Write one header string.- Parameters:
s- string data (may be null)label- line label- Throws:
IOException- if an I/O error occurs.
-
checkHeaderWritten
protected void checkHeaderWritten()
Check header has been written.
-
exceedsHeaderLength
protected boolean exceedsHeaderLength(int tentative)
Check if column exceeds header line length.- Parameters:
tentative- tentative column number- Returns:
- true if tentative column number exceeds header line length
-
writeProgramRunByDate
protected void writeProgramRunByDate(RinexBaseHeader header) throws IOException
Write the PGM / RUN BY / DATE header line.- Parameters:
header- header to write- Throws:
IOException- if an I/O error occurs.
-
outputField
public void outputField(char c, int next) throws IOExceptionOutput one single character field.- Parameters:
c- field valuenext- target column for next field- Throws:
IOException- if an I/O error occurs.
-
outputField
public void outputField(FastLongFormatter formatter, int value, int next) throws IOException
Output one integer field.- Parameters:
formatter- formatter to usevalue- field valuenext- target column for next field- Throws:
IOException- if an I/O error occurs.
-
outputField
public void outputField(FastLongFormatter formatter, long value, int next) throws IOException
Output one long integer field.- Parameters:
formatter- formatter to usevalue- field valuenext- target column for next field- Throws:
IOException- if an I/O error occurs.
-
outputField
public void outputField(FastDoubleFormatter formatter, double value, int next) throws IOException
Output one double field.- Parameters:
formatter- formatter to usevalue- field valuenext- target column for next field- Throws:
IOException- if an I/O error occurs.
-
outputField
public void outputField(String field, int next, boolean leftJustified) throws IOException
Output one field.- Parameters:
field- field to outputnext- target column for next fieldleftJustified- if true, field is left-justified- Throws:
IOException- if an I/O error occurs.
-
-