lib/protocol/http/body/stream.rb in protocol-http-0.25.0 vs lib/protocol/http/body/stream.rb in protocol-http-0.26.0

- old
+ new

@@ -1,9 +1,9 @@ # frozen_string_literal: true # Released under the MIT License. -# Copyright, 2019-2023, by Samuel Williams. +# Copyright, 2019-2024, by Samuel Williams. # Copyright, 2023, by Genki Takiuchi. require_relative 'buffered' module Protocol @@ -94,9 +94,13 @@ buffer.slice!(length, buffer.bytesize) end end return buffer + end + + def readpartial(length) + read_partial(length) or raise EOFError, "End of file reached!" end def read_nonblock(length, buffer = nil) @buffer ||= read_next chunk = nil