In-memory binary data terms

Revision as of 19:27, 8 August 2023 by Lchrisman (talk | contribs) (Created page with "{{ReleaseBar}} == Binary data terms (or "blobs") == Sometimes you may need to hold some arbitrary raw, opaque data in memory. The data cannot be directly interpreted (at lea...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)



Release:

4.6  •  5.0  •  5.1  •  5.2  •  5.3  •  5.4  •  6.0  •  6.1  •  6.2  •  6.3  •  6.4  •  6.5


Binary data terms (or "blobs")

Sometimes you may need to hold some arbitrary raw, opaque data in memory. The data cannot be directly interpreted (at least not easily), and might contain any sequence of bytes. Such an in-memory block is sometimes called a "blob". The more formal name is a binary data term.

A binary data term is therefore just a block of memory with arbitrary data. Often it is just an in-memory copy of a binary file. This can be useful when your code makes many individual reads from different locations in the file, since it avoids repeated file-open and file-close operations, and accesses everything in memory. Sometimes the in-memory image is a portion of a binary file.

Creating a binary data term in memory

The following are ways in which a binary data term can be created.

Note that functions that read or write to external sources (files) require Analytica Enterprise or better.

Reading the contents of an in-memory binary data term

Generally when you are reading a piece of information from the blob, you'll want to interpret the contents in some way. The parameters of GetFromBinaryData enable you to control this interpretation so that you can read as different non-opaque data types.

Conversions

For conciseness, the table says "blob" for in-memory binary data term.

! From To Method Required release
Binary file (or part of) blob ReadBinaryFile Analytica 6.2
blob (or part of) Binary file WriteBinaryFile Analytica 6.2
Part of blob another blob GetFromBinaryData(...typeFlags:7) Analytica 6.2
Image file blob ReadBinaryFile(filename,typeFlags:7) Analytica 6.4
In-memory image blob WriteImageFile("<>", image) Analytica 6.4
blob in-memory image GetFromBinaryData( ..., typeFlags:8 ) Analytica 6.4
base64 text blob As a literal: [base64'....]

From text only: Evaluate( f"base64'{txt}')

Analytica 6.4
Comments


You are not allowed to post comments.