@NotThreadSafe public class UfsFileInStream extends FileInStream
Constructor and Description |
---|
UfsFileInStream(java.util.function.Function<Long,InputStream> fileOpener,
long fileLength)
Creates a new
UfsFileInStream . |
Modifier and Type | Method and Description |
---|---|
void |
close() |
long |
getPos() |
int |
positionedRead(long position,
byte[] buffer,
int offset,
int length)
Reads up to the specified number of bytes, from a given position within a file, and return the
number of bytes read.
|
int |
read() |
int |
read(byte[] b,
int off,
int len) |
int |
read(ByteBuffer byteBuffer,
int off,
int len)
Reads up to len bytes of data from the input stream into the byte buffer.
|
long |
remaining() |
void |
seek(long pos)
Moves the starting read position of the stream to the specified position which is relative to
the start of the stream.
|
long |
skip(long n) |
read, read, unbuffer
available, mark, markSupported, reset
public UfsFileInStream(java.util.function.Function<Long,InputStream> fileOpener, long fileLength)
UfsFileInStream
.fileOpener
- the file opener to open an ufs in stream with offsetfileLength
- the file lengthpublic int read() throws IOException
read
in class FileInStream
IOException
public int read(ByteBuffer byteBuffer, int off, int len) throws IOException
FileInStream
read
in class FileInStream
byteBuffer
- the buffer into which the data is readoff
- the start offset in the buffer at which the data is writtenlen
- the maximum number of bytes to readIOException
public int read(byte[] b, int off, int len) throws IOException
read
in class FileInStream
IOException
public long skip(long n) throws IOException
skip
in class InputStream
IOException
public long remaining()
public int positionedRead(long position, byte[] buffer, int offset, int length) throws IOException
PositionedReadable
position
- position within filebuffer
- destination bufferoffset
- offset in the bufferlength
- number of bytes to readIOException
public long getPos() throws IOException
IOException
public void seek(long pos) throws IOException
Seekable
pos
- the position to seek to, it must be between 0 and the end of the stream - 1IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
Copyright © 2023. All Rights Reserved.