Struct bitstream::reader::BitReader
[−]
[src]
pub struct BitReader<R: Read + ?Sized, E: Endianess> { /* fields omitted */ }
BitReader
reads an input stream as a stream of bits (instead of the normal byte-level).
Methods
impl<R: Read, E: Endianess> BitReader<R, E>
[src]
fn new(rdr: R) -> BitReader<R, E>
fn with_buffer_size(rdr: R, sz: u32) -> BitReader<R, E>
impl<R: Read + ?Sized, E: Endianess> BitReader<R, E>
[src]
fn read_usize(&mut self, bits: u8) -> Result<usize>
Reads bits
bits into a usize
.
Panics if bits
is greater than the number of bits in a usize
fn read_isize(&mut self, bits: u8) -> Result<isize>
Reads bits
bits into an isize
.
Panics if bits
is greater than the number of bits in a isize
fn read_u64(&mut self, bits: u8) -> Result<u64>
Reads bits
bits into a u64
.
Panics if bits
is greater than the number of bits in a u64
fn read_i64(&mut self, bits: u8) -> Result<i64>
Reads bits
bits into an i64
.
Panics if bits
is greater than the number of bits in a i64
fn read_u32(&mut self, bits: u8) -> Result<u32>
fn read_i32(&mut self, bits: u8) -> Result<i32>
fn read_u16(&mut self, bits: u8) -> Result<u16>
fn read_i16(&mut self, bits: u8) -> Result<i16>
fn read_u8(&mut self, bits: u8) -> Result<u8>
fn read_i8(&mut self, bits: u8) -> Result<i8>
fn read_bit(&mut self) -> Result<bool>
Read a single bit from the stream returning it as a boolean value
fn read_unary_unsigned(&mut self) -> Result<usize>
Read an unsigned, unary-coded value from the bitstream. This uses one-terminated encoding.
For example: the number 6
is encoded as 0000001
fn skip_to_byte(&mut self)
Advances the reader such that the next bits will be from the start of a byte boundary. If the reader is already on a byte boundary, nothing is changed.