Package org.apache.hadoop.hbase.io
Class FileLink.FileLinkInputStream
java.lang.Object
java.io.InputStream
org.apache.hadoop.hbase.io.FileLink.FileLinkInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.hadoop.fs.CanSetDropBehind
,org.apache.hadoop.fs.CanSetReadahead
,org.apache.hadoop.fs.CanUnbuffer
,org.apache.hadoop.fs.PositionedReadable
,org.apache.hadoop.fs.Seekable
- Enclosing class:
- FileLink
protected static class FileLink.FileLinkInputStream
extends InputStream
implements org.apache.hadoop.fs.Seekable, org.apache.hadoop.fs.PositionedReadable, org.apache.hadoop.fs.CanSetDropBehind, org.apache.hadoop.fs.CanSetReadahead, org.apache.hadoop.fs.CanUnbuffer
FileLink InputStream that handles the switch between the original path and the alternative
locations, when the file is moved.
-
Field Summary
Modifier and TypeFieldDescriptionprivate final int
private org.apache.hadoop.fs.Path
private final FileLink
private final org.apache.hadoop.fs.FileSystem
private org.apache.hadoop.fs.FSDataInputStream
private long
-
Constructor Summary
ConstructorDescriptionFileLinkInputStream
(org.apache.hadoop.fs.FileSystem fs, FileLink fileLink) FileLinkInputStream
(org.apache.hadoop.fs.FileSystem fs, FileLink fileLink, int bufferSize) -
Method Summary
Modifier and TypeMethodDescriptionint
void
close()
org.apache.hadoop.fs.Path
long
getPos()
private org.apache.hadoop.fs.FSDataInputStream
void
mark
(int readlimit) boolean
int
read()
int
read
(byte[] b) int
read
(byte[] b, int off, int len) 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
reset()
void
seek
(long pos) boolean
seekToNewSource
(long targetPos) void
setDropBehind
(Boolean dropCache) void
setReadahead
(Long readahead) long
skip
(long n) private org.apache.hadoop.fs.FSDataInputStream
tryOpen()
Try to open the file from one of the available locations.void
unbuffer()
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.hadoop.fs.PositionedReadable
maxReadSizeForVectorReads, minSeekForVectorReads, readVectored
-
Field Details
-
in
-
currentPath
-
pos
-
fileLink
-
bufferSize
-
fs
-
-
Constructor Details
-
FileLinkInputStream
public FileLinkInputStream(org.apache.hadoop.fs.FileSystem fs, FileLink fileLink) throws IOException - Throws:
IOException
-
FileLinkInputStream
public FileLinkInputStream(org.apache.hadoop.fs.FileSystem fs, FileLink fileLink, int bufferSize) throws IOException - Throws:
IOException
-
-
Method Details
-
getUnderlyingInputStream
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
- Specified by:
read
in interfaceorg.apache.hadoop.fs.PositionedReadable
- Throws:
IOException
-
readFully
- Specified by:
readFully
in interfaceorg.apache.hadoop.fs.PositionedReadable
- Throws:
IOException
-
readFully
- Specified by:
readFully
in interfaceorg.apache.hadoop.fs.PositionedReadable
- Throws:
IOException
-
skip
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
available
- Overrides:
available
in classInputStream
- Throws:
IOException
-
seek
- Specified by:
seek
in interfaceorg.apache.hadoop.fs.Seekable
- Throws:
IOException
-
getPos
- Specified by:
getPos
in interfaceorg.apache.hadoop.fs.Seekable
- Throws:
IOException
-
seekToNewSource
- Specified by:
seekToNewSource
in interfaceorg.apache.hadoop.fs.Seekable
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
mark
- Overrides:
mark
in classInputStream
-
reset
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
markSupported
- Overrides:
markSupported
in classInputStream
-
unbuffer
- Specified by:
unbuffer
in interfaceorg.apache.hadoop.fs.CanUnbuffer
-
tryOpen
Try to open the file from one of the available locations.- Returns:
- FSDataInputStream stream of the opened file link
- Throws:
IOException
- on unexpected error, or file not found.
-
setReadahead
- Specified by:
setReadahead
in interfaceorg.apache.hadoop.fs.CanSetReadahead
- Throws:
IOException
UnsupportedOperationException
-
setDropBehind
- Specified by:
setDropBehind
in interfaceorg.apache.hadoop.fs.CanSetDropBehind
- Throws:
IOException
UnsupportedOperationException
-
getCurrentPath
-