Binary data management



The 1C:Enterprise language contains a set of low-level tools for managing binary data. They help address the following tasks:

  • Interacting with specialized devices over a binary protocol

  • Managing files of various formats

  • Converting text data in binary data (e.g. to send reports)

  • Managing Binary Data in Memory.

Streams

Binary data are primarily managed by a group of types titled Streams: Stream, FileStream, and StreamInMemory. The streams are designed for successive reading/writing of big binary data. Their benefit is that they allow managing data streams of any volume. However, they only provide basic management capabilities—e.g. reading from a stream, writing to a stream, changing current position. Streams can be created by file name or from BinaryData.

Reading & Writing Data

The object DataRead can be created from streams. In contrast to streams, this object allows reading specific bytes, symbols, and numbers. It can read a string (with due regard to the encoding) or read data located before a pre-defined marker. This object has an antipode, WriteData, that is created in the similar way but writes data. As these objects read/write data from/to streams, they do it successively which helps manage streams of any volume.

Binary Data Buffer

The user can get any part of the read data in the object BinaryDataBuffer. The main difference of this object is that it grants not successive but random access to data, and allows changing their location. All data of this object are stored in the RAM. This is why, on the one hand, it is designed to analyze and edit not too large volumes of binary data. On the other hand, this object helps randomly write and read bytes in the form of numbers, to split a buffer or pool several buffers together, or get a buffer part of the specified size.

Bit-By-Bit Logic Gates

BinaryDataBuffer allows bit-by-bit logic gates—AN, OR, XOR, NAND, and inversion. These gates are handy in decoding the format of the exchange with point-of-sale equipment.

For simpler and more common cases, the following bit-by-bit gates with integer numbers are supported: AND, OR, NOT, NAND, XOR, or bit-by-bit left or right shifts.

Next page: REST interface

Be the first to know tips & trick on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.