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.io.File;
024import java.io.IOException;
025import java.io.OutputStream;
026
027/**
028 * Writer for FASTQ formatted sequences.
029 *
030 * @since 1.7.1
031 */
032public interface FastqWriter
033{
034
035    /**
036     * Append the specified FASTQ formatted sequences to the specified appendable.
037     *
038     * @param <T> extends Appendable
039     * @param appendable appendable to append the specified FASTQ formatted sequences to, must not be null
040     * @param fastq variable number of FASTQ formatted sequences to append, must not be null
041     * @return the specified appendable with the specified FASTQ formatted sequences appended
042     * @throws IOException if an I/O error occurs
043     */
044    <T extends Appendable> T append(T appendable, Fastq... fastq) throws IOException;
045
046    /**
047     * Append the specified FASTQ formatted sequences to the specified appendable.
048     *
049     * @param <T> extends Appendable
050     * @param appendable appendable to append the specified FASTQ formatted sequences to, must not be null
051     * @param fastq zero or more FASTQ formatted sequences to append, must not be null
052     * @return the specified appendable with the specified FASTQ formatted sequences appended
053     * @throws IOException if an I/O error occurs
054     */
055    <T extends Appendable> T append(T appendable, Iterable<Fastq> fastq) throws IOException;
056
057    /**
058     * Write the specified FASTQ formatted sequences to the specified file.
059     *
060     * @param file file to write to, must not be null
061     * @param fastq variable number of FASTQ formatted sequences to write, must not be null
062     * @throws IOException if an I/O error occurs
063     */
064    void write(File file, Fastq... fastq) throws IOException;
065
066    /**
067     * Write the specified FASTQ formatted sequences to the specified file.
068     *
069     * @param file file to write to, must not be null
070     * @param fastq zero or more FASTQ formatted sequences to write, must not be null
071     * @throws IOException if an I/O error occurs
072     */
073    void write(File file, Iterable<Fastq> fastq) throws IOException;
074
075    /**
076     * Write the specified FASTQ formatted sequences to the specified output stream.
077     *
078     * @param outputStream output stream to write to, must not be null
079     * @param fastq variable number of FASTQ formatted sequences to write, must not be null
080     * @throws IOException if an I/O error occurs
081     */
082    void write(OutputStream outputStream, Fastq... fastq) throws IOException;
083
084    /**
085     * Write the specified FASTQ formatted sequences to the specified output stream.
086     *
087     * @param outputStream output stream to write to, must not be null
088     * @param fastq zero or more FASTQ formatted sequences to write, must not be null
089     * @throws IOException if an I/O error occurs
090     */
091    void write(OutputStream outputStream, Iterable<Fastq> fastq) throws IOException;
092}