Class TextWriter
java.lang.Object
com.compomics.util.io.export.ExportWriter
com.compomics.util.io.export.writers.TextWriter
public class TextWriter extends ExportWriter
ExportWriter for the export to text files.
- Author:
- Marc Vaudel
-
Field Summary
-
Constructor Summary
Constructors Constructor Description TextWriter()
Empty default constructorTextWriter(File destinationFile, String separator, int nSeparationLines, boolean gzip)
Constructor. -
Method Summary
Modifier and Type Method Description void
addSeparator(WorkbookStyle textStyle)
Adds a separator.void
close()
Writes the content in cache and closes the connection to the file.void
decreseDepth()
Notifies the writer that data of a lower hierarchical depth will be written, e.g.void
increaseDepth()
Notifies the writer that data of a higher hierarchical depth will be written, e.g.void
newLine()
Adds a separator.void
startNewSection(String sectionTitle, WorkbookStyle textStyle)
Starts a new section.void
write(String text, WorkbookStyle textStyle)
Writes text to the export.void
writeHeaderText(String text, WorkbookStyle textStyle)
Writes header text to the export.void
writeMainTitle(String text, WorkbookStyle textStyle)
Writes the main title.Methods inherited from class com.compomics.util.io.export.ExportWriter
addSeparator, getExportFormat, getExportWriter, startNewSection, startNewSection, write, writeHeaderText, writeMainTitle
-
Constructor Details
-
TextWriter
public TextWriter()Empty default constructor -
TextWriter
public TextWriter(File destinationFile, String separator, int nSeparationLines, boolean gzip) throws IOExceptionConstructor.- Parameters:
destinationFile
- the file where to write the reportseparator
- separator between two valuesnSeparationLines
- the number of lines to include between two sectionsgzip
- if true export as gzipped file- Throws:
IOException
- if an IOException occurs
-
-
Method Details
-
write
Description copied from class:ExportWriter
Writes text to the export.- Specified by:
write
in classExportWriter
- Parameters:
text
- the text to writetextStyle
- the style to use, overwrites any previous/default- Throws:
IOException
- if an IOException occurs
-
writeMainTitle
Description copied from class:ExportWriter
Writes the main title.- Specified by:
writeMainTitle
in classExportWriter
- Parameters:
text
- the text to writetextStyle
- the style to use, overwrites any previous/default- Throws:
IOException
- if an IOException occurs
-
startNewSection
Description copied from class:ExportWriter
Starts a new section.- Specified by:
startNewSection
in classExportWriter
- Parameters:
sectionTitle
- the text to writetextStyle
- the style to use, overwrites any previous/default- Throws:
IOException
- if an IOException occurs
-
writeHeaderText
Description copied from class:ExportWriter
Writes header text to the export.- Specified by:
writeHeaderText
in classExportWriter
- Parameters:
text
- the text to writetextStyle
- the style to use, overwrites any previous/default- Throws:
IOException
- if an IOException occurs
-
addSeparator
Description copied from class:ExportWriter
Adds a separator.- Specified by:
addSeparator
in classExportWriter
- Parameters:
textStyle
- the style to use, overwrites any previous/default- Throws:
IOException
- if an IOException occurs
-
newLine
Description copied from class:ExportWriter
Adds a separator.- Specified by:
newLine
in classExportWriter
- Throws:
IOException
- if an IOException occurs
-
close
Description copied from class:ExportWriter
Writes the content in cache and closes the connection to the file.- Specified by:
close
in classExportWriter
- Throws:
IOException
- if an IOException occursFileNotFoundException
- if a FileNotFoundException occurs
-
increaseDepth
public void increaseDepth()Description copied from class:ExportWriter
Notifies the writer that data of a higher hierarchical depth will be written, e.g. going from protein to peptide.- Specified by:
increaseDepth
in classExportWriter
-
decreseDepth
public void decreseDepth()Description copied from class:ExportWriter
Notifies the writer that data of a lower hierarchical depth will be written, e.g. going from peptide to protein.- Specified by:
decreseDepth
in classExportWriter
-