亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sequencefile.java

?? Hadoop是一個用于運行應用程序在大型集群的廉價硬件設備上的框架。Hadoop為應用程序透明的提供了一組穩定/可靠的接口和數據運動。在 Hadoop中實現了Google的MapReduce算法
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/** * Copyright 2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *     http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.apache.hadoop.io;import java.io.*;import java.util.*;import java.util.zip.*;import java.util.logging.*;import java.net.InetAddress;import java.rmi.server.UID;import java.security.MessageDigest;import org.apache.lucene.util.PriorityQueue;import org.apache.hadoop.fs.*;import org.apache.hadoop.conf.*;import org.apache.hadoop.util.LogFormatter;/** Support for flat files of binary key/value pairs. */public class SequenceFile {  public static final Logger LOG =    LogFormatter.getLogger("org.apache.hadoop.io.SequenceFile");  private SequenceFile() {}                         // no public ctor  private static byte[] VERSION = new byte[] {    (byte)'S', (byte)'E', (byte)'Q', 3  };  private static final int SYNC_ESCAPE = -1;      // "length" of sync entries  private static final int SYNC_HASH_SIZE = 16;   // number of bytes in hash   private static final int SYNC_SIZE = 4+SYNC_HASH_SIZE; // escape + hash  /** The number of bytes between sync points.*/  public static final int SYNC_INTERVAL = 100*SYNC_SIZE;   /** Write key/value pairs to a sequence-format file. */  public static class Writer {    private FSDataOutputStream out;    private DataOutputBuffer buffer = new DataOutputBuffer();    private FileSystem fs = null;    private File target = null;    private Class keyClass;    private Class valClass;    private boolean deflateValues;    private Deflater deflater = new Deflater(Deflater.BEST_SPEED);    private DeflaterOutputStream deflateFilter =      new DeflaterOutputStream(buffer, deflater);    private DataOutputStream deflateOut =      new DataOutputStream(new BufferedOutputStream(deflateFilter));    // Insert a globally unique 16-byte value every few entries, so that one    // can seek into the middle of a file and then synchronize with record    // starts and ends by scanning for this value.    private long lastSyncPos;                     // position of last sync    private byte[] sync;                          // 16 random bytes    {      try {                                       // use hash of uid + host        MessageDigest digester = MessageDigest.getInstance("MD5");        digester.update((new UID()+"@"+InetAddress.getLocalHost()).getBytes());        sync = digester.digest();      } catch (Exception e) {        throw new RuntimeException(e);      }    }    /** Create the named file. */    public Writer(FileSystem fs, String name,                  Class keyClass, Class valClass)      throws IOException {      this(fs, name, keyClass, valClass, false);    }        /** Create the named file.     * @param compress if true, values are compressed.     */    public Writer(FileSystem fs, String name,                  Class keyClass, Class valClass, boolean compress)      throws IOException {      this.fs = fs;      this.target = new File(name);      init(fs.create(target), keyClass, valClass, compress);    }        /** Write to an arbitrary stream using a specified buffer size. */    private Writer(FSDataOutputStream out,                   Class keyClass, Class valClass, boolean compress)      throws IOException {      init(out, keyClass, valClass, compress);    }        /** Write and flush the file header. */    private void init(FSDataOutputStream out,                      Class keyClass, Class valClass,                      boolean compress) throws IOException {      this.out = out;      this.out.write(VERSION);      this.keyClass = keyClass;      this.valClass = valClass;      this.deflateValues = compress;      new UTF8(WritableName.getName(keyClass)).write(this.out);      new UTF8(WritableName.getName(valClass)).write(this.out);      this.out.writeBoolean(deflateValues);      out.write(sync);                            // write the sync bytes      this.out.flush();                           // flush header    }        /** Returns the class of keys in this file. */    public Class getKeyClass() { return keyClass; }    /** Returns the class of values in this file. */    public Class getValueClass() { return valClass; }    /** Close the file. */    public synchronized void close() throws IOException {      if (out != null) {        out.close();        out = null;      }    }    /** Append a key/value pair. */    public synchronized void append(Writable key, Writable val)      throws IOException {      if (key.getClass() != keyClass)        throw new IOException("wrong key class: "+key+" is not "+keyClass);      if (val.getClass() != valClass)        throw new IOException("wrong value class: "+val+" is not "+valClass);      buffer.reset();      key.write(buffer);      int keyLength = buffer.getLength();      if (keyLength == 0)        throw new IOException("zero length keys not allowed: " + key);      if (deflateValues) {        deflater.reset();        val.write(deflateOut);        deflateOut.flush();        deflateFilter.finish();      } else {        val.write(buffer);      }      append(buffer.getData(), 0, buffer.getLength(), keyLength);    }    /** Append a key/value pair. */    public synchronized void append(byte[] data, int start, int length,                                    int keyLength) throws IOException {      if (keyLength == 0)        throw new IOException("zero length keys not allowed");      if (sync != null &&          out.getPos() >= lastSyncPos+SYNC_INTERVAL) { // time to emit sync        lastSyncPos = out.getPos();               // update lastSyncPos        //LOG.info("sync@"+lastSyncPos);        out.writeInt(SYNC_ESCAPE);                // escape it        out.write(sync);                          // write sync      }      out.writeInt(length);                       // total record length      out.writeInt(keyLength);                    // key portion length      out.write(data, start, length);             // data    }    /** Returns the current length of the output file. */    public synchronized long getLength() throws IOException {      return out.getPos();    }  }  /** Writes key/value pairs from a sequence-format file. */  public static class Reader {    private String file;    private FSDataInputStream in;    private DataOutputBuffer outBuf = new DataOutputBuffer();    private DataInputBuffer inBuf = new DataInputBuffer();    private FileSystem fs = null;    private byte[] version = new byte[VERSION.length];    private Class keyClass;    private Class valClass;    private byte[] sync = new byte[SYNC_HASH_SIZE];    private byte[] syncCheck = new byte[SYNC_HASH_SIZE];    private boolean syncSeen;    private long end;    private int keyLength;    private boolean inflateValues;    private byte[] inflateIn = new byte[8192];    private DataOutputBuffer inflateOut = new DataOutputBuffer();    private Inflater inflater = new Inflater();    private Configuration conf;    /** Open the named file. */    public Reader(FileSystem fs, String file, Configuration conf) throws IOException {      this(fs, file, conf.getInt("io.file.buffer.size", 4096));      this.conf = conf;    }    private Reader(FileSystem fs, String name, int bufferSize) throws IOException {      this.fs = fs;      this.file = name;      File file = new File(name);      this.in = fs.open(file, bufferSize);      this.end = fs.getLength(file);      init();    }        private Reader(FileSystem fs, String file, int bufferSize, long start, long length)      throws IOException {      this.fs = fs;      this.file = file;      this.in = fs.open(new File(file), bufferSize);      seek(start);      init();      this.end = in.getPos() + length;    }        private void init() throws IOException {      in.readFully(version);      if ((version[0] != VERSION[0]) ||          (version[1] != VERSION[1]) ||          (version[2] != VERSION[2]))        throw new IOException(file + " not a SequenceFile");      if (version[3] > VERSION[3])        throw new VersionMismatchException(VERSION[3], version[3]);      UTF8 className = new UTF8();            className.readFields(in);                   // read key class name      this.keyClass = WritableName.getClass(className.toString());            className.readFields(in);                   // read val class name      this.valClass = WritableName.getClass(className.toString());      if (version[3] > 2) {                       // if version > 2        this.inflateValues = in.readBoolean();    // is compressed?      }      if (version[3] > 1) {                       // if version > 1        in.readFully(sync);                       // read sync bytes      }    }        /** Close the file. */    public synchronized void close() throws IOException {      in.close();    }    /** Returns the class of keys in this file. */    public Class getKeyClass() { return keyClass; }    /** Returns the class of values in this file. */    public Class getValueClass() { return valClass; }    /** Returns true if values are compressed. */    public boolean isCompressed() { return inflateValues; }    /** Read the next key in the file into <code>key</code>, skipping its     * value.  True if another entry exists, and false at end of file. */    public synchronized boolean next(Writable key) throws IOException {      if (key.getClass() != keyClass)        throw new IOException("wrong key class: "+key+" is not "+keyClass);      outBuf.reset();      keyLength = next(outBuf);      if (keyLength < 0)        return false;      inBuf.reset(outBuf.getData(), outBuf.getLength());      key.readFields(inBuf);      if (inBuf.getPosition() != keyLength)        throw new IOException(key + " read " + inBuf.getPosition()                              + " bytes, should read " + keyLength);      return true;    }    /** Read the next key/value pair in the file into <code>key</code> and     * <code>val</code>.  Returns true if such a pair exists and false when at     * end of file */    public synchronized boolean next(Writable key, Writable val)      throws IOException {      if (val.getClass() != valClass)        throw new IOException("wrong value class: "+val+" is not "+valClass);      boolean more = next(key);      if (more) {        if (inflateValues) {          inflater.reset();          inflater.setInput(outBuf.getData(), keyLength,                            outBuf.getLength()-keyLength);          inflateOut.reset();          while (!inflater.finished()) {            try {              int count = inflater.inflate(inflateIn);              inflateOut.write(inflateIn, 0, count);            } catch (DataFormatException e) {              throw new IOException (e.toString());            }          }          inBuf.reset(inflateOut.getData(), inflateOut.getLength());        }        if(val instanceof Configurable) {          ((Configurable) val).setConf(this.conf);        }        val.readFields(inBuf);        if (inBuf.getPosition() != inBuf.getLength())          throw new IOException(val+" read "+(inBuf.getPosition()-keyLength)                                + " bytes, should read " +                                (inBuf.getLength()-keyLength));      }      return more;    }    /** Read the next key/value pair in the file into <code>buffer</code>.     * Returns the length of the key read, or -1 if at end of file.  The length     * of the value may be computed by calling buffer.getLength() before and     * after calls to this method. */    public synchronized int next(DataOutputBuffer buffer) throws IOException {      if (in.getPos() >= end)        return -1;      try {        int length = in.readInt();        if (version[3] > 1 && sync != null &&            length == SYNC_ESCAPE) {              // process a sync entry          //LOG.info("sync@"+in.getPos());          in.readFully(syncCheck);                // read syncCheck          if (!Arrays.equals(sync, syncCheck))    // check it            throw new IOException("File is corrupt!");          syncSeen = true;          length = in.readInt();                  // re-read length        } else {          syncSeen = false;        }                int keyLength = in.readInt();        buffer.write(in, length);        return keyLength;      } catch (ChecksumException e) {             // checksum failure        handleChecksumException(e);        return next(buffer);      }    }    private void handleChecksumException(ChecksumException e)      throws IOException {      if (this.conf.getBoolean("io.skip.checksum.errors", false)) {        LOG.warning("Bad checksum at "+getPosition()+". Skipping entries.");        sync(getPosition()+this.conf.getInt("io.bytes.per.checksum", 512));      } else {        throw e;      }    }    /** Set the current byte position in the input file. */    public synchronized void seek(long position) throws IOException {      in.seek(position);    }    /** Seek to the next sync mark past a given position.*/    public synchronized void sync(long position) throws IOException {      if (position+SYNC_SIZE >= end) {        seek(end);        return;      }      try {        seek(position+4);                         // skip escape        in.readFully(syncCheck);        int syncLen = sync.length;        for (int i = 0; in.getPos() < end; i++) {          int j = 0;          for (; j < syncLen; j++) {            if (sync[j] != syncCheck[(i+j)%syncLen])              break;          }          if (j == syncLen) {            in.seek(in.getPos() - SYNC_SIZE);     // position before sync            return;          }          syncCheck[i%syncLen] = in.readByte();        }      } catch (ChecksumException e) {             // checksum failure        handleChecksumException(e);      }    }    /** Returns true iff the previous call to next passed a sync mark.*/    public boolean syncSeen() { return syncSeen; }    /** Return the current byte position in the input file. */    public synchronized long getPosition() throws IOException {      return in.getPos();    }    /** Returns the name of the file. */    public String toString() {      return file;    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
天天影视网天天综合色在线播放| 国产精品成人一区二区三区夜夜夜 | 91福利小视频| 国产丝袜在线精品| 韩国av一区二区三区在线观看| 欧美日韩国产高清一区二区| 亚洲人123区| 欧美福利视频导航| 日韩在线一区二区三区| 国产一区二区伦理| 国产精品美女久久久久久2018 | 成人免费观看男女羞羞视频| 欧美xxx久久| 成人国产视频在线观看| 樱花草国产18久久久久| 欧美一区二区三区系列电影| 婷婷开心激情综合| 久久亚洲一区二区三区四区| 国产精品系列在线播放| 亚洲精品中文在线观看| 欧美猛男超大videosgay| 日本强好片久久久久久aaa| 2020国产精品| 欧美精品v日韩精品v韩国精品v| 一区二区三区四区高清精品免费观看| 日本高清不卡一区| 韩国v欧美v日本v亚洲v| 舔着乳尖日韩一区| 国产日韩亚洲欧美综合| 91视频一区二区三区| 蜜桃av噜噜一区| 亚洲不卡一区二区三区| 国产精品第五页| 国产亚洲成av人在线观看导航| 欧美视频中文字幕| 91同城在线观看| 日产欧产美韩系列久久99| 欧美一区二区黄色| 欧美综合一区二区| 在线观看av不卡| 成人精品国产一区二区4080| 国产在线看一区| 麻豆国产欧美日韩综合精品二区| 亚洲国产精品天堂| 亚洲黄一区二区三区| 一区二区高清视频在线观看| 中文字幕一区二区三区av| 精品久久久久久无| 精品电影一区二区| 日韩欧美色电影| 欧美大片在线观看一区二区| 欧美一二三四在线| 久久久久久久久久久久久久久99 | 免费观看成人鲁鲁鲁鲁鲁视频| 亚洲综合图片区| 一区二区三区不卡在线观看| 一区二区三区国产| 青青草伊人久久| 激情另类小说区图片区视频区| 国产不卡视频一区二区三区| 波多野结衣的一区二区三区| 国产精品主播直播| 日本韩国一区二区| 亚洲精品在线观看视频| 久久精品亚洲精品国产欧美kt∨| 欧美激情一区二区三区不卡| 亚洲资源在线观看| 精品一区二区三区欧美| 91一区二区在线| 精品国产不卡一区二区三区| 欧美不卡一区二区三区四区| 国产日韩欧美精品在线| 精品一区二区在线看| 日韩二区在线观看| 99国产精品视频免费观看| 欧美一级淫片007| 一区二区三区四区视频精品免费| 毛片一区二区三区| 成人黄色在线看| 国产亚洲精品久| 国产一区二区不卡| 日韩一级片在线播放| 亚洲妇女屁股眼交7| 欧美日本高清视频在线观看| 人人超碰91尤物精品国产| 日韩欧美一二三| 丁香桃色午夜亚洲一区二区三区| 国产精品三级久久久久三级| 99久久精品免费| 日韩av中文字幕一区二区三区 | 国产精一品亚洲二区在线视频| 日韩视频国产视频| 成人一区二区三区视频 | 麻豆精品一区二区三区| 久久精品在这里| 色噜噜久久综合| 免费的国产精品| 亚洲免费在线视频| 精品欧美黑人一区二区三区| 国产999精品久久久久久绿帽| 亚洲男同性视频| 国产日韩欧美不卡在线| 91精品国产乱码久久蜜臀| 丁香天五香天堂综合| 久久成人久久爱| 亚洲高清在线视频| 亚洲国产美国国产综合一区二区| 久久久噜噜噜久噜久久综合| 欧美高清激情brazzers| jizzjizzjizz欧美| 精品一区二区在线观看| 久久久精品日韩欧美| 国产精品99久久久久久有的能看| 一区二区三区在线观看动漫| 精品国产制服丝袜高跟| 福利视频网站一区二区三区| 日韩主播视频在线| 夜夜嗨av一区二区三区| 亚洲视频 欧洲视频| 国产日韩欧美高清在线| 欧美精品一区二区三区一线天视频| 色哟哟一区二区三区| 丁香啪啪综合成人亚洲小说 | 精品国产乱子伦一区| 欧美一区国产二区| 欧美亚洲一区二区在线| 在线欧美日韩国产| 欧美吻胸吃奶大尺度电影| 99国产精品久久久| 色综合色狠狠天天综合色| 国产精品一级黄| 久久av资源站| 国产精品一二一区| 激情欧美一区二区三区在线观看| 免费国产亚洲视频| 激情成人综合网| 成人av综合一区| 在线观看日韩毛片| 99久久精品国产网站| 91小视频在线观看| 欧美亚洲综合色| 日韩一区二区三区四区五区六区 | 日本中文字幕不卡| 精品一区二区三区不卡| 国产91清纯白嫩初高中在线观看| 国产乱码精品一品二品| 色综合一个色综合亚洲| 9191精品国产综合久久久久久| 337p日本欧洲亚洲大胆精品| 国产精品久久久久影院老司| 亚洲自拍偷拍欧美| 国产在线观看免费一区| 一本大道av伊人久久综合| 久久久久久久久久久久电影| 欧美激情在线观看视频免费| 亚洲va在线va天堂| 亚洲另类色综合网站| 久色婷婷小香蕉久久| 在线欧美日韩精品| 久久综合九色综合欧美就去吻 | 色菇凉天天综合网| 国产欧美精品区一区二区三区| 亚洲高清三级视频| 91蜜桃免费观看视频| 国产精品无圣光一区二区| 麻豆一区二区三| 日韩女优视频免费观看| 亚洲国产一二三| 色婷婷久久综合| 一二三四社区欧美黄| 不卡的电影网站| 国产精品毛片无遮挡高清| www.一区二区| 亚洲欧洲成人自拍| 91黄色小视频| 天天色天天操综合| 精品国产免费人成电影在线观看四季| 丝袜亚洲另类欧美| 欧美无人高清视频在线观看| 亚洲午夜激情网页| 欧美一区二区三区人| 韩国三级电影一区二区| 日韩免费观看高清完整版在线观看| 亚洲成a人v欧美综合天堂下载| 久久久久久影视| 99久久综合狠狠综合久久| 亚洲线精品一区二区三区八戒| 91精品黄色片免费大全| 丁香啪啪综合成人亚洲小说| 成人免费一区二区三区在线观看| 色网站国产精品| 免费人成网站在线观看欧美高清| 亚洲国产岛国毛片在线| 91精品国产综合久久福利| 国产成人在线看| 亚洲国产精品久久人人爱蜜臀| 久久久久久久久伊人| 欧美丰满少妇xxxbbb| 经典三级视频一区| 亚洲r级在线视频|