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.IOException;
024
025/**
026 * Low-level event based parser callback.
027 *
028 * @since 1.8.2
029 */
030public interface ParseListener
031{
032    /**
033     * Notify this parse listener of a description line.
034     *
035     * @param description description line
036     * @throws IOException if an I/O error occurs
037     */
038    void description(String description) throws IOException;
039
040    /**
041     * Notify this parse listener of a sequence line.
042     *
043     * <p>
044     * Note that the sequence in FASTQ format may contain end-of-line characters,
045     * so both this method and <code>appendSequence(String)</code> may be called per FASTQ
046     * formatted sequence.
047     * </p>
048     *
049     * @param sequence sequence line
050     * @throws IOException if an I/O error occurs
051     */
052    void sequence(String sequence) throws IOException;
053
054    /**
055     * Notify this parse listener of an additional sequence line.
056     *
057     * <p>
058     * Note that the sequence in FASTQ format may contain end-of-line characters,
059     * so this method may be called more than once per FASTQ formatted sequence.
060     * </p>
061     *
062     * @param sequence additional sequence line
063     * @throws IOException if an I/O error occurs
064     */
065    void appendSequence(String sequence) throws IOException;
066
067    /**
068     * Notify this parse listener of a repeat description line.
069     *
070     * @param repeatDescription repeat description line
071     * @throws IOException if an I/O error occurs
072     */
073    void repeatDescription(String repeatDescription) throws IOException;
074
075    /**
076     * Notify this listener of a quality line.
077     *
078     * <p>
079     * Note that the quality scores in FASTQ format may contain end-of-line characters,
080     * so both this method and <code>appendQuality(String)</code> may be called per FASTQ
081     * formatted sequence.
082     * </p>
083     *
084     * @param quality quality line
085     * @throws IOException if an I/O error occurs
086     */
087    void quality(String quality) throws IOException;
088
089    /**
090     * Notify this listener of a quality line.
091     *
092     * <p>
093     * Note that the quality scores in FASTQ format may contain end-of-line characters,
094     * so this method may be called more than once per FASTQ formatted sequence.
095     * </p>
096     *
097     * @param quality additional quality line
098     * @throws IOException if an I/O error occurs
099     */
100    void appendQuality(String quality) throws IOException;
101
102    /**
103     * Notify this listener the FASTQ formatted sequence is complete.
104     *
105     * @throws IOException if an I/O error occurs
106     */
107    void complete() throws IOException;
108}