From: dsisnero@... Date: 2021-04-26T22:40:02+00:00 Subject: [ruby-core:103606] [Ruby master Feature#17833] add IO.readinto(b) where b is a bytes like object that is you can get a memoryview from Issue #17833 has been reported by dsisnero (Dominic Sisneros). ---------------------------------------- Feature #17833: add IO.readinto(b) where b is a bytes like object that is you can get a memoryview from https://bugs.ruby-lang.org/issues/17833 * Author: dsisnero (Dominic Sisneros) * Status: Open * Priority: Normal ---------------------------------------- assuming you have a ByteArray class that we can get a memoryview from ba = ByteArray.new(8) mv_at_4 = Fiddle::MemoryView.new(ba)[4..-1] f = File.open('/dev/urandom', 'rb'){|s| s.readinto(mv_at_4) # write the content of /dev/urandom from offset 4 to the end of the bytearray, effectively reading only 4 bytes -- https://bugs.ruby-lang.org/ Unsubscribe: