public class RandomAccessFileInputStream extends AbstractInputStream
RandomAccessFile starting at its current position.
To build an instance, use RandomAccessFileInputStream.Builder.
RandomAccessFileInputStream.Builder| Modifier and Type | Class and Description |
|---|---|
static class |
RandomAccessFileInputStream.Builder
Builds a new
RandomAccessFileInputStream. |
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Gets an estimate of the number of bytes that can be read (or skipped over) from this input stream.
|
long |
availableLong()
Gets the number of bytes that can be read (or skipped over) from this input stream.
|
static RandomAccessFileInputStream.Builder |
builder()
Constructs a new
RandomAccessFileInputStream.Builder. |
void |
close() |
long |
copy(long pos,
long size,
OutputStream os)
Copies our bytes from the given starting position for a size to the output stream.
|
RandomAccessFile |
getRandomAccessFile()
Gets the underlying file.
|
boolean |
isCloseOnClose()
Tests whether to close the underlying file when this stream is closed, defaults to false for compatibility.
|
int |
read() |
int |
read(byte[] bytes) |
int |
read(byte[] bytes,
int offset,
int length) |
long |
skip(long skipCount) |
checkOpen, isClosed, setClosedmark, markSupported, resetpublic int available()
throws IOException
If there are more than Integer.MAX_VALUE bytes available, return Integer.MAX_VALUE.
available in class InputStreamIOException - If an I/O error occurs.public long availableLong()
throws IOException
IOException - If an I/O error occurs.public static RandomAccessFileInputStream.Builder builder()
RandomAccessFileInputStream.Builder.RandomAccessFileInputStream.Builder.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class AbstractInputStreamIOExceptionpublic long copy(long pos,
long size,
OutputStream os)
throws IOException
pos - Where to start copying. The offset position, measured in bytes from the beginning of the file, at which to set the file pointer.size - The number of bytes to copy.os - Where to copy.IOException - if pos is less than 0 or if an I/O error occurs.public RandomAccessFile getRandomAccessFile()
public boolean isCloseOnClose()
public int read()
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] bytes)
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] bytes,
int offset,
int length)
throws IOException
read in class InputStreamIOExceptionpublic long skip(long skipCount)
throws IOException
skip in class InputStreamIOException