Package org.apache.hadoop.fs
Interface Seekable
- All Known Implementing Classes:
BlockDecompressorStream,BufferedFSInputStream,CompressionInputStream,CryptoFSDataInputStream,CryptoInputStream,DecompressorStream,FSDataInputStream,FSInputChecker,FSInputStream,FTPInputStream,PassthroughCodec.PassthroughDecompressorStream,SplitCompressionInputStream
@Public
@Evolving
public interface Seekable
Stream that permits seeking.
-
Method Summary
Modifier and TypeMethodDescriptionlonggetPos()Return the current offset from the start of the filevoidseek(long pos) Seek to the given offset from the start of the file.booleanseekToNewSource(long targetPos) Seeks a different copy of the data.
-
Method Details
-
seek
Seek to the given offset from the start of the file. The next read() will be from that location. Can't seek past the end of the file.- Parameters:
pos- offset from the start of the file.- Throws:
IOException- raised on errors performing I/O.
-
getPos
Return the current offset from the start of the file- Returns:
- offset from the start of the file.
- Throws:
IOException- raised on errors performing I/O.
-
seekToNewSource
Seeks a different copy of the data. Returns true if found a new source, false otherwise.- Parameters:
targetPos- target position.- Returns:
- true if found a new source, false otherwise.
- Throws:
IOException- raised on errors performing I/O.
-