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

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

?? dbsectionreader.java

?? 爬蟲數據的改進,并修正了一些bug
?? JAVA
字號:
/* Copyright (c) 2003 The Nutch Organization.  All rights reserved.   */
/* Use subject to the conditions in http://www.nutch.org/LICENSE.txt. */
package net.nutch.db;

import java.io.*;
import java.util.*;

import net.nutch.io.*;
import net.nutch.fs.*;
import net.nutch.util.*;

/**********************************************************
 * DBSectionReader reads a discrete portion of a WebDB.
 * It may implement its methods with either a local
 * MapFile.Reader object or (eventually) a remote-
 * machine network interface.  For the moment, we 
 * do only the MapFile.Reader implementation (much of
 * the code for this was moved from the earlier 
 * pre-distributed version of WebDBReadaer).
 *
 * @author Mike Cafarella
 ***********************************************/
public class DBSectionReader {
    NutchFileSystem nfs;
    File sectionFile;
    WritableComparator comparator;
    MapFile.Reader reader;

    /**
     * Right now we assume we're getting a File that is a 
     * MapFile.Reader directory.  But in the future we could
     * also check for existence of a "remote-network" file, similar
     * to the way we do now for distributed index reading.
     * Then, we would either create a MapFile.Reader or a network
     * client for one.
     */
    public DBSectionReader(NutchFileSystem nfs, File sectionFile, WritableComparator comparator) throws IOException {
        this.nfs = nfs;
        this.sectionFile = sectionFile;
        this.comparator = comparator;
        this.reader = new MapFile.Reader(nfs, sectionFile.getPath(), comparator);
    }

    /**
     * Fetch a Page with the given URL, and fill it into
     * the pre-allocated Page 'p'.
     */
    public Page getPage(UTF8 url, Page p) throws IOException {
        return (Page) reader.get(url, p);
    }

    /**
     * Get Pages from the db according to their
     * content hash.
     */
    public Vector getPages(MD5Hash md5) throws IOException {
        Vector records = new Vector(3);
        Page p = new Page();
        p.getMD5().set(md5);

        reader.seek(p);
        while (reader.next(p, NullWritable.get())) {
            if (p.getMD5().compareTo(md5) == 0) {
                records.add(p);
                p = new Page();
            } else {
                break;
            }
        }

        return records;
    }

    /**
     * Test whether a certain piece of content is in the 
     * db, but don't bother returning it.
     */
    public boolean pageExists(MD5Hash md5) throws IOException {
        Page p = new Page();
        p.getMD5().set(md5);
        reader.seek(p);
        if (reader.next(p, NullWritable.get()) && p.getMD5().compareTo(md5) == 0) {
            return true;
        } else {
            return false;
        }
    }

    /**
     * Iterate through all the Pages, sorted by URL
     */
    public Enumeration pages() throws IOException {
        return new TableEnumerator(new MapFile.Reader(nfs, sectionFile.getPath(), comparator));
    }

    //
    // The TableEnumerator goes through all the entries
    // in the Table (which is a MapFile).
    //
    class TableEnumerator implements Enumeration {
        MapFile.Reader reader;
        Page nextItem;

        /**
         * Start the cursor and find the first item.
         * Store it for later return.
         */
        public TableEnumerator(MapFile.Reader reader) {
            this.reader = reader;
            this.nextItem = new Page();
            try {
                if (! reader.next(new UTF8(), this.nextItem)) {
                    this.nextItem = null;
                }
            } catch (IOException ie) {
                ie.printStackTrace();
                this.nextItem = null;
            }
        }

        /**
         * If there's no item left in store, we've hit the end.
         */
        public boolean hasMoreElements() {
            return (nextItem != null);
        }

        /**
         * Set aside the item we have in store.  Then retrieve
         * another for the next time we're called.  Finally, return
         * the set-aside item.
         */
        public Object nextElement() {
            if (nextItem == null) {
                throw new NoSuchElementException("PageDB Enumeration");
            }
            Page toReturn = nextItem;
            this.nextItem = new Page();
            try {
                if (! reader.next(new UTF8(), nextItem)) {
                    this.nextItem = null;
                }
            } catch (IOException ie) {
                this.nextItem = null;
            }
            return toReturn;
        }
    }

    /**
     * Iterate through all the Pages, sorted by MD5
     */
    public Enumeration pagesByMD5() throws IOException {
        return new IndexEnumerator(new SetFile.Reader(nfs, sectionFile.getPath(), comparator));
    }

    //
    // The IndexEnumerator goes through all the entries
    // in the index (which is a SequenceFile).
    //
    class IndexEnumerator implements Enumeration {
        SetFile.Reader reader;
        Page nextItem;

        /**
         * Start the cursor and find the first item.
         * Store it for later return.
         */
        public IndexEnumerator(SetFile.Reader reader) {
            this.reader = reader;
            this.nextItem = new Page();
            try {
                if (! reader.next(nextItem)) {
                    this.nextItem = null;
                }
            } catch (IOException ie) {
                this.nextItem = null;
            }
        }

