Package alluxio.underfs.hdfs
Class HdfsPositionedUnderFileInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- alluxio.underfs.SeekableUnderFileInputStream
-
- alluxio.underfs.hdfs.HdfsPositionedUnderFileInputStream
-
- All Implemented Interfaces:
alluxio.Positioned
,alluxio.PositionReader
,alluxio.Seekable
,java.io.Closeable
,java.lang.AutoCloseable
public class HdfsPositionedUnderFileInputStream extends alluxio.underfs.SeekableUnderFileInputStream implements alluxio.PositionReader
The input stream of HDFS as under filesystem. This input stream has two mode of operations. Under sequential mode, it uses the read api and can take advantage of underlying stream's buffering. Under random read mode, it uses the positionedReadFSDataInputStream
API. This stream can be cached for reuse.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
long
getPos()
boolean
markSupported()
int
read()
int
read(byte[] b)
int
read(byte[] buffer, int offset, int length)
If there has been a number of sequential reads in a row, we move to regular buffered reads.int
readInternal(long position, alluxio.file.ReadTargetBuffer buffer, int length)
void
seek(long position)
long
skip(long n)
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Method Detail
-
available
public int available() throws java.io.IOException
- Overrides:
available
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
getPos
public long getPos()
- Specified by:
getPos
in interfacealluxio.Positioned
-
read
public int read()
- Overrides:
read
in classjava.io.FilterInputStream
-
read
public int read(byte[] b)
- Overrides:
read
in classjava.io.FilterInputStream
-
read
public int read(byte[] buffer, int offset, int length)
If there has been a number of sequential reads in a row, we move to regular buffered reads.- Overrides:
read
in classjava.io.FilterInputStream
-
seek
public void seek(long position)
- Specified by:
seek
in interfacealluxio.Seekable
-
skip
public long skip(long n)
- Overrides:
skip
in classjava.io.FilterInputStream
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classjava.io.FilterInputStream
-
readInternal
public int readInternal(long position, alluxio.file.ReadTargetBuffer buffer, int length) throws java.io.IOException
- Specified by:
readInternal
in interfacealluxio.PositionReader
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfacealluxio.PositionReader
- Overrides:
close
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
-