public class HdfsFileInputStream extends InputStream implements org.apache.hadoop.fs.Seekable, org.apache.hadoop.fs.PositionedReadable
Constructor and Description |
---|
HdfsFileInputStream(TachyonFS tfs,
int fileId,
org.apache.hadoop.fs.Path hdfsPath,
org.apache.hadoop.conf.Configuration conf,
int bufferSize) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
long |
getPos()
Return the current offset from the start of the file
|
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
int |
read(long position,
byte[] buffer,
int offset,
int length)
Read upto the specified number of bytes, from a given position within a
file, and return the number of bytes read.
|
void |
readFully(long position,
byte[] buffer)
Read number of bytes equalt to the length of the buffer, from a given
position within a file.
|
void |
readFully(long position,
byte[] buffer,
int offset,
int length)
Read the specified number of bytes, from a given position within a file.
|
void |
seek(long pos)
Seek to the given offset from the start of the file.
|
boolean |
seekToNewSource(long targetPos)
Seeks a different copy of the data.
|
available, mark, markSupported, reset, skip
public HdfsFileInputStream(TachyonFS tfs, int fileId, org.apache.hadoop.fs.Path hdfsPath, org.apache.hadoop.conf.Configuration conf, int bufferSize) throws IOException
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[] 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 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
seekToNewSource
in interface org.apache.hadoop.fs.Seekable
IOException
Copyright © 2014. All rights reserved.