[Biojava-l] RichSequence.IOTools performance
Richard Holland
holland at eaglegenomics.com
Thu Mar 31 12:28:40 UTC 2011
Really it should require the minimum necessary, i.e. a simple OutputStream. If the user wants to improve that performance then they can pass in something better, e.g. BufferedOutputStream. By requiring BufferedOutputStream from the start you rule out users who want to use other mechanisms, e.g. FileOutputStream, ByteArrayOutputStream, etc.
On 31 Mar 2011, at 13:23, Scooter Willis wrote:
> Richard
>
> Just tested and it does look like it gets closed. I removed the close
> of the BufferedOutputStream and replaced with a flush. In looking
> through the BufferedOutputStream.java it looks like it should be
> garbage collected as it doesn't pass any references to itself
> anywhere. I checked in the change.
>
> The other option is to only allow FastaWriter to take a
> BufferedOutputStream or change the code in FastaWriterHelper to use
> BufferedOutputStream. Any suggestions on best practice for the API to
> protect the innocent who want speed? Can you think of any reason we
> would not use a BufferedOutputStream when writing?
>
> Scooter
>
> On Thu, Mar 31, 2011 at 7:14 AM, Richard Holland
> <holland at eaglegenomics.com> wrote:
>> Closing BufferedOutputStream will close the parent stream too, as it inherits this behaviour from FilterOutputStream.
>>
>> On 31 Mar 2011, at 12:07, Scooter Willis wrote:
>>
>>> I don't think closing the BufferedOutputStream by contract should close a parent stream. Those that open should be responsible for closing. I have seen cases where you don't close BufferedOutputStream you don't get a flush of all data if you just close parent OutputStream. I will test it.
>>>
>>>
>>>> On Mar 31, 2011 7:01 AM, "Andy Yates" <ayates at ebi.ac.uk> wrote:
>>>>
>>>> Won't that close down the underlying stream which was given in the first place? Not sure if anyone would notice it TBH but it could look odd that the level responsible for creating the original (file) stream isn't responsible for closing it
>>>>
>>>> Andy
>>>>
>>>> On 31 Mar 2011, at 11:59, Scooter Willis wrote:
>>>>
>>>>> Andy
>>>>>
>>>>> I check if OutputStream is an instance...
>>>>
>>>> --
>>>> Andrew Yates Ensembl Genomes Engineer
>>>>
>>>> EMBL-EBI Tel: +44-(0)1223-492538
>>>> Wellcome Trust Genome Campus Fax: +44-(0)12...
>>>>
>>>
>>
>> --
>> Richard Holland, BSc MBCS
>> Operations and Delivery Director, Eagle Genomics Ltd
>> T: +44 (0)1223 654481 ext 3 | E: holland at eaglegenomics.com
>> http://www.eaglegenomics.com/
>>
>>
--
Richard Holland, BSc MBCS
Operations and Delivery Director, Eagle Genomics Ltd
T: +44 (0)1223 654481 ext 3 | E: holland at eaglegenomics.com
http://www.eaglegenomics.com/
More information about the Biojava-l
mailing list