Hi Marc,
thank you!
On 3 Dez., 13:57, "Marc Gravell" <marc.grav...@gmail.comwrote:
This is normal and just means that the stream doesn't support
read/write timeouts.
Well... in my opinion, itīs not a good coding style, if an Exception
is "normal".
Is this causing a problem, or just out of interest?
I am having trouble with reading the stream into a byte-array and I am
not sure,
if the Exception is the cause of the problem.
My code looks like this:
BufferedStream bs = new BufferedStream(file.InputStream);
int length = System.Convert.ToInt32(bs.Length);
byte[] zipFile = new byte[length];
// wandle Zip-File in byte[] um
int offset = 0;
int remaining = length;
while (remaining 0)
{
int read = bs.Read(zipFile, offset, remaining);
if (read <= 0)
throw new EndOfStreamException(String.Format("End of
stream reached with {0} bytes left to read", remaining));
remaining -= read;
offset += read;
}
Before entering the while-loop the values of my variables are int
remaining = 1189816 = length
In the first iteration of the while loop, the Read method reads 7109
bytes (int read = 7109).
After this, the variables have values int remaining = 1182707 and int
offset = 7109. In the second while-loop, the Read method
(bs.Read(zipFile, 7109, 1182707) does not read any byte(!!!), which
means int read = 0.
Do you have an idea why that happens?
Regards,
Martin