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.nbio.genome.io.fastq;
022
023import java.io.File;
024import java.io.IOException;
025import java.io.InputStream;
026import java.net.URL;
027
028/**
029 * Reader for FASTQ formatted sequences.
030 *
031 * @since 3.0.3
032 */
033public interface FastqReader
034{
035
036        /**
037         * Parse the specified readable.
038         *
039         * @param readable readable, must not be null
040         * @param listener low-level event based parser callback, must not be null
041         * @throws IOException if an I/O error occurs
042         */
043        void parse(Readable readable, ParseListener listener) throws IOException;
044
045        /**
046         * Stream the specified readable.
047         *
048         * @param readable readable, must not be null
049         * @param listener event based reader callback, must not be null
050         * @throws IOException if an I/O error occurs
051         */
052        void stream(Readable readable, StreamListener listener) throws IOException;
053
054        /**
055         * Read zero or more FASTQ formatted sequences from the specified file.
056         *
057         * @param file file to read from, must not be null
058         * @return zero or more FASTQ formatted sequences read from the specified file
059         * @throws IOException if an I/O error occurs
060         */
061        Iterable<Fastq> read(File file) throws IOException;
062
063        /**
064         * Read zero or more FASTQ formatted sequences from the specified url.
065         *
066         * @param url URL to read from, must not be null
067         * @return zero or more FASTQ formatted sequences read from the specified url
068         * @throws IOException if an I/O error occurs
069         */
070        Iterable<Fastq> read(URL url) throws IOException;
071
072        /**
073         * Read zero or more FASTQ formatted sequences from the specified input stream.
074         *
075         * @param inputStream input stream to read from, must not be null
076         * @return zero or more FASTQ formatted sequences read from the specified input stream
077         * @throws IOException if an I/O error occurs
078         */
079        Iterable<Fastq> read(InputStream inputStream) throws IOException;
080}