peakml.io.peakml
Class PeakMLWriter

java.lang.Object
  extended by peakml.io.peakml.PeakMLWriter

public class PeakMLWriter
extends java.lang.Object

Central class for writing PeakML type files. All access to the writer is handled with static access functions, so no instance should be made (and indeed can be made, as the default constructor is hidden). As a rule each write-function can be plugged with a WriterProgressListener) instance, which is used to update on the progress of writing.

The parser defines specialized access functions to write PeakML files filled with only a single IPeak subclass (e.g. writeCentroids(Header, Vector, WriterProgressListener, OutputStream, String)). When a mix-model is required or it is unknown which types of peaks are contained in the vector of peaks to be written, the generic function write(Header, Vector, WriterProgressListener, OutputStream, String)) can be used. This method determines the type of each peak and writes it to the file accordingly.


Method Summary
static void write(Header header, java.util.Vector<? extends IPeak> peaks, WriterProgressListener listener, java.io.OutputStream out, java.lang.String stylesheet)
          Generic method for writing a set of IPeak elements (the real class unknown).
static void writeBackgroundIons(Header header, java.util.Vector<BackgroundIon<? extends Peak>> backgroundions, WriterProgressListener listener, java.io.OutputStream out, java.lang.String stylesheet)
          Method for writing a set of BackgroundIon peaks to a PeakML file.
static void writeCentroids(Header header, java.util.Vector<Centroid> peaks, WriterProgressListener listener, java.io.OutputStream out, java.lang.String stylesheet)
          Method for writing a set of Centroid peaks to a PeakML file.
static void writeIPeakSets(Header header, java.util.Vector<IPeakSet<IPeak>> peaksets, WriterProgressListener listener, java.io.OutputStream out, java.lang.String stylesheet)
          Method for writing a set of IPeakSet peaks to a PeakML file.
static void writeMassChromatograms(Header header, java.util.Vector<MassChromatogram<? extends Peak>> masschromatograms, WriterProgressListener listener, java.io.OutputStream out, java.lang.String stylesheet)
          Method for writing a set of MassChromatogram peaks to a PeakML file.
static void writePeaks(Header header, java.util.Vector<Peak> peaks, WriterProgressListener listener, java.io.OutputStream out, java.lang.String stylesheet)
          Generic method for writing a set of IPeak elements (the real class unknown).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

write

public static void write(Header header,
                         java.util.Vector<? extends IPeak> peaks,
                         WriterProgressListener listener,
                         java.io.OutputStream out,
                         java.lang.String stylesheet)
                  throws java.io.IOException
Generic method for writing a set of IPeak elements (the real class unknown). The method will find out for each element its real type and write the data accordingly.

Parameters:
header - The header to be written to the file.
peaks - The peaks to be written to the file.
listener - The listener for tracking the progress of the write-process.
out - The output-stream to write to.
stylesheet - The stylesheet to include (filename, can be null).
Throws:
java.io.IOException - Thrown when an I/O error is encountered.

writePeaks

public static void writePeaks(Header header,
                              java.util.Vector<Peak> peaks,
                              WriterProgressListener listener,
                              java.io.OutputStream out,
                              java.lang.String stylesheet)
                       throws java.io.IOException
Generic method for writing a set of IPeak elements (the real class unknown). The method will find out for each element its real type and write the data accordingly.

Parameters:
header - The header to be written to the file.
peaks - The peaks to be written to the file.
listener - The listener for tracking the progress of the write-process.
out - The output-stream to write to.
stylesheet - The stylesheet to include (filename, can be null).
Throws:
java.io.IOException - Thrown when an I/O error is encountered.

writeCentroids

public static void writeCentroids(Header header,
                                  java.util.Vector<Centroid> peaks,
                                  WriterProgressListener listener,
                                  java.io.OutputStream out,
                                  java.lang.String stylesheet)
                           throws java.io.IOException
Method for writing a set of Centroid peaks to a PeakML file.

Parameters:
header - The header to be written to the file.
peaks - The peaks to be written to the file.
listener - The listener for tracking the progress of the write-process.
out - The output-stream to write to.
stylesheet - The stylesheet to include (filename, can be null).
Throws:
java.io.IOException - Thrown when an I/O error is encountered.

writeMassChromatograms

public static void writeMassChromatograms(Header header,
                                          java.util.Vector<MassChromatogram<? extends Peak>> masschromatograms,
                                          WriterProgressListener listener,
                                          java.io.OutputStream out,
                                          java.lang.String stylesheet)
                                   throws java.io.IOException
Method for writing a set of MassChromatogram peaks to a PeakML file.

Parameters:
header - The header to be written to the file.
masschromatograms - The peaks to be written to the file.
listener - The listener for tracking the progress of the write-process.
out - The output-stream to write to.
stylesheet - The stylesheet to include (filename, can be null).
Throws:
java.io.IOException - Thrown when an I/O error is encountered.

writeBackgroundIons

public static void writeBackgroundIons(Header header,
                                       java.util.Vector<BackgroundIon<? extends Peak>> backgroundions,
                                       WriterProgressListener listener,
                                       java.io.OutputStream out,
                                       java.lang.String stylesheet)
                                throws java.io.IOException
Method for writing a set of BackgroundIon peaks to a PeakML file.

Parameters:
header - The header to be written to the file.
backgroundions - The peaks to be written to the file.
listener - The listener for tracking the progress of the write-process.
out - The output-stream to write to.
stylesheet - The stylesheet to include (filename, can be null).
Throws:
java.io.IOException - Thrown when an I/O error is encountered.

writeIPeakSets

public static void writeIPeakSets(Header header,
                                  java.util.Vector<IPeakSet<IPeak>> peaksets,
                                  WriterProgressListener listener,
                                  java.io.OutputStream out,
                                  java.lang.String stylesheet)
                           throws java.io.IOException
Method for writing a set of IPeakSet peaks to a PeakML file.

Parameters:
header - The header to be written to the file.
peaksets - The peaks to be written to the file.
listener - The listener for tracking the progress of the write-process.
out - The output-stream to write to.
stylesheet - The stylesheet to include (filename, can be null).
Throws:
java.io.IOException - Thrown when an I/O error is encountered.