File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -237,6 +237,13 @@ function Base.nb_available(stream::TranscodingStream)
237
237
return buffersize (stream. state. buffer1)
238
238
end
239
239
240
+ function Base. readavailable (stream:: TranscodingStream )
241
+ n = nb_available (stream)
242
+ data = Vector {UInt8} (n)
243
+ unsafe_read (stream, pointer (data), n)
244
+ return data
245
+ end
246
+
240
247
241
248
# Write Functions
242
249
# ---------------
Original file line number Diff line number Diff line change 172
172
end
173
173
174
174
@testset " Noop Codec" begin
175
+ stream = NoopStream (IOBuffer (" foobar" ))
176
+ @test nb_available (stream) === 0
177
+ @test readavailable (stream) == b ""
178
+ @test read (stream, UInt8) === UInt8 (' f' )
179
+ @test nb_available (stream) === 5
180
+ @test readavailable (stream) == b " oobar"
181
+ close (stream)
182
+
175
183
data = b " foo"
176
184
@test transcode (Noop (), data) != = data
177
185
TranscodingStreams. test_roundtrip_transcode (Noop, Noop)
You can’t perform that action at this time.
0 commit comments