BufferingResource
Wraps a Resource and buffers its content.
Expensive interaction with the underlying resource is minimized, since most (smaller) requests can be satisfied by accessing the buffer alone. The drawback is that some extra space is required to hold the buffer and that copying takes place when filling that buffer, but this is usually outweighed by the performance benefits.
Note that this implementation is pretty limited and the benefits are only apparent when reading forward and consecutively – e.g. when downloading the resource by chunks. The buffer is ignored when reading backward or far ahead.
Parameters
Underlying resource which will be buffered.
The total length of the resource, when known. This can improve performance by avoiding requesting the length from the underlying resource.
Size of the buffer chunks to read.
Functions
Wraps a Readable into an InputStream.
Wraps this resource into a buffer to improve reading performances.
Wraps this resource in a BufferingResource to improve reading performances.
Properties associated to the resource.
Wraps this resource in a SynchronizedResource to protect the access from multiple threads.