On Monday, December 7, 2015 at 11:16:07 AM UTC+10, Seth wrote:
>
> Hi,
>
> I'm moving from Gzip.jl to Libz.jl, and am running into a problem. Gzip 
> used to allow a file to be opened using its methods even if the file was 
> not encrypted. Libz doesn't allow that.
>
> The problem I'm having is that I can't figure out a try/catch/finally that 
> works. Basically, I want this (pseudocode):
>
> io = ZlibInflateInputStream(open(fn,"r"))   # this will succeed if fn 
> exists, even if fn isn't compressed
> contents = try
>    do_something_with_io(io)   # this will error if fn isn't compressed
> catch
>

Close io before re-opening it?
 

>   io = open(fn,"r")   # so we try to open it as an uncompressed file
>   do_something_with_io(io)
> finally
>   close(io)
> end
>
> but this doesn't work (the finally statement fails, for one).
>
> What's the accepted way of doing this?
>

Reply via email to