@NotThreadSafe
public class HdfsFileInputStream
extends java.io.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(java.nio.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) |
public HdfsFileInputStream(FileSystem fs, AlluxioURI uri, org.apache.hadoop.fs.FileSystem.Statistics stats) throws java.io.IOException
fs - the file systemuri - the Alluxio file URIstats - filesystem statisticsjava.io.IOExceptionpublic HdfsFileInputStream(FileInStream inputStream, org.apache.hadoop.fs.FileSystem.Statistics stats)
inputStream - the input streamstats - filesystem statisticspublic int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOExceptionpublic 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 getPos()
throws java.io.IOException
getPos in interface org.apache.hadoop.fs.Seekablejava.io.IOExceptionpublic int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] buffer)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] buffer,
int offset,
int length)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(java.nio.ByteBuffer buf)
throws java.io.IOException
read in interface org.apache.hadoop.fs.ByteBufferReadablejava.io.IOExceptionpublic int read(long position,
byte[] buffer,
int offset,
int length)
throws java.io.IOException
read in interface org.apache.hadoop.fs.PositionedReadablejava.io.IOExceptionpublic void readFully(long position,
byte[] buffer)
throws java.io.IOException
readFully in interface org.apache.hadoop.fs.PositionedReadablejava.io.IOExceptionpublic void readFully(long position,
byte[] buffer,
int offset,
int length)
throws java.io.IOException
readFully in interface org.apache.hadoop.fs.PositionedReadablejava.io.IOExceptionpublic void seek(long pos)
throws java.io.IOException
seek in interface org.apache.hadoop.fs.Seekablejava.io.IOExceptionpublic boolean seekToNewSource(long targetPos)
throws java.io.IOException
HdfsFileInputStream.seekToNewSource in interface org.apache.hadoop.fs.SeekabletargetPos - N/Ajava.io.IOException - alwayspublic long skip(long n)
throws java.io.IOException
skip in class java.io.InputStreamjava.io.IOExceptionCopyright © 2023. All Rights Reserved.