Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > microsoft.public.scripting.vbscript > #12168
| From | "Mayayana" <mayayana@invalid.nospam> |
|---|---|
| Newsgroups | microsoft.public.scripting.vbscript |
| Subject | Re: Fast Byte array creation? |
| Date | 2019-07-22 09:59 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <qh4fg6$rf6$1@dont-email.me> (permalink) |
| References | <efr8kbj56yit.1mm29ut6ie3pc.dlg@40tude.net> <qh2msh$d1h$1@dont-email.me> <9xq34xdb0mk4$.nblcm65fsfh9$.dlg@40tude.net> |
"JJ" <jj4public@vfemail.net> wrote |> Since VBS can't deal with direct | > byte data like that, it's hard to guess what you might be | > trying to accomplish. | | A generic data container for use with remote process memory access. An | uncommon IPC. | :) I meant what the code is trying to accomplish, not the aim of the software. Since you can only write to the stream from a byte array, and presumably you have a byte array coming in, I don't get the problem. I was all the more curious because, given the limitations, I've only use Stream a couple of times. I needed it recently to write a byte array to disk coming from a winhttp image download. But of course, that's all I could do. VBS can't handle the winhttp byte array. If I wanted to edit the bytes I'd have to save to disk and then open as a Textstream. Microsoft seem to have gone out of their way to prevent scripters from being able to edit/write binary data. I usually do it with Textstream. (Which works as long as the local codepage is not a multibyte language, like Japanese, Chinese, or Korean.) I tried just setting the stream Position to 2000, which should be fine, according to the docs. But it tells me that's an invalid operation. "The parameter is incorrect." Yet the docs for Position say this: "The current position can be moved to a point after the end of the stream. If you specify the current position beyond the end of the stream, the Size of the Stream object will be increased accordingly. Any new bytes added in this way will be null." On the other hand, using your method of writing a string and then converting to binary, returns 0.0625 seconds when I time how long that takes to create a 10 MB stream. I'd call that pretty fast. So then you have your byte array, created almost instantly, but you can't write bytes to it using VBS. And if you have a byte array coming in then you don't need to fill the Stream first.
Back to microsoft.public.scripting.vbscript | Previous | Next — Previous in thread | Next in thread | Find similar
Fast Byte array creation? JJ <jj4public@vfemail.net> - 2019-07-22 04:14 +0700
Re: Fast Byte array creation? "Mayayana" <mayayana@invalid.nospam> - 2019-07-21 17:52 -0400
Re: Fast Byte array creation? JJ <jj4public@vfemail.net> - 2019-07-22 17:04 +0700
Re: Fast Byte array creation? "Mayayana" <mayayana@invalid.nospam> - 2019-07-22 09:59 -0400
Re: Fast Byte array creation? "R.Wieser" <address@not.available> - 2019-07-22 12:15 +0200
Re: Fast Byte array creation? JJ <jj4public@vfemail.net> - 2019-07-23 13:30 +0700
Re: Fast Byte array creation? "Mayayana" <mayayana@invalid.nospam> - 2019-07-23 09:45 -0400
csiph-web