public int encode(BerByteArrayOutputStream berOStream, boolean explicit) throws IOException { berOStream.write(value); int codeLength = value.length; codeLength += BerLength.encodeLength(berOStream, codeLength); return codeLength; }
public int decode(InputStream is, BerTag tag) throws IOException { int decodedLength = 0; int tagLength; if (tag == null) { tag = new BerTag(); tagLength = tag.decode(is); decodedLength += tagLength; } else { tagLength = tag.encode(new ReverseByteArrayOutputStream(10)); } BerLength lengthField = new BerLength(); int lengthLength = lengthField.decode(is); decodedLength += lengthLength + lengthField.val; value = new byte[tagLength + lengthLength + lengthField.val]; Util.readFully(is, value, tagLength + lengthLength, lengthField.val); ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(value, tagLength + lengthLength - 1); BerLength.encodeLength(os, lengthField.val); tag.encode(os); return decodedLength; }
public int decode(InputStream is, BerTag berTag) throws IOException { int codeLength = 0; BerTag passedTag = berTag; if (berTag == null) { berTag = new BerTag(); codeLength += berTag.decode(is); } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { codeLength += BerLength.skip(is); name = new ObjectName(); codeLength += name.decode(is, null); return codeLength; } if (passedTag != null) { return 0; } throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item."); }
public int decode(InputStream is, BerTag tag) throws IOException { int decodedLength = 0; int tagLength; if (tag == null) { tag = new BerTag(); tagLength = tag.decode(is); decodedLength += tagLength; } else { tagLength = tag.encode(new ReverseByteArrayOutputStream(10)); } BerLength lengthField = new BerLength(); int lengthLength = lengthField.decode(is); decodedLength += lengthLength + lengthField.val; value = new byte[tagLength + lengthLength + lengthField.val]; Util.readFully(is, value, tagLength + lengthLength, lengthField.val); ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(value, tagLength + lengthLength - 1); BerLength.encodeLength(os, lengthField.val); tag.encode(os); return decodedLength; }
public int decode(InputStream is, BerTag berTag) throws IOException { int codeLength = 0; BerTag passedTag = berTag; if (berTag == null) { berTag = new BerTag(); codeLength += berTag.decode(is); } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { codeLength += BerLength.skip(is); name = new ObjectName(); codeLength += name.decode(is, null); return codeLength; } if (passedTag != null) { return 0; } throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item."); }
public int decode(InputStream iStream, boolean explicit) throws IOException { int codeLength = 0; BerLength length = new BerLength(); codeLength += length.decode(iStream); value = new byte[length.val]; if (length.val != 0) { if (iStream.read(value, 0, length.val) < length.val) { throw new IOException("Error Decoding BerAny"); } codeLength += length.val; } return codeLength; }
public int encode(OutputStream reverseOS, boolean withTag) throws IOException { reverseOS.write(value); int codeLength = value.length; codeLength += BerLength.encodeLength(reverseOS, codeLength); if (withTag) { codeLength += tag.encode(reverseOS); } return codeLength; }
public int decode(InputStream is, BerTag berTag) throws IOException { int codeLength = 0; BerTag passedTag = berTag; if (berTag == null) { berTag = new BerTag(); codeLength += berTag.decode(is); } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { codeLength += BerLength.skip(is); name = new ObjectName(); codeLength += name.decode(is, null); return codeLength; } if (passedTag != null) { return 0; } throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item."); }
public int decode(InputStream is, boolean withTag) throws IOException { int codeLength = 0; if (withTag) { codeLength += tag.decodeAndCheck(is); } BerLength length = new BerLength(); codeLength += length.decode(is); if (length.val != 0) { throw new IOException("Decoded length of BerNull is not correct"); } return codeLength; }
public int encode(OutputStream reverseOS, boolean withTag) throws IOException { int codeLength = BerLength.encodeLength(reverseOS, 0); if (withTag) { codeLength += tag.encode(reverseOS); } return codeLength; }
public int decode(InputStream is, BerTag berTag) throws IOException { int codeLength = 0; BerTag passedTag = berTag; if (berTag == null) { berTag = new BerTag(); codeLength += berTag.decode(is); } if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { codeLength += BerLength.skip(is); name = new ObjectName(); codeLength += name.decode(is, null); return codeLength; } if (passedTag != null) { return 0; } throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item."); }
public int decode(InputStream iStream, boolean explicit) throws IOException { int codeLength = 0; if (explicit) { codeLength += id.decodeAndCheck(iStream); } BerLength length = new BerLength(); codeLength += length.decode(iStream); if (length.val != 0) { throw new IOException("Decoded length of BerNull is not correct"); } return codeLength; }
public int encode(OutputStream reverseOS, boolean withTag) throws IOException { reverseOS.write(value); int codeLength = value.length; codeLength += BerLength.encodeLength(reverseOS, codeLength); if (withTag) { codeLength += tag.encode(reverseOS); } return codeLength; }
public int decode(InputStream is, boolean withTag) throws IOException { int codeLength = 0; if (withTag) { codeLength += tag.decodeAndCheck(is); } BerLength length = new BerLength(); codeLength += length.decode(is); if (length.val != 0) { throw new IOException("Decoded length of BerNull is not correct"); } return codeLength; }
public int encode(OutputStream reverseOS, boolean withTag) throws IOException { int codeLength = BerLength.encodeLength(reverseOS, 0); if (withTag) { codeLength += tag.encode(reverseOS); } return codeLength; }
public int decode(InputStream is, boolean withTag) throws IOException { int codeLength = 0; if (withTag) { codeLength += tag.decodeAndCheck(is); } BerLength length = new BerLength(); codeLength += length.decode(is); if (length.val != 0) { throw new IOException("Decoded length of BerNull is not correct"); } return codeLength; }
public int encode(OutputStream reverseOS, boolean withTag) throws IOException { reverseOS.write(value); int codeLength = value.length; codeLength += BerLength.encodeLength(reverseOS, codeLength); if (withTag) { codeLength += tag.encode(reverseOS); } return codeLength; }
public int decode(InputStream iStream, boolean explicit) throws IOException { int codeLength = 0; if (explicit) { codeLength += id.decodeAndCheck(iStream); } BerLength length = new BerLength(); codeLength += length.decode(iStream); octetString = new byte[length.val]; if (length.val != 0) { if (iStream.read(octetString, 0, length.val) < length.val) { throw new IOException("Error Decoding BerOctetString"); } codeLength += length.val; } return codeLength; }
public int encode(OutputStream reverseOS, boolean withTag) throws IOException { reverseOS.write(value); int codeLength = value.length; codeLength += BerLength.encodeLength(reverseOS, codeLength); if (withTag) { codeLength += tag.encode(reverseOS); } return codeLength; }