⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 indefinitelengthinputstream.java

📁 java 文件下载器。可自定义
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   IndefiniteLengthInputStream.java

package org.bouncycastle.asn1;

import java.io.IOException;
import java.io.InputStream;

// Referenced classes of package org.bouncycastle.asn1:
//			LimitedInputStream

class IndefiniteLengthInputStream extends LimitedInputStream
{

	private int _b1;
	private int _b2;
	private boolean _eofReached;
	private boolean _eofOn00;

	IndefiniteLengthInputStream(InputStream in)
		throws IOException
	{
		super(in);
		_eofReached = false;
		_eofOn00 = true;
		_b1 = in.read();
		_b2 = in.read();
		_eofReached = _b2 < 0;
	}

	void setEofOn00(boolean eofOn00)
	{
		_eofOn00 = eofOn00;
	}

	boolean checkForEof()
	{
		if (_eofOn00 && _b1 == 0 && _b2 == 0)
		{
			_eofReached = true;
			setParentEofDetect(true);
		}
		return _eofReached;
	}

	public int read(byte b[], int off, int len)
		throws IOException
	{
		if (_eofOn00 || len < 3)
			return super.read(b, off, len);
		if (_eofReached)
			return -1;
		int numRead = _in.read(b, off + 2, len - 2);
		if (numRead < 0)
		{
			_eofReached = true;
			return -1;
		}
		b[off] = (byte)_b1;
		b[off + 1] = (byte)_b2;
		_b1 = _in.read();
		_b2 = _in.read();
		if (_b2 < 0)
			_eofReached = true;
		return numRead + 2;
	}

	public int read()
		throws IOException
	{
		if (checkForEof())
			return -1;
		int b = _in.read();
		if (b < 0)
		{
			_eofReached = true;
			return -1;
		} else
		{
			int v = _b1;
			_b1 = _b2;
			_b2 = b;
			return v;
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -