Package org.hxzon.asn1.core.type

Examples of org.hxzon.asn1.core.type.BerInteger


    public static BerNode createBerInteger16(String name, String display, int tag, BerInputStream stream) {
        return new BerInteger().limitBitLength(16).init(name, display, tag, stream);
    }

    public static BerNode createBerInteger32(String name, String display, int tag, BerInputStream stream) {
        return new BerInteger().limitBitLength(32).init(name, display, tag, stream);
    }
View Full Code Here


//  }

    public BerNode create(int tag, BerInputStream stream) {
        switch (tag) {
        case Tag.CONTEXT | 0:
            return new BerNull().init("vmd specific", "vmd specific", tag, stream);
        case Tag.CONTEXT | 1:
            return new Identifier().init("domain specific", "domain specific", tag, stream);
        case Tag.CONTEXT | 2:
            return new BerNull().init("aaSpecific", "aaSpecific", tag, stream);
        default:
            return Asn1Utils.createUnknown(tag, stream);
        }
    }
View Full Code Here

            return Asn1Utils.createBerBoolean("status", "status", tag, stream);
        case Tag.CONTEXT | 1:
            return new GetNameListRequest().init("getNameList", "getNameList", tag, stream);
        case Tag.CONTEXT | 2:
            //Identify-Request ::= NULL
            return new BerNull().init("identify", "identify", tag, stream);
        case Tag.CONTEXT | 3:
            return new RenameRequest().init("rename", "rename", tag, stream);
        case Tag.CONTEXT | 4:
            return new ReadRequest().init("read", "read", tag, stream);
        case Tag.CONTEXT | 5:
View Full Code Here

        setId("seq of " + type.getSimpleName());
    }

    @Override
    public BerNode create(int tag, BerInputStream stream) {
        BerNode node = null;
        try {
            node = _type.newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (node instanceof BerChoice) {
            return ((BerChoice) node).init(tag, stream, _choiceChildHasTag);
        }
        return node.init(tag, stream);
    }
View Full Code Here

        System.out.println(reverse);
        ByteArrayInputStream inStream = new ByteArrayInputStream(data);
        BerInputStream in = new BerInputStream(inStream);

        SvPduParser parser = SvPduParser.parser;
        BerNode node;
        while (null != (node = parser.readPacket(in))) {
            System.out.println(Asn1Utils.printBerNode(node));
        }
    }
View Full Code Here

//        String reverse=BytesUtil.toHexString(data);
//        System.out.println(reverse);
        ByteArrayInputStream inStream = new ByteArrayInputStream(data);
        BerInputStream in = new BerInputStream(inStream);

        BerNode node;
        while (null != (node = OsiPresentationParser.parser.readPacket(in))) {
            System.out.println(Asn1Utils.printBerNode(node));
        }
    }
View Full Code Here

            return Asn1Utils.createUnknown(tag, stream);
        }
    }

    public BerNode[] getUserData() {
        BerNode child = this.getRealNode();
        if (child instanceof UserDataContainer) {
            //pdv list or fully encoded data
            return ((UserDataContainer) child).getUserData();
        }
        //simplyEncodedData,unknown
View Full Code Here

            return Asn1Utils.createUnknown(tag, stream);
        }
    }

    public BerNode[] getUserData() {
        BerNode child = this.getRealNode();
        if (child instanceof UserDataContainer) {
            //single asn1 type
            return ((UserDataContainer) child).getUserData();
        }
        //octet-aligned,arbitrary,unknown
View Full Code Here

    }

    private void init(Sv91Pdu pdu, int offset) {
        byte[] data = pdu.getValue();
        fList = new ArrayList<BerNode>(25);
        BerNode node;
        offset += 0;
        int len = 2;
        datasetLen = (int) BytesUtil.toSigned(data, offset, len);
        node = Asn1Utils.createFakeBerInteger("datasetLen", "数据集长度", datasetLen, this.getValueOffset() + offset, len);
        fList.add(node);
View Full Code Here

    protected void readValue(BerInputStream stream) {
        super.readValue(stream);
        byte[] value = getValue();
        int asduNum = (int) BytesUtil.toSigned(value, 0, 2);
        fList = new ArrayList<BerNode>(asduNum + 1);
        BerNode numberOfAsdu = Asn1Utils.createFakeBerInteger("number of asdu", "asdu条目数", asduNum, this.getValueOffset() + 0, 2);
        fList.add(numberOfAsdu);
        for (int i = 0; i < asduNum; i++) {
            BerNode node = new Sv91Asdu(this, 2 + i * 46);
            fList.add(node);
        }
    }
View Full Code Here

TOP

Related Classes of org.hxzon.asn1.core.type.BerInteger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.