[Biojava-l] BufferedOutputStream to RichSequence.IOTools.writeXXX() method needs to flush manually

Mark Schreiber markjschreiber at gmail.com
Thu Oct 2 00:46:03 UTC 2008


As a general rule it is best if BioJava doesn't handle the flushing
and closing of OutputStreams. This is because you may want to keep
using the stream and control it's behaivour. An interesting example is
if you pass System.out to a method that closes the stream. Probably
not what you want.

Having said that maybe we should add a javadoc to say that
BufferedOutputStreams need to be flushed (and possibly closed).

- Mark

On Wed, Oct 1, 2008 at 9:36 PM, Richard Holland
<holland at eaglegenomics.com> wrote:
> The IOTools interfaces accept OutputStream instances, not
> BufferedOutputStream instances. flush() is not a requirement on
> OutputStream and so BJX does not call it.
>
> cheers,
> Richard
>
> 2008/10/1 pprun <pzgyuanf at gmail.com>:
>> Hi,
>> I don't know this is a feature or a bug,
>> If a BufferedOutputStream was passed to method
>> RichSequence.IOTools.writeGenbank(OutputStream os, Sequence seq,
>> Namespace ns),
>> at the end, I need to manually flush it - BufferedOutputStream.flush()
>>
>> Otherwise, the output content will be truncated.
>>
>> Is this the expected behavior?
>>
>> Thanks,
>> - Pprun
>>
>>
>> _______________________________________________
>> Biojava-l mailing list  -  Biojava-l at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/biojava-l
>>
>>
>
>
>
> --
> Richard Holland, BSc MBCS
> Finance Director, Eagle Genomics Ltd
> M: +44 7500 438846 | E: holland at eaglegenomics.com
> http://www.eaglegenomics.com/
> _______________________________________________
> Biojava-l mailing list  -  Biojava-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biojava-l
>



More information about the Biojava-l mailing list