(class)
| constructor
public
| {DefaultBufferedInputStream-of.default stream:{InputStream-of t}, close-stream-on-close?:bool = true, buffer-size:int = {calculate-instances-per-memory-size
default-buffer-memory-size, t
}, unread-size:int = {max {min 4, buffer-size div 4}, 1} } |
accessor protected DefaultBufferedInputStream-of.fill-data-allow-short-read-supported?:
bool
accessor protected DefaultBufferedInputStream-of.fill-data-non-blocking-supported?:
bool
| open?: | Indicate if this Stream is currently open, should return false once Stream-of.close has been called. |
accessor public DefaultBufferedInputStream-of.open?:
bool
| origin-url: | Returns the Url that this stream was opened from, or null, if no such Url exists. |
accessor public DefaultBufferedInputStream-of.origin-url:#
Url
field public-get protected-set DefaultBufferedInputStream-of.underlying-input-stream:{
InputStream-of t}
accessor public DefaultBufferedInputStream-of.when-last-modified:#
DateTime
| close: | Close Stream, should make stream un-usable and make sure that Stream-of.open? return false once this has been called. |
|
public
| {DefaultBufferedInputStream-of.close}:void |
| fill-data: | Routine which buffering code will call to get more data from underlying thing. |
|
protected
| {DefaultBufferedInputStream-of.fill-data buf:{Array-of t}, min-read:int, start:int = 0, max-read:int = buf.size - start }:(int, eof?:bool) |
(constructor)
| public
| {DefaultBufferedInputStream-of.default stream:{InputStream-of t}, close-stream-on-close?:bool = true, buffer-size:int = {calculate-instances-per-memory-size
default-buffer-memory-size, t
}, unread-size:int = {max {min 4, buffer-size div 4}, 1} } |
close-stream-on-close?: specifies whether this class's close method should invoke close on the underlying stream.
buffer-size: Approximately how many items the main buffer should hold. Must be greater than 0.
unread-size: Approximately how many items should be able to be held for successive unread-one operations.
Notes
The amount of space available for unreading can grow dynamically, but such growth is expensive. Unread space is never used for other purposes. The main buffer will not grow.
(accessor)
accessor protected DefaultBufferedInputStream-of.fill-data-allow-short-read-supported?:
bool Indicate if fill-data should be able to do short reads.
Notes
This may be checked to decide how to call fill-data.
(accessor)
accessor protected DefaultBufferedInputStream-of.fill-data-non-blocking-supported?:
bool Indicate if fill-data should be able to do non-blocking.
Notes
This may be checked to decide how to call fill-data.
(accessor)
accessor public DefaultBufferedInputStream-of.open?:
bool Indicate if this Stream is currently open, should return false once Stream-of.close has been called.
Notes
Overriding
Subclasses must provide this.
(accessor)
accessor public DefaultBufferedInputStream-of.origin-url:#
Url Returns the Url that this stream was opened from, or null, if no such Url exists.
Example
{read-open {url "file://c:/foo.txt"}}.origin-url
would return the
Url file://c:/foo.txt (assuming such a file exists).
On the other hand,
{{TextInputStream-from String} "foo"}.origin-url would return
null.
(field)
public-get protected-set DefaultBufferedInputStream-of.underlying-input-stream:{
InputStream-of t}
(accessor)
accessor public DefaultBufferedInputStream-of.when-last-modified:#
DateTime Time of most recent modification of underlying data, if available.
Description
Returns most recent modification time of underlying data, if this is known, otherwise returns null.
For streams that originate from a
http: URL, this is the time parsed from the
Last-Modified HTTP header, if present.
For streams that wrap other streams (such as
DefaultBufferedInputStream-of), this will typically be the value from the underlying stream.
Other streams will return null.
(method)
| public
| {DefaultBufferedInputStream-of.close}:void |
Close Stream, should make stream un-usable and make sure that Stream-of.open? return false once this has been called.
(method)
| protected
| {DefaultBufferedInputStream-of.fill-data buf:{Array-of t}, min-read:int, start:int = 0, max-read:int = buf.size - start }:(int, eof?:bool) |
Routine which buffering code will call to get more data from underlying thing.
buf: Array to read data into, may be the buffer or a user supplied Array.
min-read: Minimum amount that this routine must read, unless it hits the end of the data, before returning.
start: Starting place in buf to start storing the read data.
max-read: Maximum amount that this routine can read into buf before it must return. May exceed available space in buf, in which case buf should be resized for amount read.
Returns
Returns number of items read, and if it is at EOF. eof? may be true even when data was read, but this is not required, implementors may choose to only return eof? as true when there is no data.
Notes
buf should not be resized down to amount read, only up, if needed. A
min-read of
0 basically implies that the caller is expecting the same semantics as if
non-blocking? were
true in a call to
InputStream-of.read. A
min-read of
1 basically implies that the caller is expecting the same semantics as if
allow-short-read? were
true in a call to
InputStream-of.read. And generally, if
min-read does not equal
max-read, then the routine should not do anything expensive or slow once it has read in
min-read, but it should try to read
max-read data if readily possible.
Overriding
Override this in a subclass to provide the data from the data source to be buffered.