Click here to Skip to main content
15,911,646 members
Home / Discussions / C#
   

C#

 
AnswerRe: copy from iis Pin
WillemM24-May-07 2:16
WillemM24-May-07 2:16 
QuestionTo make TextBox scrollable Pin
Rahul8323-May-07 21:37
Rahul8323-May-07 21:37 
AnswerRe: To make TextBox scrollable Pin
Martin#23-May-07 21:48
Martin#23-May-07 21:48 
AnswerRe: To make TextBox scrollable Pin
Nouman Bhatti24-May-07 0:29
Nouman Bhatti24-May-07 0:29 
QuestionHow to include CHMHelpFile in C# Pin
david boon23-May-07 21:28
david boon23-May-07 21:28 
AnswerRe: How to include CHMHelpFile in C# Pin
Rajkishan23-May-07 22:14
Rajkishan23-May-07 22:14 
QuestionHow to put in cache only part of webpage Pin
Nimua23-May-07 21:07
Nimua23-May-07 21:07 
QuestionRead Large Files Into Memory Pin
Patricker23-May-07 20:54
Patricker23-May-07 20:54 
I am trying to decompress a file. To do this, with my current code which you can see below, I am reading the entire file into a byte[]. But if my file is big, I believe bigger then 64 KB, then I can't declare a byte[] big enough to hold the file. How do I fix this, work around this?

---------Code---------
public void GZipDeCompressStream(Stream InStream, Stream OutStream)
{
//Decompresser
GZipStream gzDecompressed = new GZipStream(InStream, CompressionMode.Decompress, true);

//Retrieve the size of the decompressed file from the compressed footer
byte[] bufferWrite = new byte[4];
InStream.Position = (int)InStream.Length - 4;
InStream.Read(bufferWrite, 0, 4);
InStream.Position = 0;

//Convert to int for using in declaring our Byte[] size
int bufferLength = BitConverter.ToInt32(bufferWrite, 0);
//Create our Buffer: size + 100
------------//This is where my issue is. Buffer Lenght is WAY bigger then the 64 KB limit.
byte[] buffer = new byte[bufferLength + 100];
int readOffset = 0;
int totalBytes = 0;

// Loop through the compressed stream and put it into the buffer
while (true)
{
int bytesRead = gzDecompressed.Read(buffer, readOffset, 100);

// If we reached the end of the data
if (bytesRead == 0)
break;

readOffset += bytesRead;
totalBytes += bytesRead;
}

// Write the content of the buffer to the destination stream
OutStream.Write(buffer, 0, totalBytes);

// Close the streams
InStream.Close();
gzDecompressed.Close();
OutStream.Close();
}
AnswerRe: Read Large Files Into Memory Pin
Christian Graus23-May-07 21:21
protectorChristian Graus23-May-07 21:21 
GeneralRe: Read Large Files Into Memory Pin
Patricker23-May-07 21:29
Patricker23-May-07 21:29 
GeneralRe: Read Large Files Into Memory Pin
Christian Graus23-May-07 21:57
protectorChristian Graus23-May-07 21:57 
GeneralRe: Read Large Files Into Memory Pin
Patricker23-May-07 22:00
Patricker23-May-07 22:00 
AnswerRe: Read Large Files Into Memory Pin
DavidNohejl24-May-07 0:27
DavidNohejl24-May-07 0:27 
AnswerRe: Read Large Files Into Memory Pin
lmoelleb23-May-07 21:49
lmoelleb23-May-07 21:49 
GeneralRe: Read Large Files Into Memory Pin
Patricker23-May-07 23:22
Patricker23-May-07 23:22 
Question2 questions regarding graphics Pin
Muammar©23-May-07 20:43
Muammar©23-May-07 20:43 
AnswerRe: 2 questions regarding graphics Pin
Christian Graus23-May-07 20:47
protectorChristian Graus23-May-07 20:47 
GeneralRe: 2 questions regarding graphics Pin
Muammar©23-May-07 20:56
Muammar©23-May-07 20:56 
AnswerRe: 2 questions regarding graphics Pin
Guffa23-May-07 21:04
Guffa23-May-07 21:04 
GeneralRe: 2 questions regarding graphics Pin
Muammar©23-May-07 21:09
Muammar©23-May-07 21:09 
GeneralRe: 2 questions regarding graphics Pin
Christian Graus23-May-07 21:19
protectorChristian Graus23-May-07 21:19 
GeneralRe: 2 questions regarding graphics Pin
Muammar©23-May-07 21:38
Muammar©23-May-07 21:38 
GeneralRe: 2 questions regarding graphics Pin
Martin#23-May-07 21:43
Martin#23-May-07 21:43 
GeneralRe: 2 questions regarding graphics Pin
Muammar©23-May-07 21:55
Muammar©23-May-07 21:55 
GeneralRe: 2 questions regarding graphics Pin
Martin#23-May-07 22:00
Martin#23-May-07 22:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.