1 /*
2  * @(#) $Id: ASN1Boolean.java,v 1.4 2003/07/08 08:13:52 pankaj Exp $
3  *
4  * Copyright (c) 2002-03 by Pankaj Kumar (http://www.pankaj-k.net). 
5  * All rights reserved.
6  *
7  * The license governing the use of this file can be found in the 
8  * root directory of the containing software.
9  */
10package org.jstk.asn1;
11
12public class ASN1Boolean extends ASN1Type {
13    public ASN1Boolean(){
14        super(UNIVERSAL, NONE, BOOLEAN, BOOLEAN);
15    }
16    public void setValue(boolean boolValue){
17        byte[] val = new byte[1];
18        val[0] = (byte)(boolValue ? 0x01 : 0x00);
19        setValue(val);
20    }
21    public String toString(){
22        return (getValue() != null && getValue()[0] != 0x00 ? "true" : "false");
23    }
24}