de.jstacs.io
Class SparseStringExtractor

java.lang.Object
  extended by de.jstacs.io.AbstractStringExtractor
      extended by de.jstacs.io.SparseStringExtractor
All Implemented Interfaces:
Enumeration<String>

public class SparseStringExtractor
extends AbstractStringExtractor

This StringExtractor reads the Strings from a File as the user asks for the String. Instances of this class are sparse since they do not store an array of Strings internally.

Author:
Jens Keilwagen

Field Summary
protected  SequenceAnnotationParser annotationParser
          A parser for the sequence annotation.
 
Fields inherited from class de.jstacs.io.AbstractStringExtractor
annotation, FASTA, ignore, ignorePattern, USUALLY
 
Constructor Summary
SparseStringExtractor(File f)
          A constructor that reads the lines from a file.
SparseStringExtractor(File f, char ignore)
          A constructor that reads the lines from a file and ignores those starting with the comment character ignore.
SparseStringExtractor(File f, char ignore, String annotation, SequenceAnnotationParser parser)
          A constructor that reads the lines from a file, ignores those starting with the comment character ignore and sets the annotation of the source to annotation.
SparseStringExtractor(String fName)
          A constructor that reads the lines from a file.
SparseStringExtractor(String fName, char ignore)
          A constructor that reads the lines from a file and ignores those starting with the comment character ignore.
SparseStringExtractor(String fName, char ignore, SequenceAnnotationParser parser)
          A constructor that reads the lines from a file and ignores those starting with the comment character ignore.
SparseStringExtractor(String fName, char ignore, String annotation, SequenceAnnotationParser parser)
          A constructor that reads the lines from a file, ignores those starting with the comment character ignore and sets the annotation of the source to annotation.
SparseStringExtractor(String fName, SequenceAnnotationParser parser)
          A constructor that reads the lines from a file.
SparseStringExtractor(String fName, String annotation, SequenceAnnotationParser parser)
          A constructor that reads the lines from a file and sets the annotation of the source to annotation.
 
Method Summary
protected  void finalize()
           
 SequenceAnnotation[] getCurrentSequenceAnnotations()
          Returns the SequenceAnnotation or null if no SequenceAnnotation is available.
 boolean hasMoreElements()
           
 String nextElement()
           
 
Methods inherited from class de.jstacs.io.AbstractStringExtractor
getAnnotation
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

annotationParser

protected SequenceAnnotationParser annotationParser
A parser for the sequence annotation.

Constructor Detail

SparseStringExtractor

public SparseStringExtractor(String fName)
                      throws IOException,
                             FileNotFoundException
A constructor that reads the lines from a file.

Parameters:
fName - the name of the File to be read from
Throws:
IOException - if the File could not be read
FileNotFoundException - if the File could not be found
See Also:
SparseStringExtractor(String, char)

SparseStringExtractor

public SparseStringExtractor(File f)
                      throws IOException
A constructor that reads the lines from a file.

Parameters:
f - the File to be read from
Throws:
IOException - if the File could not be read
See Also:
SparseStringExtractor(File, char)

SparseStringExtractor

public SparseStringExtractor(String fName,
                             SequenceAnnotationParser parser)
                      throws IOException,
                             FileNotFoundException
A constructor that reads the lines from a file.

Parameters:
fName - the name of the File to be read from
parser - the SequenceAnnotationParser for the comment lines
Throws:
IOException - if the File could not be read
FileNotFoundException - if the File could not be found
See Also:
SparseStringExtractor(String, char, SequenceAnnotationParser)

SparseStringExtractor

public SparseStringExtractor(String fName,
                             char ignore)
                      throws IOException,
                             FileNotFoundException
A constructor that reads the lines from a file and ignores those starting with the comment character ignore.

Parameters:
fName - the name of the File to be read from
ignore - the first character of lines that should be treated as comments
Throws:
IOException - if the File could not be read
FileNotFoundException - if the File could not be found
See Also:
SparseStringExtractor(String, char, String, SequenceAnnotationParser)

SparseStringExtractor

public SparseStringExtractor(File f,
                             char ignore)
                      throws IOException
A constructor that reads the lines from a file and ignores those starting with the comment character ignore.

Parameters:
f - the File to be read from
ignore - the first character of lines that should be treated as comments
Throws:
IOException - if the File could not be read
See Also:
SparseStringExtractor(File, char, String, SequenceAnnotationParser)

SparseStringExtractor

public SparseStringExtractor(String fName,
                             char ignore,
                             SequenceAnnotationParser parser)
                      throws IOException,
                             FileNotFoundException
A constructor that reads the lines from a file and ignores those starting with the comment character ignore.

Parameters:
fName - the name of the File to be read from
ignore - the first character of lines that should be treated as comments
parser - the SequenceAnnotationParser for the comment lines
Throws:
IOException - if the File could not be read
FileNotFoundException - if the File could not be found
See Also:
SparseStringExtractor(String, char, String, SequenceAnnotationParser)

SparseStringExtractor

public SparseStringExtractor(String fName,
                             String annotation,
                             SequenceAnnotationParser parser)
                      throws IOException,
                             FileNotFoundException
A constructor that reads the lines from a file and sets the annotation of the source to annotation.

Parameters:
fName - the name of the File to be read from
annotation - the annotation for the source
parser - the SequenceAnnotationParser for the comment lines
Throws:
IOException - if the File could not be read
FileNotFoundException - if the File could not be found
See Also:
SparseStringExtractor(String, char, String, SequenceAnnotationParser)

SparseStringExtractor

public SparseStringExtractor(String fName,
                             char ignore,
                             String annotation,
                             SequenceAnnotationParser parser)
                      throws IOException,
                             FileNotFoundException
A constructor that reads the lines from a file, ignores those starting with the comment character ignore and sets the annotation of the source to annotation.

Parameters:
fName - the name of the File to be read from
ignore - the first character of lines that should be treated as comments
annotation - the annotation for the source
parser - the SequenceAnnotationParser for the comment lines
Throws:
IOException - if the File could not be read
FileNotFoundException - if the File could not be found
See Also:
AbstractStringExtractor.AbstractStringExtractor(char)

SparseStringExtractor

public SparseStringExtractor(File f,
                             char ignore,
                             String annotation,
                             SequenceAnnotationParser parser)
                      throws IOException
A constructor that reads the lines from a file, ignores those starting with the comment character ignore and sets the annotation of the source to annotation.

Parameters:
f - the File to be read from
ignore - the first character of lines that should be treated as comments
annotation - the annotation for the source
parser - the SequenceAnnotationParser for the comment lines
Throws:
IOException - if the File could not be read
Method Detail

hasMoreElements

public boolean hasMoreElements()

nextElement

public String nextElement()

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

getCurrentSequenceAnnotations

public SequenceAnnotation[] getCurrentSequenceAnnotations()
Description copied from class: AbstractStringExtractor
Returns the SequenceAnnotation or null if no SequenceAnnotation is available.

Overrides:
getCurrentSequenceAnnotations in class AbstractStringExtractor
Returns:
the SequenceAnnotation or null if no SequenceAnnotation is available.