BinaryWriter | R Documentation |
This function creates a new instance of the BinaryWriter
class,
which supports writing of bulk binary data to a connection or file.
BinaryWriter(
output,
byte_offset,
data_type,
bytes_per_element,
endian = .Platform$endian
)
output |
A file name (character string) to write to or a |
byte_offset |
An integer specifying the number of bytes to skip at the start of output. |
data_type |
A character string specifying the R data type of binary elements to be written. |
bytes_per_element |
An integer specifying the number of bytes in each data element (e.g., 4 or 8 for floating point numbers). |
endian |
A character string specifying the endianness of the binary output connection.
Default is |
The BinaryWriter
function creates an object for efficient writing of binary data.
It can work with both file names and existing connection objects. If a file name is provided,
it opens a new connection in binary write mode.
A new instance of the BinaryWriter
class.
BinaryWriter-class
for the class definition and available methods.
BinaryReader
for reading binary data.
## Not run:
# Create a BinaryWriter for a file
writer <- BinaryWriter("output.bin", byte_offset = 0, data_type = "double",
bytes_per_element = 8)
# Create a BinaryWriter for an existing connection
con <- file("output.bin", "wb")
writer <- BinaryWriter(con, byte_offset = 100, data_type = "integer",
bytes_per_element = 4, endian = "little")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.