[Biojava-l] Fasta writer proposed change

Alexander Churbanov achurbanov@yahoo.com
Sun, 9 Jun 2002 13:39:30 -0700 (PDT)


   Hello everybody,

   I was recently writing about inconsistency in
FastaFormat class, I send the updated version of the
function which works as intended.

    public void writeSequence(Sequence seq, String
format, PrintStream os)
	throws IOException
    {
	String requestedFormat = new String(format);
	boolean found = false;

	String [] formats = (String [])
getFormats().toArray(new String[0]);
        
        for(int i = 0; i < formats.length; i++) {
          found = found ||
(formats[i].compareTo(format) == 0);
        }

	if (! found)
	    throw new IOException("Failed to write: an
invalid file format '"
				  + format
				  + "' was requested");

	writeSequence(seq, os);
    }

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com