@NotThreadSafe public class LocalCacheFileInStream extends FileInStream
FileInStream that reads from a local cache if possible.| Modifier and Type | Class and Description |
|---|---|
static interface |
LocalCacheFileInStream.FileInStreamOpener
Interface to wrap open method of file system.
|
| Modifier and Type | Field and Description |
|---|---|
protected long |
mPageSize
Page size in bytes.
|
| Constructor and Description |
|---|
LocalCacheFileInStream(URIStatus status,
LocalCacheFileInStream.FileInStreamOpener fileOpener,
CacheManager cacheManager,
AlluxioConfiguration conf)
Constructor when the
URIStatus is already available. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected com.google.common.base.Stopwatch |
createUnstartedStopwatch() |
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(byte[] bytesBuffer,
int offset,
int length) |
int |
read(java.nio.ByteBuffer buffer,
int offset,
int length)
Reads up to len bytes of data from the input stream into the byte buffer.
|
static void |
registerMetrics()
Registers metrics.
|
long |
remaining() |
void |
seek(long pos) |
long |
skip(long n) |
read, read, readpublic LocalCacheFileInStream(URIStatus status, LocalCacheFileInStream.FileInStreamOpener fileOpener, CacheManager cacheManager, AlluxioConfiguration conf)
URIStatus is already available.status - file statusfileOpener - open file in the external file system if a cache miss occurscacheManager - local cache managerconf - configurationpublic static void registerMetrics()
public int read(byte[] bytesBuffer,
int offset,
int length)
throws java.io.IOException
read in class FileInStreamjava.io.IOExceptionpublic int read(java.nio.ByteBuffer buffer,
int offset,
int length)
throws java.io.IOException
FileInStreamread in class FileInStreambuffer - the buffer into which the data is readoffset - the start offset in the buffer at which the data is writtenlength - the maximum number of bytes to readjava.io.IOExceptionprotected com.google.common.base.Stopwatch createUnstartedStopwatch()
public long skip(long n)
skip in class java.io.InputStreampublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOExceptionpublic long remaining()
public int positionedRead(long pos,
byte[] b,
int off,
int len)
throws java.io.IOException
PositionedReadablepos - position within fileb - destination bufferoff - offset in the bufferlen - number of bytes to readjava.io.IOExceptionpublic long getPos()
public void seek(long pos)
Copyright © 2022. All Rights Reserved.