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 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 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 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 encode(BerByteArrayOutputStream berOStream, boolean explicit) throws IOException { int codeLength = BerLength.encodeLength(berOStream, 0); if (explicit) { codeLength += id.encode(berOStream); } 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 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 encode(OutputStream reverseOS, boolean withTag) throws IOException { int codeLength = BerLength.encodeLength(reverseOS, 0); if (withTag) { codeLength += tag.encode(reverseOS); } 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 encode(OutputStream reverseOS, boolean withTag) throws IOException { int codeLength = BerLength.encodeLength(reverseOS, 0); if (withTag) { codeLength += tag.encode(reverseOS); } 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 encode(BerByteArrayOutputStream berOStream, boolean explicit) throws IOException { berOStream.write(octetString); int codeLength = octetString.length; codeLength += BerLength.encodeLength(berOStream, codeLength); if (explicit) { codeLength += id.encode(berOStream); } return codeLength; }
public int encode(BerByteArrayOutputStream berOStream, boolean explicit) throws IOException { berOStream.write(octetString); int codeLength = octetString.length; codeLength += BerLength.encodeLength(berOStream, codeLength); if (explicit) { codeLength += id.encode(berOStream); } return codeLength; }
public int encode(OutputStream reverseOS, boolean withTag) throws IOException { if (code != null) { for (int i = code.length - 1; i >= 0; i--) { reverseOS.write(code[i]); } if (withTag) { return tag.encode(reverseOS) + code.length; } return code.length; } int codeLength = encodeValue(reverseOS); codeLength += BerLength.encodeLength(reverseOS, codeLength); if (withTag) { codeLength += tag.encode(reverseOS); } return codeLength; }
public int encode(OutputStream reverseOS, boolean withTag) throws IOException { if (code != null) { for (int i = code.length - 1; i >= 0; i--) { reverseOS.write(code[i]); } if (withTag) { return tag.encode(reverseOS) + code.length; } return code.length; } int codeLength = encodeValue(reverseOS); codeLength += BerLength.encodeLength(reverseOS, codeLength); if (withTag) { codeLength += tag.encode(reverseOS); } return codeLength; }
@Override public int encode(OutputStream os, boolean withTag) throws IOException { int codeLength = super.encode(os, false); if (withTag) { codeLength += BerLength.encodeLength(os, codeLength); codeLength += identifier.encode(os); } return codeLength; }
public int encode(OutputStream reverseOS, boolean withTag) throws IOException { if (code != null) { for (int i = code.length - 1; i >= 0; i--) { reverseOS.write(code[i]); } if (withTag) { return tag.encode(reverseOS) + code.length; } return code.length; } int codeLength = 0; codeLength += BerLength.encodeLength(reverseOS, codeLength); if (withTag) { codeLength += tag.encode(reverseOS); } return codeLength; }
public int encode(OutputStream reverseOS, boolean withTag) throws IOException { int codeLength; codeLength = super.encode(reverseOS); codeLength += BerLength.encodeLength(reverseOS, codeLength); if (withTag) { codeLength += tag.encode(reverseOS); } return codeLength; }
@Test public void encodeLength2() throws IOException { ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(50); int codedLength = BerLength.encodeLength(os, 128); Assert.assertEquals(2, codedLength); byte[] expectedBytes = new byte[] { (byte) 0x81, (byte) 128 }; Assert.assertArrayEquals(expectedBytes, os.getArray()); }
@Test public void encodeLength() throws IOException { ReverseByteArrayOutputStream os = new ReverseByteArrayOutputStream(50); int codedLength = BerLength.encodeLength(os, 128); Assert.assertEquals(2, codedLength); byte[] expectedBytes = new byte[] { (byte) 0x81, (byte) 128 }; Assert.assertArrayEquals(expectedBytes, os.getArray()); }