1 package com.android.hotspot2.asn1; 2 3 import java.nio.ByteBuffer; 4 import java.util.Collection; 5 6 public class Asn1Boolean extends Asn1Object { 7 private final boolean mBoolean; 8 Asn1Boolean(int tag, Asn1Class asn1Class, int length, ByteBuffer data)9 public Asn1Boolean(int tag, Asn1Class asn1Class, int length, ByteBuffer data) 10 throws DecodeException { 11 super(tag, asn1Class, false, length); 12 if (length != 1) { 13 throw new DecodeException("Boolean length != 1: " + length, data.position()); 14 } 15 mBoolean = data.get() != 0; 16 } 17 getValue()18 public boolean getValue() { 19 return mBoolean; 20 } 21 22 @Override getChildren()23 public Collection<Asn1Object> getChildren() { 24 throw new UnsupportedOperationException(); 25 } 26 27 @Override toString()28 public String toString() { 29 return super.toString() + "=" + Boolean.toString(mBoolean); 30 } 31 } 32