RichStreamReader (BioJava-1.5-beta API)
Keywords: org.biojavax.bio.seq.io.RichStreamReader class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.biojavax.bio.seq.io
Class RichStreamReader

    java.lang.Object
      org.biojavax.bio.seq.io.RichStreamReader

All Implemented Interfaces:
  SequenceIterator, BioEntryIterator, RichSequenceIterator

    public class RichStreamReader

extends Object
implements RichSequenceIterator

Parses a stream into sequences. This object implements SequenceIterator, so you can loop over each sequence produced. It consumes a stream, and uses a SequenceFormat to extract each sequence from the stream. It is assumed that the stream contains sequences that can be handled by the one format, and that they are not seperated other than by delimiters that the format can handle. Sequences are instantiated when they are requested by nextSequence, not before, so it is safe to use this object to parse a gigabyte fasta file, and do sequence-by-sequence processing, while being guaranteed that RichStreamReader will not require you to keep any of the sequences in memory.

Since:
  1.5
Author:
  Matthew Pocock, Thomas Down, Richard Holland

Constructor Summary
`RichStreamReader(BufferedReader reader, RichSequenceFormat format, SymbolTokenization symParser, RichSequenceBuilderFactory sf, Namespace ns)` Creates a new stream reader on the given reader, which will attempt to read sequences in the given format, having symbols from the given tokenization, and pass them to the given factory to be transformed into RichSequence objects in the given namespace.
`RichStreamReader(InputStream is, RichSequenceFormat format, SymbolTokenization symParser, RichSequenceBuilderFactory sf, Namespace ns)` Creates a new stream reader on the given input stream, which will attempt to read sequences in the given format, having symbols from the given tokenization, and pass them to the given factory to be transformed into RichSequence objects in the given namespace.

Method Summary
`boolean` | `hasNext()` Returns whether there are more sequences to iterate over.
`BioEntry` | `nextBioEntry()`
`RichSequence` | `nextRichSequence()`
`Sequence` | `nextSequence()` Returns the next sequence in the iterator.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RichStreamReader

    public RichStreamReader(InputStream is,
                            RichSequenceFormat format,
                            SymbolTokenization symParser,
                            RichSequenceBuilderFactory sf,
                            Namespace ns)

  Creates a new stream reader on the given input stream, which will attempt to read sequences in the given format, having symbols from the given tokenization, and pass them to the given factory to be transformed into RichSequence objects in the given namespace.

  Parameters:
    `is` - the input stream to read from
    `format` - the input file format
    `symParser` - the tokenizer that understands the sequence symbols in the file
    `sf` - the factory that will build the sequences
    `ns` - the namespace the sequences will be loaded into.

### RichStreamReader

    public RichStreamReader(BufferedReader reader,
                            RichSequenceFormat format,
                            SymbolTokenization symParser,
                            RichSequenceBuilderFactory sf,
                            Namespace ns)

  Creates a new stream reader on the given reader, which will attempt to read sequences in the given format, having symbols from the given tokenization, and pass them to the given factory to be transformed into RichSequence objects in the given namespace.

  Parameters:
    `reader` - the reader to read from
    `format` - the input file format
    `symParser` - the tokenizer that understands the sequence symbols in the file
    `sf` - the factory that will build the sequences
    `ns` - the namespace the sequences will be loaded into.

Method Detail

### nextSequence

    public Sequence nextSequence()
                          throws NoSuchElementException,
                                 BioException

  Returns the next sequence in the iterator.

  Specified by:
    `nextSequence` in interface `SequenceIterator`
  Returns:
    the next Sequence
  Throws:
    `NoSuchElementException` - if you call nextSequence when hasNext returns false
    `BioException` - if for any reason the sequence could not be retrieved

### nextBioEntry

    public BioEntry nextBioEntry()
                          throws NoSuchElementException,
                                 BioException

  Specified by:
    `nextBioEntry` in interface `BioEntryIterator`
  Throws:
    `NoSuchElementException`
    `BioException`

### nextRichSequence

    public RichSequence nextRichSequence()
                                  throws NoSuchElementException,
                                         BioException

  Specified by:
    `nextRichSequence` in interface `RichSequenceIterator`
  Throws:
    `NoSuchElementException`
    `BioException`

### hasNext

    public boolean hasNext()

  Returns whether there are more sequences to iterate over.

  Specified by:
    `hasNext` in interface `SequenceIterator`
  Specified by:
    `hasNext` in interface `BioEntryIterator`
  Returns:
    true if there are more sequences to get and false otherwise

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD