Package org.biojava.bio.chromatogram
Class ChromatogramFactory
- java.lang.Object
-
- org.biojava.bio.chromatogram.ChromatogramFactory
-
public class ChromatogramFactory extends java.lang.ObjectA factory that createsChromatogramobjects from files or streams. In either case, the type of object to create is determined from the first four bytes of the stream (the magic number).- Since:
- 1.3
- Author:
- Rhett Sutphin (UI CBCB), Matthew Pocock
-
-
Constructor Summary
Constructors Constructor Description ChromatogramFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Chromatogramcreate(java.io.File f)Creates a newChromatogramobject from the named file.static Chromatogramcreate(java.io.InputStream in)Creates a newChromatogramobject from the supplied stream.
-
-
-
Field Detail
-
SCF_MAGIC
public static final int SCF_MAGIC
The magic number for SCF files.- See Also:
- Constant Field Values
-
ABI_MAGIC
public static final int ABI_MAGIC
The magic number for ABIF files.- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public static Chromatogram create(java.io.File f) throws java.io.IOException, UnsupportedChromatogramFormatException
Creates a newChromatogramobject from the named file.- Parameters:
f- the file to read- Returns:
- a new Chromatogram
- Throws:
java.io.IOException- when the file can't be read or some other I/O error occursUnsupportedChromatogramFormatException- when the file doesn't contain a chromatogram in a supported format
-
create
public static Chromatogram create(java.io.InputStream in) throws java.io.IOException, UnsupportedChromatogramFormatException
Creates a newChromatogramobject from the supplied stream. Note that for some chromatogram formats, this can be much more memory-intensive than reading from a file.Note also that if the provided stream is a
CachingInputStream, it will be seeked back to 0 before being passed to the parser. This is because the parsers that useCachingInputStreamassume that the "file" starts at 0.- Parameters:
in- the stream from which to read the chromatogram.- Returns:
- a new Chromatogram
- Throws:
java.io.IOException- when there's a problem with the streamUnsupportedChromatogramFormatException- when the file doesn't contain a chromatogram in a supported format
-
-