亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學院 > 開發設計 > 正文

org.apache.hadoop.fs-BlockLocation

2019-11-14 21:19:22
字體:
來源:轉載
供稿:網友
org.apache.hadoop.fs-BlockLocation

工具類吧


  1 package org.apache.hadoop.fs;  2   3 import org.apache.hadoop.io.*;  4 //IO包下的類還沒涉及到。遇到一個分析一個。  5 import java.io.*;  6   7 /*  8  * A BlockLocation lists hosts, offset and length  9  * of block.  10  *  11  */ 12 //記錄block的元數據信息,如所在host,長度和偏移量 13 public class BlockLocation implements Writable { 14 //針對集群塊位置的類 15   static {               // register a ctor 16     WritableFactories.setFactory 17       (BlockLocation.class, 18        new WritableFactory() { 19          public Writable newInstance() { return new BlockLocation(); } 20        }); 21   } 22 //注冊了一個Writable子類BlockLocation的工廠。內部類。詳細可看http://book.2cto.com/201305/21915.html 23   PRivate String[] hosts; //hostnames of datanodes 24   //節點的主機名數組 25   private String[] names; //hostname:portNumber of datanodes 26   //節點的名稱數組。名稱的格式。 27   private String[] topologyPaths; // full path name in network topology 28   //節點在網絡拓撲結構中的地址 29   private long offset;  //offset of the of the block in the file 30   //塊在文件中的偏移量 31   private long length; 32   //塊長度 33  34   /** 35    * Default Constructor 36    */ 37   public BlockLocation() { 38     this(new String[0], new String[0],  0L, 0L); 39   } 40 //默認構造方法 41   /** 42    * Constructor with host, name, offset and length 43    */ 44   public BlockLocation(String[] names, String[] hosts, long offset,  45                        long length) { 46     if (names == null) { 47       this.names = new String[0]; 48     } else { 49       this.names = names; 50     } 51     if (hosts == null) { 52       this.hosts = new String[0]; 53     } else { 54       this.hosts = hosts; 55     } 56     this.offset = offset; 57     this.length = length; 58     this.topologyPaths = new String[0]; 59   } 60 //根據名稱主機偏移量長度初始化一個塊對象 61   /** 62    * Constructor with host, name, network topology, offset and length 63    */ 64   public BlockLocation(String[] names, String[] hosts, String[] topologyPaths, 65                        long offset, long length) { 66     this(names, hosts, offset, length); 67     if (topologyPaths == null) { 68       this.topologyPaths = new String[0]; 69     } else { 70       this.topologyPaths = topologyPaths; 71     } 72   } 73 //根據......... 74   /** 75    * Get the list of hosts (hostname) hosting this block 76    */ 77   public String[] getHosts() throws IOException { 78     if ((hosts == null) || (hosts.length == 0)) { 79       return new String[0]; 80     } else { 81       return hosts; 82     } 83   } 84 //獲得塊的主機 85   /** 86    * Get the list of names (hostname:port) hosting this block 87    */ 88   public String[] getNames() throws IOException { 89     if ((names == null) || (names.length == 0)) { 90       return new String[0]; 91     } else { 92       return this.names; 93     } 94   } 95 //。。。。 96   /** 97    * Get the list of network topology paths for each of the hosts. 98    * The last component of the path is the host. 99    */100   public String[] getTopologyPaths() throws IOException {101     if ((topologyPaths == null) || (topologyPaths.length == 0)) {102       return new String[0];103     } else {104       return this.topologyPaths;105     }106   }107   //。。。。。108   /**109    * Get the start offset of file associated with this block110    */111   public long getOffset() {112     return offset;113   }114   //。。。。。115   /**116    * Get the length of the block117    */118   public long getLength() {119     return length;120   }121   //。。。。。122   /**123    * Set the start offset of file associated with this block124    */125   public void setOffset(long offset) {126     this.offset = offset;127   }128 //。。。。。129   /**130    * Set the length of block131    */132   public void setLength(long length) {133     this.length = length;134   }135 //。。。。。136   /**137    * Set the hosts hosting this block138    */139   public void setHosts(String[] hosts) throws IOException {140     if (hosts == null) {141       this.hosts = new String[0];142     } else {143       this.hosts = hosts;144     }145   }146 //。。。。。147   /**148    * Set the names (host:port) hosting this block149    */150   public void setNames(String[] names) throws IOException {151     if (names == null) {152       this.names = new String[0];153     } else {154       this.names = names;155     }156   }157 //。。。。。158   /**159    * Set the network topology paths of the hosts160    */161   public void setTopologyPaths(String[] topologyPaths) throws IOException {162     if (topologyPaths == null) {163       this.topologyPaths = new String[0];164     } else {165       this.topologyPaths = topologyPaths;166     }167   }168 //。。。。。169   /**170    * Implement write of Writable171    */172   public void write(DataOutput out) throws IOException {173     out.writeLong(offset);174     out.writeLong(length);175     out.writeInt(names.length);176     for (int i=0; i < names.length; i++) {177       Text name = new Text(names[i]);178       name.write(out);179     }180     out.writeInt(hosts.length);181     for (int i=0; i < hosts.length; i++) {182       Text host = new Text(hosts[i]);183       host.write(out);184     }185     out.writeInt(topologyPaths.length);186     for (int i=0; i < topologyPaths.length; i++) {187       Text host = new Text(topologyPaths[i]);188       host.write(out);189     }190   }191   //把塊信息寫到輸出流中。用到了Writable子類Long,Int,Text的Write方法。序列化192   /**193    * Implement readFields of Writable194    */195   public void readFields(DataInput in) throws IOException {196     this.offset = in.readLong();197     this.length = in.readLong();198     int numNames = in.readInt();199     this.names = new String[numNames];200     for (int i = 0; i < numNames; i++) {201       Text name = new Text();202       name.readFields(in);203       names[i] = name.toString();204     }205     int numHosts = in.readInt();206     for (int i = 0; i < numHosts; i++) {207       Text host = new Text();208       host.readFields(in);209       hosts[i] = host.toString();210     }211     int numTops = in.readInt();212     Text path = new Text();213     for (int i = 0; i < numTops; i++) {214       path.readFields(in);215       topologyPaths[i] = path.toString();216     }217   }218   //把塊信息從輸入流中讀出來。....。反序列化219   public String toString() {220     StringBuilder result = new StringBuilder();221     result.append(offset);222     result.append(',');223     result.append(length);224     for(String h: hosts) {225       result.append(',');226       result.append(h);227     }228     return result.toString();229   }230   //。。。。。。231 }


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
国产精品国产三级国产aⅴ浪潮| 亚洲精品久久久久中文字幕欢迎你| 国产做受69高潮| 日韩在线小视频| 欧美性猛交xxxx免费看久久久| xvideos国产精品| 2018中文字幕一区二区三区| 九九热r在线视频精品| 一道本无吗dⅴd在线播放一区| 欧美三级欧美成人高清www| 欧美精品免费看| 日韩av电影免费观看高清| 亚洲免费高清视频| 亚洲欧洲日产国产网站| 成人信息集中地欧美| 欧美成年人网站| 热久久美女精品天天吊色| 91国偷自产一区二区三区的观看方式| 中文字幕日韩av综合精品| 国产成人亚洲综合青青| 欧美日韩国产限制| 在线丨暗呦小u女国产精品| 国产成人精品久久二区二区| 欧美日韩午夜剧场| 国产精品美女主播| 成人免费视频a| 国产精品美女久久久免费| 亚洲成人免费在线视频| 亚洲第一天堂无码专区| 亚洲高清一二三区| 日韩精品一区二区视频| 日韩网站免费观看| 国产亚洲欧美视频| 久久久久女教师免费一区| 国产精品高清免费在线观看| 亚洲第一网站免费视频| 国产日韩在线免费| 国产精品第一页在线| 国产精品久久一区主播| 国产伊人精品在线| 亚洲日本欧美日韩高观看| 国产精品一区二区久久| 一区二区三区无码高清视频| 成人免费观看49www在线观看| 欧美裸体xxxx极品少妇软件| 久久99精品久久久久久琪琪| 久久视频在线直播| 亚洲成av人乱码色午夜| 亚洲午夜未删减在线观看| 欧洲亚洲免费视频| 欧美丝袜一区二区三区| 国产欧美日韩精品丝袜高跟鞋| 色妞久久福利网| 国产精品久久久久av| 国产69久久精品成人| 欧美性视频在线| 91成人天堂久久成人| 久久成人综合视频| 欧美精品videofree1080p| 尤物精品国产第一福利三区| 亚洲a成v人在线观看| 欧美乱人伦中文字幕在线| 日韩av免费看| 久久久免费av| 在线日韩av观看| xxx成人少妇69| 亚洲嫩模很污视频| 欧美日韩精品中文字幕| 日韩精品视频在线观看网址| 欧美午夜宅男影院在线观看| 色狠狠av一区二区三区香蕉蜜桃| 国产精品一区二区三区毛片淫片| 欧美日韩另类字幕中文| 午夜剧场成人观在线视频免费观看| 中文字幕在线亚洲| 人人做人人澡人人爽欧美| 国产婷婷97碰碰久久人人蜜臀| 亚洲天天在线日亚洲洲精| 亚洲视频欧洲视频| 日本精品久久电影| 欧美片一区二区三区| 国产精品久久色| 欧美一区二区三区免费观看| 欧美午夜精品久久久久久人妖| 亚洲91精品在线观看| 精品毛片三在线观看| 久久久久久欧美| 在线日韩第一页| 欧美老妇交乱视频| 91老司机在线| 中文在线资源观看视频网站免费不卡| 久久久久久伊人| 久久人人爽人人爽爽久久| 不用播放器成人网| 久久精品国产一区二区三区| 国产精自产拍久久久久久蜜| 欧美xxxx18性欧美| 色老头一区二区三区| 国产精品美女免费视频| 日韩免费观看高清| 亚洲国内高清视频| 91免费综合在线| 国产91在线播放精品91| 欧美性少妇18aaaa视频| 欧美成人激情视频免费观看| 国产成人一区二区三区| 国产剧情日韩欧美| 国产欧美日韩专区发布| 国产精品久久久91| 国产精品第七影院| 91福利视频在线观看| 欧美激情精品久久久久久蜜臀| 欧美亚洲成人网| 日韩在线中文字| 日韩欧美中文在线| 91精品国产综合久久香蕉922| 亚洲人成在线观看网站高清| 免费av一区二区| 九九九久久国产免费| 国产日本欧美视频| 在线免费看av不卡| 精品无人区乱码1区2区3区在线| 成人免费xxxxx在线观看| 亚洲激情视频网| 欧美专区在线播放| 欧美大片免费观看| 精品国产欧美一区二区三区成人| 伊人激情综合网| 欧美成人高清视频| 亚洲伊人成综合成人网| 久久久伊人日本| 日韩成人中文字幕在线观看| 91精品综合久久久久久五月天| 亚洲电影免费在线观看| 26uuu久久噜噜噜噜| 国产精品久久久久久搜索| 91九色国产在线| 美日韩精品免费视频| y97精品国产97久久久久久| 亚洲直播在线一区| 欧美黄色小视频| 最好看的2019的中文字幕视频| 欧美久久精品午夜青青大伊人| 亚洲欧美制服另类日韩| 久久久久久久一| 亚洲va欧美va在线观看| 欧美成人第一页| 欧美日韩午夜视频在线观看| 欧美激情一级欧美精品| 色哟哟亚洲精品一区二区| 俺去啦;欧美日韩| 91极品视频在线| 国产精品久久久久一区二区| 欧美激情亚洲精品| 日韩精品视频中文在线观看| 一区二区成人av| 欧美自拍视频在线观看| 国产一区二区三区网站| 欧美成人性生活| 91亚洲精品在线| 中文字幕在线日韩| 91精品国产乱码久久久久久久久| 亚洲午夜女主播在线直播| 欧美成年人视频|