MCPcopy Create free account
hub / github.com/apache/arrow-rs / get_bytes

Method get_bytes

parquet/src/file/reader.rs:99–113  ·  view source on GitHub ↗
(&self, start: u64, length: usize)

Source from the content-addressed store, hash-verified

97 }
98
99 fn get_bytes(&self, start: u64, length: usize) -> Result<Bytes> {
100 let mut buffer = Vec::with_capacity(length);
101 let mut reader = self.try_clone()?;
102 reader.seek(SeekFrom::Start(start))?;
103 let read = reader.take(length as _).read_to_end(&mut buffer)?;
104
105 if read != length {
106 return Err(eof_err!(
107 "Expected to read {} bytes, read only {}",
108 length,
109 read
110 ));
111 }
112 Ok(buffer.into())
113 }
114}
115
116impl Length for Bytes {

Calls 4

seekMethod · 0.80
takeMethod · 0.45
lenMethod · 0.45
sliceMethod · 0.45