码迷,mamicode.com
首页 > Web开发 > 详细

org.apache.hadoop.fs-Seekable

时间:2014-10-13 18:26:49      阅读:289      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   os   ar   java   文件   sp   


本来要先看BufferedFSInputStream的,但是它实现了Seekable和PositionedReadable接口,就先看这两个,再看它会比较容易理解些


 1 package org.apache.hadoop.fs;
 2 
 3 import java.io.*;
 4 
 5 /** Stream that permits seeking. */
 6 //提供按位置查找功能的接口
 7 public interface Seekable {
 8   /**
 9    * Seek to the given offset from the start of the file.
10    * The next read() will be from that location.  Can‘t
11    * seek past the end of the file.
12    */
13   void seek(long pos) throws IOException;
14   //从指定文件中的位置pos,对文件流进行前向搜索。
15   /**
16    * Return the current offset from the start of the file
17    */
18   long getPos() throws IOException;
19 //返回文件流中当前偏移位置。 
20   /**
21    * Seeks a different copy of the data.  Returns true if 
22    * found a new source, false otherwise.
23    */
24   boolean seekToNewSource(long targetPos) throws IOException;
25   //从targetPos位置搜索文件数据的一个不同拷贝,搜索到则返回true,否则返回false。
26 }

 


 

org.apache.hadoop.fs-Seekable

标签:style   blog   color   io   os   ar   java   文件   sp   

原文地址:http://www.cnblogs.com/admln/p/Seekable.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!