| Modifier and Type | Field and Description |
|---|---|
| protected BufferedIOBase | reader
The buffered reader |
| protected BufferedIOBase | writer
The buffered writer |
| Access | Constructor and Description |
|---|---|
| public | BufferedRandom(RawIOBase rawIO, int bufferSize)
Construct a BufferedRandom of bufferSize, wrapping the given RawIOBase. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| protected void | |
| public ByteBuffer | peek(int
the minimal number of bytes as an int size)Overrides org. Returns buffered bytes without advancing the position. |
| public ByteBuffer | read(int
the number of bytes to read size)Overrides org. Read and return up to size bytes, contained in a ByteBuffer. |
| public int | read1(ByteBuffer
a ByteBuffer to read bytes into bytes)Overrides org. Reads up to bytes.remaining() bytes. |
| public ByteBuffer | |
| public int | readinto(ByteBuffer
a ByteBuffer to read bytes into bytes)Overrides org. Read up to bytes.remaining() bytes into the given ByteBuffer. |
| public long | seek(long
a long position value pos, int an int whence value whence)Overrides org. Seek to byte offset |
| public long | |
| public int | write(ByteBuffer
a ByteBuffer value bytes)Overrides org. Write the given ByteBuffer to the IO stream. |
| reader | back to summary |
|---|---|
| protected BufferedIOBase reader The buffered reader | |
| writer | back to summary |
|---|---|
| protected BufferedIOBase writer The buffered writer | |
| BufferedRandom | back to summary |
|---|---|
| public BufferedRandom(RawIOBase rawIO, int bufferSize) Construct a BufferedRandom of bufferSize, wrapping the given RawIOBase. | |
| flush | back to summary |
|---|---|
| public void flush() Overrides org. Doc from org. Flushes write buffers, if applicable. This is a no-op for read-only and non-blocking streams.
| |
| initChildBuffers | back to summary |
|---|---|
| protected void initChildBuffers() Initialize the child read/write buffers. | |
| peek | back to summary |
|---|---|
| public ByteBuffer peek(int size) Overrides org. Doc from org. Returns buffered bytes without advancing the position. The argument indicates a desired minimal number of bytes; we do at most one raw read to satisfy it. We never return more than the size of the underlying buffer;
| |
| read | back to summary |
|---|---|
| public ByteBuffer read(int size) Overrides org. Doc from org. Read and return up to size bytes, contained in a ByteBuffer. ByteBuffers returned from read are already flip()'d. Returns an empty ByteBuffer on EOF
| |
| read1 | back to summary |
|---|---|
| public int read1(ByteBuffer bytes) Overrides org. Doc from org. Reads up to bytes.remaining() bytes. Returns up to bytes.remaining() bytes. If at least one byte is buffered, we only return buffered bytes. Otherwise, we do one raw read.
| |
| readall | back to summary |
|---|---|
| public ByteBuffer readall() Overrides org. Doc from org. Read until EOF.
| |
| readinto | back to summary |
|---|---|
| public int readinto(ByteBuffer bytes) Overrides org. Doc from org. Read up to bytes.remaining() bytes into the given ByteBuffer. Returns number of bytes read (0 for EOF).
| |
| seek | back to summary | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| public long seek(long pos, int whence) Overrides org. Doc from org. Seek to byte offset
a long position value seeked to | |||||||||||||
| tell | back to summary |
|---|---|
| public long tell() Overrides org. Doc from org. Return the current stream position.
| |
| write | back to summary |
|---|---|
| public int write(ByteBuffer bytes) Overrides org. Doc from org. Write the given ByteBuffer to the IO stream. Returns the number of bytes written, which may be less than bytes.remaining().
| |