Read error (stream)

  • Thread starter csharpula csharp
  • Start date
C

csharpula csharp

Hello,I am trying to read from a zip stream and one of the files is of a
0 size (0 bytes)- Exception is thrown as a result but there are some
other files after it in a stream which I want to keep reading and
writing to temp dir. How can I deal such exception.

I get error when in the end I want to erase the temp dir and it won't
let me because the 0 bytes file is being used by other process.
How to solve it?
Thank you!
 
R

RahulatCSE

Hi
I think you missed to close the stream object if exception occurs.

Regards
Rahul.
 
C

csharpula csharp

In the catch part I did :

streamWriter.Close();
zipInputStream.CloseEntry()

but it's not helping and when I am trying to erase the temp dir,the 0
bytes file is been holden by some other proces.
How could it be?
Thanks!
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Why is there an exception just because the file size is zero? What
object is throwing the exception?

If possible, try to handle the zero size files without using exceptions.
 
W

warlord

Not sure if you want it in catch maybe in a finally.

But try to find the filesize before committing it to a stream is probably
the best option.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top