Latest bnd code
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1350613 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/libg/asn1/PDU.java b/bundleplugin/src/main/java/aQute/libg/asn1/PDU.java
index 033928c..2fb29fb 100644
--- a/bundleplugin/src/main/java/aQute/libg/asn1/PDU.java
+++ b/bundleplugin/src/main/java/aQute/libg/asn1/PDU.java
@@ -3,112 +3,109 @@
import java.util.*;
public class PDU implements Types, Iterable<PDU> {
- final int identifier;
- final Object payload;
- byte data[] = new byte[100];
+ final int identifier;
+ final Object payload;
+ byte data[] = new byte[100];
+ public PDU(int id, Object payload) {
+ identifier = id;
+ this.payload = payload;
+ }
- public PDU(int id, Object payload) {
- identifier = id;
- this.payload = payload;
- }
+ public PDU(Date payload) {
+ identifier = UTCTIME;
+ this.payload = payload;
+ }
- public PDU(Date payload) {
- identifier = UTCTIME;
- this.payload = payload;
- }
+ public PDU(int n) {
+ this(UNIVERSAL + INTEGER, n);
+ }
- public PDU(int n) {
- this(UNIVERSAL+INTEGER, n);
- }
+ public PDU(boolean value) {
+ this(UNIVERSAL + BOOLEAN, value);
+ }
- public PDU(boolean value) {
- this(UNIVERSAL+BOOLEAN, value);
- }
+ public PDU(String s) throws Exception {
+ this(UNIVERSAL + IA5STRING, s);
+ }
- public PDU(String s) throws Exception {
- this(UNIVERSAL+IA5STRING, s);
- }
-
- public PDU(byte[] data) {
- this(UNIVERSAL+OCTET_STRING, data);
- }
-
- public PDU(BitSet bits) {
- this(UNIVERSAL+BIT_STRING, bits);
- }
+ public PDU(byte[] data) {
+ this(UNIVERSAL + OCTET_STRING, data);
+ }
- public PDU(int top, int l1, int... remainder) {
- identifier = UNIVERSAL+OBJECT_IDENTIFIER;
- int[] ids = new int[remainder.length + 2];
- ids[0] = top;
- ids[1] = l1;
- System.arraycopy(remainder, 0, ids, 2, remainder.length);
- payload = ids;
- }
+ public PDU(BitSet bits) {
+ this(UNIVERSAL + BIT_STRING, bits);
+ }
- public PDU(int tag, PDU... set) {
- this(tag,(Object)set);
- }
+ public PDU(int top, int l1, int... remainder) {
+ identifier = UNIVERSAL + OBJECT_IDENTIFIER;
+ int[] ids = new int[remainder.length + 2];
+ ids[0] = top;
+ ids[1] = l1;
+ System.arraycopy(remainder, 0, ids, 2, remainder.length);
+ payload = ids;
+ }
- public PDU(PDU... set) {
- this(SEQUENCE+CONSTRUCTED,set);
- }
+ public PDU(int tag, PDU... set) {
+ this(tag, (Object) set);
+ }
+ public PDU(PDU... set) {
+ this(SEQUENCE + CONSTRUCTED, set);
+ }
- public int getTag() {
- return identifier & TAGMASK;
- }
+ public int getTag() {
+ return identifier & TAGMASK;
+ }
- int getClss() {
- return identifier & CLASSMASK;
- }
+ int getClss() {
+ return identifier & CLASSMASK;
+ }
- public boolean isConstructed() {
- return (identifier & CONSTRUCTED) != 0;
- }
+ public boolean isConstructed() {
+ return (identifier & CONSTRUCTED) != 0;
+ }
- public String getString() {
- return (String) payload;
- }
+ public String getString() {
+ return (String) payload;
+ }
- public Iterator<PDU> iterator() {
- return Arrays.asList((PDU[]) payload).iterator();
- }
+ public Iterator<PDU> iterator() {
+ return Arrays.asList((PDU[]) payload).iterator();
+ }
-
- public int[] getOID() {
- assert getTag() == OBJECT_IDENTIFIER;
- return (int[]) payload;
- }
+ public int[] getOID() {
+ assert getTag() == OBJECT_IDENTIFIER;
+ return (int[]) payload;
+ }
- public Boolean getBoolean() {
- assert getTag() == BOOLEAN;
- return (Boolean) payload;
- }
+ public Boolean getBoolean() {
+ assert getTag() == BOOLEAN;
+ return (Boolean) payload;
+ }
- public BitSet getBits() {
- assert getTag() == BIT_STRING;
- return (BitSet) payload;
- }
+ public BitSet getBits() {
+ assert getTag() == BIT_STRING;
+ return (BitSet) payload;
+ }
- public int getInt() {
- assert getTag() == INTEGER || getTag() == ENUMERATED;
- return (Integer) payload;
- }
+ public int getInt() {
+ assert getTag() == INTEGER || getTag() == ENUMERATED;
+ return (Integer) payload;
+ }
- public byte[] getBytes() {
- return (byte[]) payload;
- }
+ public byte[] getBytes() {
+ return (byte[]) payload;
+ }
- public PDU[] getChildren() {
- assert isConstructed();
- return (PDU[]) payload;
- }
+ public PDU[] getChildren() {
+ assert isConstructed();
+ return (PDU[]) payload;
+ }
- public Date getDate() {
- assert getTag() == UTCTIME || getTag() == GENERALIZED_TIME;
- return (Date) payload;
- }
+ public Date getDate() {
+ assert getTag() == UTCTIME || getTag() == GENERALIZED_TIME;
+ return (Date) payload;
+ }
}