- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
How to use JSL to split a contiguous binary file into segments in bytes?
This is what happens after reading binary files with JSL:
It's segmented by 12 bytes
b = Load Text File( "……\abc.spr", blob() );
Thanks Experts!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to use JSL to split a contiguous binary file into segments in bytes?
I would guess using Blob Peek and loop should work. There might also be additional ideas in
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to use JSL to split a contiguous binary file into segments in bytes?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to use JSL to split a contiguous binary file into segments in bytes?
For example, regular substitution with EmEditor is easy to implement
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to use JSL to split a contiguous binary file into segments in bytes?
There are only two choices. BlobPeek() and LoadTextfile(... , BLOB( ReadOffsetFromBegin(), ReadLength() ) ).
Using BlobPeek multiple times is faster than calling LoadTextfile multiple times.
What efficiency concern do you have? How big is the blob? How slow is it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to use JSL to split a contiguous binary file into segments in bytes?
Thanks!
Well, it looks like it can only be done in a circular way.
There are many such files that need to be written to the JMP table.
Want to increase speed.
I wrote JSL
b = Load Text File( ……|| "abs.spr", blob() );
s = Length( b ) / 12;
ar = [];
ar = J( s, 5, . );
For( k = 1, k <= s, k++,
a = Blob Peek( b, (k - 1) * 12, 12 );
ar[k, 3] = Blob To Matrix( a, "int", 4, "little", 8 )[1, 1];
ar[k, 4] = Blob To Matrix( a, "int", 4, "little", 8 )[1, 2];
ar[k, 5] = Blob To Matrix( a, "float", 4, "little", 8 )[1, 3];
);
If it is able to implement segmentation
Does this code increase speed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to use JSL to split a contiguous binary file into segments in bytes?
If the binary can be segmented after reading, can the following JSL be used?
Read the whole b directly, without looping:
ar[0, 3] = Blob To Matrix( b, "int", 4, "little", 8 )[0, 1];
ar[0, 4] = Blob To Matrix( b, "int", 4, "little", 8 )[0, 2];
ar[0, 5] = Blob To Matrix( b, "float", 4, "little", 8 )[0, 3];
Thanks!