bs_write_byte {bitstreamio} | R Documentation |
Read/Write unaligned bytes with a bitstream
Description
Read/Write unaligned bytes with a bitstream
Usage
bs_write_byte(bs, x)
bs_read_byte(bs, n)
Arguments
bs |
Bistream connection object created with |
x |
vector of bytes to write. Integer vectors will be truncated to 8 bits before output. Numeric vectors will be rounded to integers and then truncated to 8 bits. |
n |
number of bytes to read |
Value
Reading returns a logical vector of bit values. When writing,
the bs
bitstream connection is returned invisibly
Examples
bs <- bs_open(raw(), 'w')
bs_write_bit(bs, c(TRUE, FALSE))
bs_write_byte(bs, c(1, 2, 3))
bs_align(bs)
raw_vec <- bs_close(bs)
bs <- bs_open(raw_vec, 'r')
bs_read_bit(bs, 2)
bs_read_byte(bs, 3)
bs_close(bs)
[Package bitstreamio version 0.1.0 Index]