@NotThreadSafe public class BaseHdfsFileInputStream extends InputStream implements org.apache.hadoop.fs.Seekable, org.apache.hadoop.fs.PositionedReadable, org.apache.hadoop.fs.ByteBufferReadable
FileInStream
with additional statistics gathering in a FileSystem.Statistics
object.Modifier and Type | Field and Description |
---|---|
protected FileInStream |
mInputStream |
Constructor and Description |
---|
BaseHdfsFileInputStream(FileInStream inputStream,
org.apache.hadoop.fs.FileSystem.Statistics stats)
Constructs a new stream for reading a file from HDFS.
|
BaseHdfsFileInputStream(FileSystem fs,
AlluxioURI uri,
org.apache.hadoop.fs.FileSystem.Statistics stats)
Constructs a new stream for reading a file from HDFS.
|
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
close() |
long |
getPos() |
int |
read() |
int |
read(byte[] buffer) |
int |
read(byte[] buffer,
int offset,
int length) |
int |
read(ByteBuffer buf) |
int |
read(long position,
byte[] buffer,
int offset,
int length) |
void |
readFully(long position,
byte[] buffer) |
void |
readFully(long position,
byte[] buffer,
int offset,
int length) |
void |
seek(long pos) |
boolean |
seekToNewSource(long targetPos)
This method is not supported in
BaseHdfsFileInputStream . |
long |
skip(long n) |
mark, markSupported, reset
protected final FileInStream mInputStream
public BaseHdfsFileInputStream(FileSystem fs, AlluxioURI uri, org.apache.hadoop.fs.FileSystem.Statistics stats) throws IOException
fs
- the file systemuri
- the Alluxio file URIstats
- filesystem statisticsIOException
public BaseHdfsFileInputStream(FileInStream inputStream, org.apache.hadoop.fs.FileSystem.Statistics stats)
inputStream
- the input streamstats
- filesystem statisticspublic int available() throws IOException
available
in class InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
public long getPos() throws IOException
getPos
in interface org.apache.hadoop.fs.Seekable
IOException
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] buffer) throws IOException
read
in class InputStream
IOException
public int read(byte[] buffer, int offset, int length) throws IOException
read
in class InputStream
IOException
public int read(ByteBuffer buf) throws IOException
read
in interface org.apache.hadoop.fs.ByteBufferReadable
IOException
public int read(long position, byte[] buffer, int offset, int length) throws IOException
read
in interface org.apache.hadoop.fs.PositionedReadable
IOException
public void readFully(long position, byte[] buffer) throws IOException
readFully
in interface org.apache.hadoop.fs.PositionedReadable
IOException
public void readFully(long position, byte[] buffer, int offset, int length) throws IOException
readFully
in interface org.apache.hadoop.fs.PositionedReadable
IOException
public void seek(long pos) throws IOException
seek
in interface org.apache.hadoop.fs.Seekable
IOException
public boolean seekToNewSource(long targetPos) throws IOException
BaseHdfsFileInputStream
.seekToNewSource
in interface org.apache.hadoop.fs.Seekable
targetPos
- N/AIOException
- alwayspublic long skip(long n) throws IOException
skip
in class InputStream
IOException
Copyright © 2023. All Rights Reserved.