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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? archiverecord.java

?? 爬蟲
?? JAVA
字號:
/* $Id: ArchiveRecord.java,v 1.8 2006/08/31 16:51:41 stack-sf Exp $ * * Created on August 21st, 2006 * * Copyright (C) 2006 Internet Archive. * * This file is part of the Heritrix web crawler (crawler.archive.org). * * Heritrix is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * any later version. * * Heritrix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU Lesser Public License for more details. * * You should have received a copy of the GNU Lesser Public License * along with Heritrix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */package org.archive.io;import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.security.MessageDigest;import java.security.NoSuchAlgorithmException;import java.util.logging.Level;import org.archive.util.Base32;/** * Archive file Record. * @author stack * @version $Date: 2006/08/31 16:51:41 $ $Version$ */public abstract class ArchiveRecord extends InputStream {    ArchiveRecordHeader header = null;    /**     * Stream to read this record from.     *     * Stream can only be read sequentially.  Will only return this records'     * content returning a -1 if you try to read beyond the end of the current     * record.     *     * <p>Streams can be markable or not.  If they are, we'll be able to roll     * back when we've read too far.  If not markable, assumption is that     * the underlying stream is managing our not reading too much (This pertains     * to the skipping over the end of the ARCRecord.  See {@link #skip()}.     */    InputStream in = null;    /**     * Position w/i the Record content, within <code>in</code>.     * This position is relative within this Record.  Its not same as the     * Archive file position.     */    long position = 0;    /**     * Set flag when we've reached the end-of-record.     */    boolean eor = false;        /**     * Compute digest on what we read and add to metadata when done.     *      * Currently hardcoded as sha-1. TODO: Remove when archive records     * digest or else, add a facility that allows the arc reader to     * compare the calculated digest to that which is recorded in     * the arc.     *      * <p>Protected instead of private so subclasses can update and complete     * the digest.     */    protected MessageDigest digest = null;    private String digestStr = null;    boolean strict = false;        private int contentBegin = -1;        private ArchiveRecord() {        super();    }        /**     * Constructor.     *     * @param in Stream cue'd up to be at the start of the record this instance     * is to represent.     * @throws IOException     */    public ArchiveRecord(InputStream in)            throws IOException {        this(in, null, 0, true, false);    }        /**     * Constructor.     *     * @param in Stream cue'd up to be at the start of the record this instance     * is to represent.     * @param header Header data.     * @throws IOException     */    public ArchiveRecord(InputStream in, ArchiveRecordHeader header)            throws IOException {        this(in, header, 0, true, false);    }    /**     * Constructor.     *     * @param in Stream cue'd up to be at the start of the record this instance     * is to represent.     * @param header Header data.     * @param bodyOffset Offset into the body.  Usually 0.     * @param digest True if we're to calculate digest for this record.  Not     * digesting saves about ~15% of cpu during an ARC parse.     * @param strict Be strict parsing (Parsing stops if ARC inproperly     * formatted).     * @throws IOException     */    public ArchiveRecord(InputStream in, ArchiveRecordHeader header,        int bodyOffset, boolean digest, boolean strict)     throws IOException {        this.in = in;        this.header = header;        this.position = bodyOffset;        if (digest) {            try {                this.digest = MessageDigest.getInstance("SHA1");            } catch (NoSuchAlgorithmException e) {                // Convert to IOE because thats more amenable to callers                // -- they are dealing with it anyways.                throw new IOException(e.getMessage());            }        }        this.strict = strict;    }    public boolean markSupported() {        return false;    }    /**     * @return Header data for this record.     */    public ArchiveRecordHeader getHeader() {        return this.header;    }    	protected void setHeader(ArchiveRecordHeader header) {		this.header = header;	}    /**     * Calling close on a record skips us past this record to the next record     * in the stream.     *     * It does not actually close the stream.  The underlying steam is probably     * being used by the next arc record.     *     * @throws IOException     */    public void close() throws IOException {        if (this.in != null) {            skip();            this.in = null;            if (this.digest != null) {            	this.digestStr = Base32.encode(this.digest.digest());            }        }    }    /**	 * @return Next character in this Record content else -1 if at EOR.	 * @throws IOException	 */	public int read() throws IOException {		int c = -1;		if (available() > 0) {			c = this.in.read();			if (c == -1) {				throw new IOException("Premature EOF before end-of-record.");			}			if (this.digest != null) {				this.digest.update((byte) c);			}		}		incrementPosition();		return c;	}    public int read(byte[] b, int offset, int length) throws IOException {		int read = Math.min(length, available());		if (read == -1 || read == 0) {			read = -1;		} else {			read = this.in.read(b, offset, read);			if (read == -1) {				String msg = "Premature EOF before end-of-record: "					+ getHeader().getHeaderFields();				if (isStrict()) {					throw new IOException(msg);				}				setEor(true);				System.err.println(Level.WARNING.toString() + " " + msg);			}			if (this.digest != null && read >= 0) {				this.digest.update(b, offset, read);			}		}		incrementPosition(read);		return read;	}    /**	 * This available is not the stream's available. Its an available based on	 * what the stated Archive record length is minus what we've read to date.	 * 	 * @return True if bytes remaining in record content.	 */    public int available() {        return (int)(getHeader().getLength() - getPosition());    }    /**     * Skip over this records content.     *     * @throws IOException     */    void skip() throws IOException {        if (this.eor) {            return;        }                // Read to the end of the body of the record.  Exhaust the stream.        // Can't skip direct to end because underlying stream may be compressed        // and we're calculating the digest for the record.        if (available() > 0) {            skip(available());        }    }        public long skip(long n) throws IOException {        final int SKIP_BUFFERSIZE = 1024 * 4;        byte[] b = new byte[SKIP_BUFFERSIZE];        long total = 0;        for (int read = 0; (total < n) && (read != -1);) {            read = Math.min(SKIP_BUFFERSIZE, (int) (n - total));            // TODO: Interesting is that reading from compressed stream, we only            // read about 500 characters at a time though we ask for 4k.            // Look at this sometime.            read = read(b, 0, read);            if (read <= 0) {                read = -1;            } else {                total += read;            }        }        return total;    }    /**     * @return Returns the strict.     */    public boolean isStrict() {        return this.strict;    }    /**     * @param strict The strict to set.     */    public void setStrict(boolean strict) {        this.strict = strict;    }	protected InputStream getIn() {		return this.in;	}	public String getDigestStr() {		return this.digestStr;	}		protected void incrementPosition() {		this.position++;	}		protected void incrementPosition(final long incr) {		this.position += incr;	}		protected long getPosition() {		return this.position;	}	protected boolean isEor() {		return eor;	}	protected void setEor(boolean eor) {		this.eor = eor;	}		protected String getStatusCode4Cdx(final ArchiveRecordHeader h) {		return "-";	}		protected String getIp4Cdx(final ArchiveRecordHeader h) {		return "-";	}		protected String getDigest4Cdx(final ArchiveRecordHeader h) {		return getDigestStr() == null? "-": getDigestStr();	}        protected String getMimetype4Cdx(final ArchiveRecordHeader h) {        return h.getMimetype();    }    protected String outputCdx(final String strippedFileName)    throws IOException {        // Read the whole record so we get out a hash. Should be safe calling    	// close on already closed Record.        close();        ArchiveRecordHeader h = getHeader();        StringBuilder buffer =        	new StringBuilder(ArchiveFileConstants.CDX_LINE_BUFFER_SIZE);        buffer.append(h.getDate());        buffer.append(ArchiveFileConstants.SINGLE_SPACE);        buffer.append(getIp4Cdx(h));        buffer.append(ArchiveFileConstants.SINGLE_SPACE);        buffer.append(h.getUrl());        buffer.append(ArchiveFileConstants.SINGLE_SPACE);        buffer.append(getMimetype4Cdx(h));        buffer.append(ArchiveFileConstants.SINGLE_SPACE);        buffer.append(getStatusCode4Cdx(h));        buffer.append(ArchiveFileConstants.SINGLE_SPACE);        buffer.append(getDigest4Cdx(h));        buffer.append(ArchiveFileConstants.SINGLE_SPACE);        buffer.append(h.getOffset());        buffer.append(ArchiveFileConstants.SINGLE_SPACE);        buffer.append(h.getLength());        buffer.append(ArchiveFileConstants.SINGLE_SPACE);        buffer.append(strippedFileName != null? strippedFileName: "-");        return buffer.toString();    }        /**     * Writes output on STDOUT.     * @throws IOException     */    public void dump()    throws IOException {    	dump(System.out);    }        /**     * Writes output on passed <code>os</code>.     * @throws IOException     */    public void dump(final OutputStream os)    throws IOException {    	final byte [] outputBuffer = new byte [16*1024];        int read = outputBuffer.length;        while ((read = read(outputBuffer, 0, outputBuffer.length)) != -1) {            os.write(outputBuffer, 0, read);        }        os.flush();    }}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
香蕉av福利精品导航| 这里只有精品99re| 亚洲天堂成人网| 欧美中文字幕一二三区视频| 日韩电影在线一区二区| 久久欧美一区二区| 色哟哟一区二区在线观看| 日韩av一级电影| 日本系列欧美系列| 蜜臀av一区二区在线免费观看| 欧美激情综合五月色丁香 | 国产寡妇亲子伦一区二区| 亚洲男帅同性gay1069| 日韩欧美中文字幕制服| 91视频免费看| 狠狠色狠狠色合久久伊人| 国产精品久久久久精k8| 日韩一区二区三区电影 | 国产色一区二区| 91麻豆精品国产91久久久久久久久| 欧美日韩激情一区| 成人黄色电影在线| 免费成人av资源网| 亚洲在线观看免费视频| 国产欧美一区二区三区在线看蜜臀 | 成人av网址在线观看| av福利精品导航| 国产河南妇女毛片精品久久久 | 欧美高清精品3d| 色成年激情久久综合| 成人一区二区三区视频在线观看 | 国产精品综合av一区二区国产馆| 亚洲国产精品久久一线不卡| 亚洲欧美日韩人成在线播放| 亚洲综合一区二区| 美女诱惑一区二区| 成人高清av在线| 欧美日韩中字一区| 91久久久免费一区二区| 欧美日韩成人一区| 久久久久免费观看| 亚洲精品少妇30p| 亚洲视频 欧洲视频| 亚洲成av人片一区二区梦乃| 精品在线视频一区| 精品一区二区三区免费| 成人av电影在线播放| 欧美日免费三级在线| 亚洲精品在线三区| 精品国产sm最大网站免费看| 国产精品国产自产拍在线| 香蕉乱码成人久久天堂爱免费| 精品无码三级在线观看视频| 91在线视频播放地址| 91视频免费看| 精品盗摄一区二区三区| 亚洲精品中文字幕乱码三区| 久久精品久久久精品美女| 久久精品免费观看| 一本久久a久久精品亚洲| 欧美电影免费观看高清完整版 | 欧美三片在线视频观看| 2021中文字幕一区亚洲| 国产欧美日韩在线| 日一区二区三区| 久久成人免费网| 色哟哟一区二区在线观看| 久久久精品tv| 蜜桃在线一区二区三区| 在线视频一区二区三区| 欧美激情综合在线| 久久精品国产免费| 欧美专区亚洲专区| 国产精品久久久久毛片软件| 麻豆精品国产传媒mv男同| 欧美网站大全在线观看| 日韩一级成人av| 亚洲另类在线一区| 懂色av中文字幕一区二区三区| 99精品视频一区二区三区| 精品久久人人做人人爰| 国产精品伦一区二区三级视频| 岛国一区二区在线观看| 欧美精品视频www在线观看| 亚洲欧洲日韩在线| 亚洲午夜一区二区| 本田岬高潮一区二区三区| 久久人人爽人人爽| 久久99精品久久久久婷婷| 欧美丝袜丝nylons| 自拍偷拍国产精品| 成人午夜av在线| 国产情人综合久久777777| 激情综合网av| 精品国产免费人成在线观看| 日韩中文字幕区一区有砖一区 | 一区二区三区不卡在线观看| 奇米亚洲午夜久久精品| 欧洲一区二区av| 亚洲六月丁香色婷婷综合久久 | 天天影视网天天综合色在线播放| 激情综合网av| 亚洲精品一区二区三区精华液| 免费美女久久99| 日韩欧美精品三级| 久久精品99国产精品日本| 欧美一区二区性放荡片| 亚洲特级片在线| 91丨国产丨九色丨pron| 亚洲你懂的在线视频| 色综合久久综合网欧美综合网| 国产精品三级视频| voyeur盗摄精品| 亚洲免费观看高清完整版在线| 97精品久久久久中文字幕| 亚洲欧洲制服丝袜| 欧美影院一区二区| 日韩不卡在线观看日韩不卡视频| 91精品国产综合久久精品app| 日本在线不卡视频| 精品剧情v国产在线观看在线| 国产伦精品一区二区三区在线观看| 欧美情侣在线播放| 美女高潮久久久| 久久久99久久| 99久久免费国产| 亚洲成av人综合在线观看| 欧美一级在线视频| 久久99久久久欧美国产| 国产喂奶挤奶一区二区三区| thepron国产精品| 亚洲小说春色综合另类电影| 91精品国产丝袜白色高跟鞋| 国产伦精品一区二区三区免费迷| 中文字幕乱码亚洲精品一区| 一本一本大道香蕉久在线精品| 色婷婷久久久久swag精品| 亚洲一区二区在线免费观看视频 | 亚洲欧美日韩精品久久久久| 欧美日韩一级片在线观看| 欧美aaaaa成人免费观看视频| 久久久久久久精| 日本国产一区二区| 久久国产福利国产秒拍| 中文字幕一区二区不卡| 欧美人狂配大交3d怪物一区| 国产精品一品视频| 亚洲综合免费观看高清完整版 | 亚洲va韩国va欧美va| 精品国产成人在线影院| 91美女视频网站| 免费人成网站在线观看欧美高清| 国产亚洲午夜高清国产拍精品| 色综合中文字幕| 亚洲色图欧洲色图| 日韩午夜精品视频| www.在线欧美| 久久99精品久久久久久| ●精品国产综合乱码久久久久| 欧美日本一区二区三区四区| 国产一区二区调教| 亚洲曰韩产成在线| 国产人妖乱国产精品人妖| 精品视频色一区| 不卡的av电影| 久久精品99国产精品| 亚洲一区免费在线观看| 国产午夜亚洲精品午夜鲁丝片| 精品污污网站免费看| 成人性生交大片免费看中文| 日韩av电影一区| 亚洲欧美aⅴ...| 久久亚洲综合色一区二区三区| 欧美综合色免费| 精品国产免费久久| 日本丶国产丶欧美色综合| 粉嫩嫩av羞羞动漫久久久 | 国产一区二区三区日韩 | 懂色av一区二区三区蜜臀| 日韩精品乱码免费| 亚洲自拍欧美精品| 亚洲欧洲av在线| 国产网站一区二区| 日韩精品在线网站| 欧美精品久久久久久久多人混战 | 国产综合色视频| 日韩专区在线视频| 一区二区视频在线| 中文字幕一区在线观看视频| 久久久久久电影| 精品国产一区二区三区不卡| 91精品蜜臀在线一区尤物| 欧洲精品视频在线观看| 99久久99久久精品国产片果冻| 大陆成人av片| 国产成人精品综合在线观看| 国产原创一区二区三区| 日韩精品视频网站| 天天色图综合网| 亚洲bt欧美bt精品777|