473,398 Members | 2,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Read error (stream)

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!

*** Sent via Developersdex http://www.developersdex.com ***
Jul 9 '06 #1
4 2467
Hi
I think you missed to close the stream object if exception occurs.

Regards
Rahul.
csharpula csharp wrote:
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!

*** Sent via Developersdex http://www.developersdex.com ***
Jul 9 '06 #2
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!
*** Sent via Developersdex http://www.developersdex.com ***
Jul 9 '06 #3
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.

csharpula csharp wrote:
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!
*** Sent via Developersdex http://www.developersdex.com ***
Jul 9 '06 #4
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.

"Göran Andersson" <gu***@guffa.comwrote in message
news:uD**************@TK2MSFTNGP05.phx.gbl...
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.

csharpula csharp wrote:
>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!
*** Sent via Developersdex http://www.developersdex.com ***

Jul 9 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: MyHaz | last post by:
I playing around with streaming shoutcast mp3s. Here is some sample code: ----------------------- import httplib ############ # Put together the headers headers = {"Icy-MetaData":"1"}
4
by: Mike Dole | last post by:
I'm working on a client - server application based on the 'How to Sockets Server and How to Sockets Client' code from the Visual Basic ..NET Resource Kit. Since I want to be able to send 'big...
6
by: Yechezkal Gutfreund | last post by:
I have been using the following code (successfully) to read Xml formated text packets from a TCP stream. The output from the server stream consists of a sequence of well formed Xml documents...
3
by: Bill Cohagan | last post by:
I'm writing a console app in c# and am encountering a strange problem. I'm trying to use redirection of the standard input stream to read input from a (xml) file. The following code snippet is from...
2
by: GB | last post by:
Hi Everybody! I have 2 different processes/application. One is writing to a file and another is reading from it. For some reason the code doesnt seems to work and gives mscorlib.dll IOException...
0
by: XML newbie: Urgent pls help! | last post by:
I am using VB.Net. My program is to connect to a remote IPAddress. Once, it verifies the login information it should display the SessionID and enable some button . I appreciate your help and thanku...
1
by: Terrance | last post by:
I'm trying to create a small messenger program that uses the tcpclient and tcplistenter objects. When I start the application and run the thread that fires the tcplistener; once the client sends...
7
by: capnwhit | last post by:
Hello all, The program below has a bug... The program is supposed to convert a string to a continuous hex dump and back to a string. The output should be as follows: abcd 61626364 abcd
0
by: vishnu | last post by:
Hi, Am trying to post the data over https and am getting error in httpwebresponse.getResponseStream.Please help me to get rid of this issue. Here is the message from immediate window ...
63
by: Bill Cunningham | last post by:
I don't think I can do this without some help or hints. Here is the code I have. #include <stdio.h> #include <stdlib.h> double input(double input) { int count=0,div=0; double...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.