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
FieldsModifier and TypeFieldDescriptionprivate final intprivate org.apache.hadoop.fs.Pathprivate final FileLinkprivate final org.apache.hadoop.fs.FileSystemprivate org.apache.hadoop.fs.FSDataInputStreamprivate long -
Constructor Summary
ConstructorsConstructorDescriptionFileLinkInputStream(org.apache.hadoop.fs.FileSystem fs, FileLink fileLink) FileLinkInputStream(org.apache.hadoop.fs.FileSystem fs, FileLink fileLink, int bufferSize) -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()org.apache.hadoop.fs.PathlonggetPos()private org.apache.hadoop.fs.FSDataInputStreamvoidmark(int readlimit) booleanintread()intread(byte[] b) intread(byte[] b, int off, int len) intread(long position, byte[] buffer, int offset, int length) voidreadFully(long position, byte[] buffer) voidreadFully(long position, byte[] buffer, int offset, int length) voidreset()voidseek(long pos) booleanseekToNewSource(long targetPos) voidsetDropBehind(Boolean dropCache) voidsetReadahead(Long readahead) longskip(long n) private org.apache.hadoop.fs.FSDataInputStreamtryOpen()Try to open the file from one of the available locations.voidunbuffer()
-
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:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Specified by:
readin interfaceorg.apache.hadoop.fs.PositionedReadable- Throws:
IOException
-
readFully
- Specified by:
readFullyin interfaceorg.apache.hadoop.fs.PositionedReadable- Throws:
IOException
-
readFully
- Specified by:
readFullyin interfaceorg.apache.hadoop.fs.PositionedReadable- Throws:
IOException
-
skip
- Overrides:
skipin classInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
seek
- Specified by:
seekin interfaceorg.apache.hadoop.fs.Seekable- Throws:
IOException
-
getPos
- Specified by:
getPosin interfaceorg.apache.hadoop.fs.Seekable- Throws:
IOException
-
seekToNewSource
- Specified by:
seekToNewSourcein interfaceorg.apache.hadoop.fs.Seekable- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
mark
- Overrides:
markin classInputStream
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-
markSupported
- Overrides:
markSupportedin classInputStream
-
unbuffer
- Specified by:
unbufferin 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:
setReadaheadin interfaceorg.apache.hadoop.fs.CanSetReadahead- Throws:
IOExceptionUnsupportedOperationException
-
setDropBehind
- Specified by:
setDropBehindin interfaceorg.apache.hadoop.fs.CanSetDropBehind- Throws:
IOExceptionUnsupportedOperationException
-
getCurrentPath
-