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

📄 derenumerated.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:   DEREnumerated.java

package org.bouncycastle.asn1;

import java.io.IOException;
import java.math.BigInteger;

// Referenced classes of package org.bouncycastle.asn1:
//			ASN1Object, ASN1OctetString, ASN1TaggedObject, DEROutputStream, 
//			DERObject

public class DEREnumerated extends ASN1Object
{

	byte bytes[];

	public static DEREnumerated getInstance(Object obj)
	{
		if (obj == null || (obj instanceof DEREnumerated))
			return (DEREnumerated)obj;
		if (obj instanceof ASN1OctetString)
			return new DEREnumerated(((ASN1OctetString)obj).getOctets());
		if (obj instanceof ASN1TaggedObject)
			return getInstance(((ASN1TaggedObject)obj).getObject());
		else
			throw new IllegalArgumentException((new StringBuilder()).append("illegal object in getInstance: ").append(obj.getClass().getName()).toString());
	}

	public static DEREnumerated getInstance(ASN1TaggedObject obj, boolean explicit)
	{
		return getInstance(obj.getObject());
	}

	public DEREnumerated(int value)
	{
		bytes = BigInteger.valueOf(value).toByteArray();
	}

	public DEREnumerated(BigInteger value)
	{
		bytes = value.toByteArray();
	}

	public DEREnumerated(byte bytes[])
	{
		this.bytes = bytes;
	}

	public BigInteger getValue()
	{
		return new BigInteger(bytes);
	}

	void encode(DEROutputStream out)
		throws IOException
	{
		out.writeEncoded(10, bytes);
	}

	boolean asn1Equals(DERObject o)
	{
		if (!(o instanceof DEREnumerated))
			return false;
		DEREnumerated other = (DEREnumerated)o;
		if (bytes.length != other.bytes.length)
			return false;
		for (int i = 0; i != bytes.length; i++)
			if (bytes[i] != other.bytes[i])
				return false;

		return true;
	}

	public int hashCode()
	{
		return getValue().hashCode();
	}
}

⌨️ 快捷键说明

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