Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

BzipInput.read() throws exception instead of returning Eof

Moderators: kris

Posted: 04/02/08 20:14:59

Here is a small problem I encountered with BzipInput. Code like the following always throws BzipClosedException, since BzipInput.read() calls kill_bzs() on a last chunk of data (BzipStream.d:250), and on the next call check_valid() throws the exception (BzipStream.d:327). ZlibInput is different - it returns Eof instead of calling check_valid() (ZlibStream.d:139-140).

auto z = new BzipInput(f);
uint len = 0;
auto con = out.conduit;
auto tmp = new byte [con.bufferSize];
try {
    while( len != IConduit.Eof ) {
        len = z.read(tmp);
    }
} catch( BzipClosedException ex) {
    Cout(ex.toString).newline.flush;
}
Author Message

Posted: 04/04/08 03:34:17

Hrmmm. I suggest you file a ticket, and assign it to DRK (Daniel Keep) ?

Posted: 04/04/08 17:46:16

Done. Thank you!