001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 */
021package org.biojava.bio.program.fastq;
022
023import java.net.URL;
024
025import java.io.File;
026import java.io.InputStream;
027import java.io.IOException;
028
029/**
030 * Reader for FASTQ formatted sequences.
031 *
032 * @since 1.7.1
033 */
034public interface FastqReader
035{
036
037    /**
038     * Parse the specified readable.
039     *
040     * @since 1.9.1
041     * @param readable readable, must not be null
042     * @param listener low-level event based parser callback, must not be null
043     * @throws IOException if an I/O error occurs
044     */
045    void parse(Readable readable, ParseListener listener) throws IOException;
046
047    /**
048     * Stream the specified readable.
049     *
050     * @since 1.9.1
051     * @param readable readable, must not be null
052     * @param listener event based reader callback, must not be null
053     * @throws IOException if an I/O error occurs
054     */
055    void stream(Readable readable, StreamListener listener) throws IOException;
056
057    /**
058     * Read zero or more FASTQ formatted sequences from the specified file.
059     *
060     * @param file file to read from, must not be null
061     * @return zero or more FASTQ formatted sequences read from the specified file
062     * @throws IOException if an I/O error occurs
063     */
064    Iterable<Fastq> read(File file) throws IOException;
065
066    /**
067     * Read zero or more FASTQ formatted sequences from the specified url.
068     *
069     * @param url URL to read from, must not be null
070     * @return zero or more FASTQ formatted sequences read from the specified url
071     * @throws IOException if an I/O error occurs
072     */
073    Iterable<Fastq> read(URL url) throws IOException;
074
075    /**
076     * Read zero or more FASTQ formatted sequences from the specified input stream.
077     *
078     * @param inputStream input stream to read from, must not be null
079     * @return zero or more FASTQ formatted sequences read from the specified input stream
080     * @throws IOException if an I/O error occurs
081     */
082    Iterable<Fastq> read(InputStream inputStream) throws IOException;
083}