        /**
         * If there's no item left in store, we've hit the end.
         */
        public boolean hasMoreElements() {
            return (nextItem != null);
        }

        /**
         * Set aside the item we have in store.  Then retrieve
         * another for the next time we're called.  Finally, return
         * the set-aside item.
         */
        public Object nextElement() {
            if (nextItem == null) {
                throw new NoSuchElementException("PageDB Enumeration");
            }

            Page toReturn = nextItem;
            this.nextItem = new Page();
            try {
                if (! reader.next(nextItem)) {
                    this.nextItem = null;
                }
            } catch (IOException ie) {
                this.nextItem = null;
            }
            return toReturn;
        }
    }

    /**
     * Get all the hyperlinks that link TO the indicated URL.
     */     
    public Vector getLinks(UTF8 url) throws IOException {
        Vector records = new Vector(3);
        Link l = new Link();
        l.getURL().set(url);

        reader.seek(l);
        while (reader.next(l, NullWritable.get())) {
            if (url.equals(l.getURL())) {
                records.add(l);
                l = new Link();
            } else {
                break;
            }
        }
        
        return records;
    }

    /**
     * Grab all the links from the given MD5 hash.
     */
    public Vector getLinks(MD5Hash md5) throws IOException {
        Vector records = new Vector(3);
        Link l = new Link();
        l.getFromID().set(md5);

        reader.seek(l);
        while (reader.next(l, NullWritable.get())) {
            if (md5.equals(l.getFromID())) {
                records.add(l);
                l = new Link();
            } else {
                break;
            }
        }
        
        return records;
    }

    /**
     * Return all the links, by target URL
     */
    public Enumeration links() throws IOException {
        return new MapEnumerator(new MapFile.Reader(nfs, sectionFile.getPath(), comparator));
    }
    
    //
    // Here's the class for the above function
    //
    class MapEnumerator implements Enumeration {
        MapFile.Reader reader;
        Link nextItem;

        /**
         * Start the cursor and find the first item.
         * Store it for later return.
         */
        public MapEnumerator(MapFile.Reader reader) {
            this.reader = reader;
            this.nextItem = new Link();
            try {
                if (! reader.next(this.nextItem, NullWritable.get())) {
                    this.nextItem = null;
                }
            } catch (IOException ie) {
                this.nextItem = null;
            }
        }

        /**
         * If there's no item left in store, we've hit the end.
         */
        public boolean hasMoreElements() {
            return (nextItem != null);
        }

        /**
         * Set aside the item we have in store.  Then retrieve
         * another for the next time we're called.  Finally, return
         * the set-aside item.
         */
        public Object nextElement() {
            if (nextItem == null) {
                throw new NoSuchElementException("PageDB Enumeration");
            }

            Link toReturn = nextItem;
            this.nextItem = new Link();
            try {
                if (! reader.next(nextItem, NullWritable.get())) {
                    this.nextItem = null;
                }
            } catch (IOException ie) {
                this.nextItem = null;
            }
            return toReturn;
        }
    }

