StreamingBody | R Documentation |
StreamingBody
classStreamingBody
class
StreamingBody
class
This R6 class is used to represent the body of a streaming response.
When using this in mocked responses, you can either create a new instance
using your own connection or use a subclass for some other representation.
In either case, you will pass to the body
argument of new_response()
.
new()
Create a new object
StreamingBody$new(conn)
conn
A connection, that is open and ready for reading.
StreamingBody
will take care of closing it.'
read()
Read n
bytes into a raw vector.
StreamingBody$read(n)
n
Number of bytes to read
read_all()
Read all bytes and close the connection.
StreamingBody$read_all(buffer = 32 * 1024)
buffer
Buffer size, in bytes.
is_open()
Is the connection still open?
StreamingBody$is_open()
is_complete()
Is the connection complete? (i.e. is there data remaining to be read?)
StreamingBody$is_complete()
get_fdset()
Get the active file descriptions and timeout from the
handle. Wrapper around curl::multi_fdset()
. Returns NULL
if handle
not set.
StreamingBody$get_fdset()
close()
Close the connection
StreamingBody$close()
clone()
The objects of this class are cloneable with this method.
StreamingBody$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.