Antwort: Re: [IO] encapsulating open/close

2010-08-06 Thread Sebastian . Petzelberger
Thnaks Niall and Jukka for your awnsers. -Niall Pemberton schrieb: - >Do you mean this: >http://developers.sun.com/mobility/apis/articles/fileconnection/ My term "file connection" was maybe misleading. >public void showFile(String fileName) Where is the connection closed? With my sugges

Re: Re: [IO] encapsulating open/close

2010-08-06 Thread Jukka Zitting
Hi, On Fri, Aug 6, 2010 at 10:54 AM, wrote: > My suggestion is providing an interface and a convenience method, which an > expression of this interface als argument. In this method opening and > closing will be done. I think, this would be the natural way in java. When > closures came, the clien

Re: [IO] encapsulating open/close

2010-08-06 Thread Niall Pemberton
On Wed, Aug 4, 2010 at 11:27 AM, wrote: > > Wanted is a convenience method that hides the opening and closing of a file > connection. This would avoid redundancy and failures by accidently not > closing the file connection. I have implemented this before, but now I want > to use apache commons io

Antwort: Re: [IO] encapsulating open/close

2010-08-06 Thread Sebastian . Petzelberger
>Not sure if this is exactly what you're looking for, but have you >seen the AutoCloseInputStream [1] class? No, I haven't, because IO does not use this itself. My suggestion is providing an interface and a convenience method, which an expression of this interface als argument. In this method ope

Re: [IO] encapsulating open/close

2010-08-04 Thread Jukka Zitting
Hi, On Wed, Aug 4, 2010 at 12:27 PM, wrote: > Wanted is a convenience method that hides the opening and closing of a file > connection. This would avoid redundancy and failures by accidently not > closing the file connection. I have implemented this before, but now I want > to use apache commons

Re: [IO] encapsulating open/close

2010-08-04 Thread Jukka Zitting
Hi, On Wed, Aug 4, 2010 at 12:27 PM, wrote: > Wanted is a convenience method that hides the opening and closing of a file > connection. This would avoid redundancy and failures by accidently not > closing the file connection. I have implemented this before, but now I want > to use apache commons