    /**
     */
    public void close() throws IOException {
        reader.close();
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩av中文字幕一区二区三区| 成人91在线观看| 欧美一区二区三区在线电影| 福利电影一区二区三区| 亚洲制服丝袜av| 国产女人18水真多18精品一级做| 国产日韩欧美a| 欧美亚洲综合一区| 成人免费观看视频| 久草中文综合在线| 日日摸夜夜添夜夜添亚洲女人| 欧美三级电影网| 五月婷婷综合网| 亚洲天堂av老司机| 久久精品一区二区| 欧美xxxxx牲另类人与| 欧美三级三级三级| 亚洲久草在线视频| 在线视频国产一区| 美女视频一区在线观看| 亚洲视频电影在线| 欧美va在线播放| 91亚洲精华国产精华精华液| 亚洲女厕所小便bbb| 欧美二区在线观看| 欧美精品久久99| 色综合激情五月| 盗摄精品av一区二区三区| 精品一区二区三区在线观看国产 | 国产一区二区三区久久久 | 欧美在线观看视频在线| 国产传媒日韩欧美成人| 成人欧美一区二区三区1314| 日韩理论片在线| 亚洲男人都懂的| 亚洲欧洲日产国码二区| 中文字幕欧美区| 欧美日韩国产bt| 26uuu精品一区二区三区四区在线| 欧美本精品男人aⅴ天堂| 欧美一区二区成人| 欧美成人三级在线| 欧美日韩精品一区二区天天拍小说| 日韩一级免费观看| 日韩天堂在线观看| 日韩精品一区二区三区四区| 91精品国产丝袜白色高跟鞋| 欧美性感一类影片在线播放| 欧美日韩在线一区二区| 91精品国产综合久久福利软件| 国产乱理伦片在线观看夜一区| 欧美在线不卡视频| 欧美在线视频不卡| 欧美三片在线视频观看| 欧美日韩在线播放一区| 欧美人与z0zoxxxx视频| 久久女同互慰一区二区三区| 日本一区二区免费在线观看视频 | 日韩中文欧美在线| 亚洲va国产天堂va久久en| 亚洲精品亚洲人成人网在线播放| 麻豆久久久久久久| 国产二区国产一区在线观看| 丁香六月久久综合狠狠色| 97精品超碰一区二区三区| 国产在线播放一区三区四| 欧美在线视频你懂得| 制服丝袜成人动漫| 欧美电视剧免费全集观看| 精品国产一区二区三区四区四| 亚洲男同性视频| 国产精品99精品久久免费| 精品一区二区三区不卡| 成人免费视频免费观看| a在线欧美一区| 欧美精品一区二区三区在线播放 | 国产精品自拍网站| www.欧美日韩| 6080国产精品一区二区| 国产无遮挡一区二区三区毛片日本| 国产网红主播福利一区二区| 亚洲国产视频a| 国产美女在线观看一区| 91免费版pro下载短视频| 欧美日韩卡一卡二| 洋洋成人永久网站入口| 韩日av一区二区| 色吧成人激情小说| 26uuu国产在线精品一区二区| 亚洲小说欧美激情另类| 国产 欧美在线| 欧美日本在线一区| 国产精品色噜噜| 精品在线播放免费| 国产成人自拍网| 在线观看视频一区| 精品成人一区二区三区| 最近日韩中文字幕| 亚洲成av人片观看| 欧美亚洲国产一区二区三区va| 日韩精品一区二区三区四区| 亚洲欧美在线视频| 蜜臀91精品一区二区三区| 欧美一级夜夜爽| 亚洲人被黑人高潮完整版| 久99久精品视频免费观看| 欧美系列一区二区| 精品日韩一区二区三区| 亚洲国产精品欧美一二99| 国产高清无密码一区二区三区| 欧美中文字幕亚洲一区二区va在线| 欧美一区二区在线播放| 人人狠狠综合久久亚洲| 激情综合色播五月| 欧美性视频一区二区三区| 中文字幕视频一区| 色综合天天综合| 久久精品亚洲精品国产欧美| 美女免费视频一区二区| 欧美日韩小视频| 精品美女一区二区三区| 免费观看91视频大全| 欧美精品 国产精品| 亚洲精品国产视频| 亚洲第一综合色| 成人一级片在线观看| 久久日韩粉嫩一区二区三区| 久色婷婷小香蕉久久| 欧美一区二区三区小说| 国产精品影视在线| 欧美精品一区二区三区四区| 天天操天天色综合| 一区二区高清在线| 久久99蜜桃精品| 日韩一区二区中文字幕| 日韩国产一区二| 欧美在线高清视频| 一区二区高清免费观看影视大全 | 一区二区三区四区在线| 欧美性大战久久久久久久| 欧美在线不卡视频| 免费在线欧美视频| 欧美一区二区三区喷汁尤物| 日韩电影一区二区三区四区| 高清日韩电视剧大全免费| 中文字幕佐山爱一区二区免费| 国产ts人妖一区二区| 国产日韩一级二级三级| 精品一二三四在线| 亚洲男人天堂av网| 欧美午夜不卡视频| 亚洲成人av免费| 在线综合+亚洲+欧美中文字幕| 丁香六月久久综合狠狠色| 中文字幕第一区二区| 成人av综合在线| 亚洲美女一区二区三区| 欧美zozozo| 成人性色生活片免费看爆迷你毛片| 欧美国产日韩一二三区| 91网站视频在线观看| 韩国欧美国产一区| 国产精品久久三区| 色婷婷国产精品| 一区二区欧美精品| 中文字幕不卡在线| 91成人网在线| 秋霞电影网一区二区| 日韩视频在线观看一区二区| 国产不卡在线播放| 亚洲免费av高清| 91麻豆精品国产91久久久久久 | 欧美在线观看你懂的| 懂色av一区二区在线播放| 亚洲伦理在线免费看| 欧美日韩国产天堂| 韩国欧美国产1区| 美国毛片一区二区三区| 国产欧美一区二区三区鸳鸯浴 | 亚洲黄色小视频| 欧美在线视频你懂得| 久久国产视频网| 国产精品成人一区二区艾草 | 欧美日韩精品系列| 日本va欧美va瓶| 欧美国产综合色视频| 欧美亚洲高清一区| 久久99国产精品久久| 亚洲一级二级在线| 久久综合九色综合欧美就去吻| 色系网站成人免费| 奇米四色…亚洲| 亚洲午夜精品在线| 国产欧美一区二区三区沐欲 | 亚洲成人免费观看| 粉嫩嫩av羞羞动漫久久久| 国产精品一区二区在线看| 国产精品美女一区二区| 日韩欧美综合一区| av网站免费线看精品|