@NotThreadSafe public class LocalCacheFileInStream extends FileInStream
FileInStream
that reads from a local cache if possible.Modifier and Type | Field and Description |
---|---|
protected long |
mPageSize
Page size in bytes.
|
Constructor and Description |
---|
LocalCacheFileInStream(AlluxioURI path,
OpenFilePOptions options,
FileSystem externalFs,
CacheManager cacheManager)
Constructor when only path information is available.
|
LocalCacheFileInStream(URIStatus status,
OpenFilePOptions options,
FileSystem externalFs,
CacheManager cacheManager)
Constructor when the
URIStatus is already available. |
Modifier and Type | Method and Description |
---|---|
void |
close() |
long |
getPos() |
int |
positionedRead(long pos,
byte[] b,
int off,
int len)
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 |
read(byte[] b,
int off,
int len) |
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) |
available, mark, markSupported, reset
public LocalCacheFileInStream(AlluxioURI path, OpenFilePOptions options, FileSystem externalFs, CacheManager cacheManager)
path
- path of the fileoptions
- read optionsexternalFs
- the external file system if a cache miss occurscacheManager
- local cache managerpublic LocalCacheFileInStream(URIStatus status, OpenFilePOptions options, FileSystem externalFs, CacheManager cacheManager)
URIStatus
is already available.status
- file statusoptions
- read optionsexternalFs
- the external file system if a cache miss occurscacheManager
- local cache managerpublic int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b) throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public long skip(long n)
skip
in class InputStream
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
public long remaining()
public int positionedRead(long pos, byte[] b, int off, int len) throws IOException
PositionedReadable
pos
- position within fileb
- destination bufferoff
- offset in the bufferlen
- number of bytes to readIOException
public long getPos()
public void seek(long pos)
Seekable
pos
- the position to seek to, it must be between 0 and the end of the stream - 1Copyright © 2023. All Rights Reserved.