LineBufferedRandom
public class BufferedRandom extends BufferedIOMixin
DEFAULT_BUFFER_SIZE
Constructor | Description |
---|---|
BufferedRandom(RawIOBase rawIO,
int bufferSize) |
Construct a BufferedRandom of bufferSize, wrapping the given
RawIOBase.
|
Modifier and Type | Method | Description |
---|---|---|
void |
flush() |
Flushes write buffers, if applicable.
|
java.nio.ByteBuffer |
peek(int size) |
Returns buffered bytes without advancing the position.
|
java.nio.ByteBuffer |
read(int size) |
Read and return up to size bytes, contained in a ByteBuffer.
|
int |
read1(java.nio.ByteBuffer bytes) |
Reads up to bytes.remaining() bytes.
|
java.nio.ByteBuffer |
readall() |
Read until EOF.
|
int |
readinto(java.nio.ByteBuffer bytes) |
Read up to bytes.remaining() bytes into the given ByteBuffer.
|
long |
seek(long pos,
int whence) |
Seek to byte offset pos relative to position indicated by whence: 0 Start of stream (the
default). pos should be >= 0; 1 Current position - whence may be negative; 2 End of stream -
whence usually negative.
|
long |
tell() |
Return the current stream position.
|
int |
write(java.nio.ByteBuffer bytes) |
Write the given ByteBuffer to the IO stream.
|
buffered, clear
asInputStream, asOutputStream, close, closed, fileno, isatty, readable, truncate, writable
checkClosed, checkReadable, checkWritable, seek
public BufferedRandom(RawIOBase rawIO, int bufferSize)
rawIO
- bufferSize
- public long seek(long pos, int whence)
IOBase
seek
in class BufferedIOMixin
pos
- a long position valuewhence
- an int whence valuepublic long tell()
IOBase
tell
in class BufferedIOMixin
public java.nio.ByteBuffer read(int size)
BufferedIOBase
read
in class BufferedIOBase
size
- the number of bytes to readpublic java.nio.ByteBuffer readall()
BufferedIOBase
readall
in class BufferedIOBase
public int readinto(java.nio.ByteBuffer bytes)
BufferedIOBase
readinto
in class BufferedIOBase
bytes
- a ByteBuffer to read bytes intopublic int write(java.nio.ByteBuffer bytes)
BufferedIOBase
write
in class BufferedIOBase
bytes
- a ByteBuffer valuepublic java.nio.ByteBuffer peek(int size)
BufferedIOBase
peek
in class BufferedIOBase
size
- the minimal number of bytes as an intpublic int read1(java.nio.ByteBuffer bytes)
BufferedIOBase
read1
in class BufferedIOBase
bytes
- a ByteBuffer to read bytes intopublic void flush()
IOBase
flush
in class BufferedIOMixin