Well, it's relatively simple. All I need to-do, is return the byte array of
read data.
internal byte[] GetData( int index, byte[] terminatingData ){
MemoryStream ms = new MemoryStream();
while( !eof ){
countRead = ReadSocket(data, 0, data.Length);
//store byte array
ms.Write( data, 0, countRead );
if( countRead > terminatingData.Length )
eof = CheckForEndOfFile( data, countRead, terminatingData );
else
eof = CheckForEndOfFile( ms, terminatingData );
}
}
return ms.ToArray();
}
This is very rough pseudo code. It's what the original method was doing.
I'm trying to decrease the memory footprint.
Once again, thanks all for your feedback.
Cheers!
Dave
----- Original Message -----
From: "Stoyan Damov" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, July 06, 2006 4:13 PM
Subject: Re: [ADVANCED-DOTNET] trim byte array
> Dave,
>
> Are you willing to share with us the interface(s) of your component.
> If we see how your component's clients will use it, we might be able
> to come up with an idea.
>
> Cheers,
> Stoyan
>
> On 7/6/06, dave wanta <[EMAIL PROTECTED]> wrote:
> > I wish I could. But basically these are large blobs (usually GIS images,
but
> > can be regular images and sometimes large zips).
> >
> > Unfortunately I don't have control over the project, and only have this
> > little box I can work in (read data from a socket, and optimize the
> > memory ).
> >
> > I was using a MemoryStream, simply because it was quick and easy. I'm
moving
> > to a dynamically expanding byte array, but the Trimming part is what I
> > was/am worried about.
> >
> > Cheers!
> > Dave
>
> ===================================
> This list is hosted by DevelopMentorĀ® http://www.develop.com
>
> View archives and manage your subscription(s) at
http://discuss.develop.com
>
===================================
This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com