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. |
| Constructor and Description |
|---|
RandomAccessFileInputStream(java.io.RandomAccessFile file)
Deprecated.
|
RandomAccessFileInputStream(java.io.RandomAccessFile file,
boolean propagateClose)
Deprecated.
|
| 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,
java.io.OutputStream os)
Copies our bytes from the given starting position for a size to the output stream.
|
java.io.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) |
isClosed, setClosed@Deprecated public RandomAccessFileInputStream(java.io.RandomAccessFile file)
builder(), RandomAccessFileInputStream.Builder, and RandomAccessFileInputStream.Builder.get()file - The file to stream.@Deprecated
public RandomAccessFileInputStream(java.io.RandomAccessFile file,
boolean propagateClose)
builder(), RandomAccessFileInputStream.Builder, and RandomAccessFileInputStream.Builder.get()file - The file to stream.propagateClose - Whether to close the underlying file when this stream is closed.public static RandomAccessFileInputStream.Builder builder()
RandomAccessFileInputStream.Builder.RandomAccessFileInputStream.Builder.public int available()
throws java.io.IOException
If there are more than Integer.MAX_VALUE bytes available, return Integer.MAX_VALUE.
available in class java.io.InputStreamjava.io.IOException - If an I/O error occurs.public long availableLong()
throws java.io.IOException
java.io.IOException - If an I/O error occurs.public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class AbstractInputStreamjava.io.IOExceptionpublic long copy(long pos,
long size,
java.io.OutputStream os)
throws java.io.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.java.io.IOException - if pos is less than 0 or if an I/O error occurs.public java.io.RandomAccessFile getRandomAccessFile()
public boolean isCloseOnClose()
public int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] bytes)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] bytes,
int offset,
int length)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic long skip(long skipCount)
throws java.io.IOException
skip in class java.io.InputStreamjava.io.IOExceptionCopyright © 2010 - 2025 Adobe. All Rights Reserved