[−][src]Struct iostream::io::stream_rw::stream_reader::StreamReader
reader stream struct
Fields
base_stream: &'a mut dyn Stream
Methods
impl<'a> StreamReader<'a>
[src]
pub fn from(stream: &'a mut dyn Stream) -> Result<StreamReader<'a>, String>
[src]
from stream use LittleEndian reader integer
Examples
use iostream::io::*; let mut ms=MemoryStream::new(); //...write data to ms let mut ws: StreamReader = StreamReader::from(&mut ms).unwrap();
pub fn from_big_endian(
stream: &'a mut dyn Stream
) -> Result<StreamReader<'a>, String>
[src]
stream: &'a mut dyn Stream
) -> Result<StreamReader<'a>, String>
from stream use BigEndian reader integer
Examples
use iostream::io::*; let mut ms=MemoryStream::new(); //...write data to ms let mut ws: StreamReader = StreamReader::from_big_endian(&mut ms).unwrap();
pub fn peek(&mut self) -> Result<u8, StreamError>
[src]
peek the current stream next byte
pub fn read_byte(&mut self) -> Result<u8, StreamError>
[src]
read u8 from stream
pub fn read_all(&mut self, buf: &mut Vec<u8>) -> Result<usize, StreamError>
[src]
read vec
pub fn read(
&mut self,
buf: &mut [u8],
offset: usize,
count: usize
) -> Result<usize, StreamError>
[src]
&mut self,
buf: &mut [u8],
offset: usize,
count: usize
) -> Result<usize, StreamError>
read u8 from stream,can use offset and count buff position,return read len
pub fn read_i16(&mut self) -> Result<i16, StreamError>
[src]
read i16 from stream,return it value
pub fn read_u16(&mut self) -> Result<u16, StreamError>
[src]
read u16 from stream,return it value
pub fn read_u32(&mut self) -> Result<u32, StreamError>
[src]
read u32 from stream,return it value
pub fn read_i32(&mut self) -> Result<i32, StreamError>
[src]
read i32 from stream,return it value
pub fn read_i64(&mut self) -> Result<i64, StreamError>
[src]
read i64 from stream,return it value
pub fn read_u64(&mut self) -> Result<u64, StreamError>
[src]
read u64 from stream,return it value
pub fn read_single(&mut self) -> Result<f32, StreamError>
[src]
read f32 from stream,return it value
pub fn read_double(&mut self) -> Result<f64, StreamError>
[src]
read f64 from stream,return it value
pub fn read_u8_array(&mut self, len: u32) -> Result<Vec<u8>, StreamError>
[src]
read vec
Examples
use iostream::io::*; let mut ms=MemoryStream::new(); let data:[u8;1024]=[5;1024]; ms.write_all(&data).unwrap(); ms.set_position(0).unwrap(); let mut rs=StreamReader::from(&mut ms).unwrap(); let rt= rs.read_u8_array(1024).unwrap(); assert_eq!(data[..],rt[..] );
pub fn read_string(&mut self) -> Result<String, Box<dyn Error>>
[src]
read string to current stream
pub fn read_line(&mut self) -> Result<String, Box<dyn Error>>
[src]
read str line from current stream
pub fn read_all_lines(&mut self) -> Result<Vec<String>, Box<dyn Error>>
[src]
read all str line from current stream
pub fn read_all_text(&mut self) -> Result<String, Box<dyn Error>>
[src]
read all data to string
Auto Trait Implementations
impl<'a> !Send for StreamReader<'a>
impl<'a> !Sync for StreamReader<'a>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,