@NotThreadSafe public class HdfsFileInputStream 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.Constructor and Description |
---|
HdfsFileInputStream(FileInStream inputStream,
org.apache.hadoop.fs.FileSystem.Statistics stats)
Constructs a new stream for reading a file from HDFS.
|
HdfsFileInputStream(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
HdfsFileInputStream . |
long |
skip(long n) |
mark, markSupported, reset
public HdfsFileInputStream(FileSystem fs, AlluxioURI uri, org.apache.hadoop.fs.FileSystem.Statistics stats) throws IOException
fs
- the file systemuri
- the Alluxio file URIstats
- filesystem statisticsIOException
public HdfsFileInputStream(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
HdfsFileInputStream
.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.