Learn R Programming

bitstreamio (version 0.1.0)

Read and Write Bits from Files, Connections and Raw Vectors

Description

Bit-level reading and writing are necessary when dealing with many file formats e.g. compressed data and binary files. Currently, R connections are manipulated at the byte level. This package wraps existing connections and raw vectors so that it is possible to read bits, bit sequences, unaligned bytes and low-bit representations of integers.

Copy Link

Version

Install

install.packages('bitstreamio')

Monthly Downloads

170

Version

0.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Mike Cheng

Last Published

January 14th, 2025

Functions in bitstreamio (0.1.0)

assert_bs

Test if an object is a bitstream object and fail if it is not
bs_align

Align the bitstream to the given number of bits - relative to start of bitstream
bs_flush

Flush bits in the buffer
bits_to_raw

Convert between logical vector of bits and raw vector
bs_peek

Peek at bits from a bitstream i.e. examine bits without advancing bitstream
bs_write_sint_exp_golomb

Read/Write Exponential-Golomb encoded signed integers
bs_write_uint_exp_golomb

Read/Write Exponential-Golomb encoded non-negative integers
bs_is_aligned

Is the current bit connection aligned at the given number of bits for reading/writing?
bs_read_bit

Read bits from a bitstream
bs_write_uint

Read/Write unsigned integers
is_bs

Test if an object is a bitstream object
bits_to_uint

Convert between bits and unsigned integers
bs_advance

Advance bitstream
pad_bits

Pad a logical vector to the given size
bs_write_bit

Write unaligned bits to a bitstream
sint_to_exp_golomb_bits

Convert between signed integers and Exponential-Golomb bit sequences
bs_write_byte

Read/Write unaligned bytes with a bitstream
bs_open

Open/close a bitstream
uint_to_exp_golomb_bits

Convert between non-negative integers and Exponential Golomb bit sequences