diff --git a/src/bytebuffer.rs b/src/bytebuffer.rs index 0a23d3c..235f416 100644 --- a/src/bytebuffer.rs +++ b/src/bytebuffer.rs @@ -5,7 +5,7 @@ use byteorder::{BigEndian, ByteOrder}; /// - fixed size /// - big endian only pub struct ByteBuffer { - data: Vec, + pub data: Vec, pub fw_position: usize, pub bw_position: usize, } @@ -27,6 +27,13 @@ impl ByteBuffer { } } + pub fn put_u8v(&mut self, bytes: &Vec) { + for v in bytes { + self.data[self.fw_position] = *v; + self.fw_position += 1; + } + } + /// backward put unsigned byte array pub fn put_u8a_bw(&mut self, bytes: &[u8]) { self.bw_position -= bytes.len();