Package com.compomics.util.io.export
Class ExportWriter
java.lang.Object
com.compomics.util.io.export.ExportWriter
- Direct Known Subclasses:
ExcelWriter,TextWriter
The export writer will write the output in the desired export format.
- Author:
- Marc Vaudel
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ExportFormatThe format of the export.static final StringKey to store the last export folder. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a separator.abstract voidaddSeparator(WorkbookStyle textStyle) Adds a separator.abstract voidclose()Writes the content in cache and closes the connection to the file.abstract voidNotifies the writer that data of a lower hierarchical depth will be written, e.g.Returns the export of the format.static ExportWritergetExportWriter(ExportFormat exportFormat, File destinationFile, String separator, int nSeparationLines, boolean gzip) Returns an export writer for the desired format.abstract voidNotifies the writer that data of a higher hierarchical depth will be written, e.g.abstract voidnewLine()Adds a separator.voidStarts a new section.voidstartNewSection(String sectionTitle) Starts a new section.abstract voidstartNewSection(String sectionTitle, WorkbookStyle textStyle) Starts a new section.voidWrites text to the export.abstract voidwrite(String text, WorkbookStyle textStyle) Writes text to the export.voidwriteHeaderText(String text) Writes header text to the export.abstract voidwriteHeaderText(String text, WorkbookStyle textStyle) Writes header text to the export.voidwriteMainTitle(String text) Writes the main title.abstract voidwriteMainTitle(String text, WorkbookStyle textStyle) Writes the main title.
-
Field Details
-
LAST_FOLDER_KEY
Key to store the last export folder.- See Also:
-
exportFormat
The format of the export.
-
-
Constructor Details
-
ExportWriter
public ExportWriter()Empty default constructor.
-
-
Method Details
-
getExportFormat
Returns the export of the format.- Returns:
- the export of the format
-
write
Writes text to the export.- Parameters:
text- the text to write- Throws:
IOException- if an IOException occurs
-
write
Writes text to the export.- Parameters:
text- the text to writetextStyle- the style to use, overwrites any previous/default- Throws:
IOException- if an IOException occurs
-
writeMainTitle
Writes the main title.- Parameters:
text- the text to write- Throws:
IOException- if an IOException occurs
-
writeMainTitle
Writes the main title.- Parameters:
text- the text to writetextStyle- the style to use, overwrites any previous/default- Throws:
IOException- if an IOException occurs
-
startNewSection
Starts a new section.- Throws:
IOException- if an IOException occurs
-
startNewSection
Starts a new section.- Parameters:
sectionTitle- the text to write- Throws:
IOException- if an IOException occurs
-
startNewSection
public abstract void startNewSection(String sectionTitle, WorkbookStyle textStyle) throws IOException Starts a new section.- Parameters:
sectionTitle- the text to writetextStyle- the style to use, overwrites any previous/default- Throws:
IOException- if an IOException occurs
-
writeHeaderText
Writes header text to the export.- Parameters:
text- the text to write- Throws:
IOException- if an IOException occurs
-
writeHeaderText
Writes header text to the export.- Parameters:
text- the text to writetextStyle- the style to use, overwrites any previous/default- Throws:
IOException- if an IOException occurs
-
addSeparator
Adds a separator.- Throws:
IOException- if an IOException occurs
-
addSeparator
Adds a separator.- Parameters:
textStyle- the style to use, overwrites any previous/default- Throws:
IOException- if an IOException occurs
-
newLine
Adds a separator.- Throws:
IOException- if an IOException occurs
-
close
Writes the content in cache and closes the connection to the file.- Throws:
IOException- if an IOException occursFileNotFoundException- if a FileNotFoundException occurs
-
increaseDepth
public abstract void increaseDepth()Notifies the writer that data of a higher hierarchical depth will be written, e.g. going from protein to peptide. -
decreaseDepth
public abstract void decreaseDepth()Notifies the writer that data of a lower hierarchical depth will be written, e.g. going from peptide to protein. -
getExportWriter
public static ExportWriter getExportWriter(ExportFormat exportFormat, File destinationFile, String separator, int nSeparationLines, boolean gzip) throws IOException Returns an export writer for the desired format.- Parameters:
exportFormat- the export formatdestinationFile- the file where to write the exportseparator- the separator for a text exportnSeparationLines- the number of separation lines between two sections for a text exportgzip- if true export text as gzipped file- Returns:
- an export writer for the desired format
- Throws:
IOException- if an IOException occurs
-