Re: Streams



On Mon, 29 Aug 2005 21:26:51 -0500, "Richard" <REMOVE
AT-DOTrwskinnerAT@awesomenetDOTnet> wrote:

>Thanks for the help, although I have a question or three.
>
>Right now, I'm writing from an Array directly to a Flash Drive.
>So, by writing the array to a stream, compressing from the stream straight
>to disk saves a lot of writing to the flash, by not writing the 6-10 megs to
>a text file, then zipping, then deleting. The 6 meg file is less than 300K
>when compressed. So I now have a single 300Kbyte file written.
>
>Big Benefits, however, looking at the code below, it appears I have 4 times
>the memory being used then I need.
>The Original Array, Working Copy of the Array, String List, and then the
>Stream.
>
>The working copy of the Array is a snap shot of the original array. This
>allows a background thread to process the copy and then allows the original
>to keep on working and collecting data.
>
>I feel after adding the Copy of the Array to the String List, then I need to
>Free the Copy of the Array, then after adding the String List to the Stream,
>Free the String List, then after compressing the file, I could free the
>stream and compression component. This only keeps a couple of copies in
>memory at any given time (Plus the original).
>
>Now, with all this said, heck, instead of using this huge dynamic array with
>86,000 records, Each Record containing about 100 Fields of Integers,
>shouldn't I simply use a String List to begin with, since it will all be
>string data later when written? Is a String List effecient enough to do
>large amounts of data like that? I guess it is, we're using it above.
>
>Or, Would it be better to use a stream from the get go? I could add a
>record to a MemoryStream 1 at a time then process it when I need to.
>
>Speedwise, and safest, which is the preferred method.

I don't understand why you need the StringList

The working copy of the Array makes sense, why don't you just write
its contents into the compressing Stream ?

Or maybe I've missed something ...
.



Relevant Pages

  • Re: Streams
    ... I'm writing from an Array directly to a Flash Drive. ... So, by writing the array to a stream, compressing from the stream straight ...
    (alt.comp.lang.borland-delphi)
  • Re: increasing the size of a byte array and reading streams
    ... > reading the stream below (where buf is a byte array). ... When you're reading a file, for example, and you know that the file is ... There are times, however, when it makes sense to read a stream in small ... write those uncompressed bytes to your secondary MemoryStream. ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Handling blank lines in while(<CONF>) construct
    ... This is the terminal code to produce a yellow text output. ... If I were watching my maillog file stream past, ... This array is created dynamically by the code ... I posted the code to the list yesterday, ...
    (perl.beginners)
  • Re: How to save C++ objects using Cocoa?
    ... from my perspective it seems like with a byte stream I have to invent ... have to archive the array. ... imply that Cocoa streamlines the whole lot; ... flattening the data to saving it; I wasn't sure why, or if, this was ...
    (comp.sys.mac.programmer.help)
  • Re: How to save C++ objects using Cocoa?
    ... from my perspective it seems like with a byte stream I have to invent ... have to archive the array. ... imply that Cocoa streamlines the whole lot; ... flattening the data to saving it; I wasn't sure why, or if, this was ...
    (comp.sys.mac.programmer.help)