public static int EncodeAsciiString(IBerOutput output, string value) { byte[] bytes = AsciiEncoding.GetBytes(value); output.WriteBytes(bytes); return(bytes.Length); }
internal override sealed void EncodeOverride(IBerOutput output) { if (IsDirty) { Update(); } output.WriteBytes(_encodedFrameHeader); foreach (var node in this) { node.Encode(output); } output.WriteBytes(BerEncoding.IndefiniteLengthTerminator); output.Flush(); }
public static int EncodeUtf8String(IBerOutput output, string value) { byte[] bytes = Encoding.UTF8.GetBytes(value); output.WriteBytes(bytes); return(bytes.Length); }
/// <summary> /// Writes the binary BER representaion of this node to output. /// </summary> /// <param name="output">The output to write to.</param> internal override void EncodeOverride(IBerOutput output) { if (_encoded == null) { Update(); } output.WriteBytes(_encoded); }
static int EncodeObjectSubidentifier(IBerOutput output, int value, List <byte> bytes) { var size = 1; bytes.Clear(); bytes.Add((byte)(value & 0x7F)); while ((value = value >> 7) > 0) { bytes.Add((byte)((value & 0x7F) | 0x80)); size++; } bytes.Reverse(); output.WriteBytes(bytes.ToArray()); return(size); }
/// <summary> /// Writes the binary BER representaion of this node and its children to output. /// </summary> /// <param name="output">The output to write to.</param> internal override void EncodeOverride(IBerOutput output) { if (IsDirty) { Update(); } output.WriteBytes(_encodedHeader); var orderedNodes = OrderChildren(_nodes); foreach (var node in orderedNodes) { node.Encode(output); } if (Parent == null) // root node { output.Flush(); } }
public static int EncodeByteArray(IBerOutput output, byte[] value) { output.WriteBytes(value); return(value.Length); }
static int EncodeObjectSubidentifier(IBerOutput output, int value, List<byte> bytes) { var size = 1; bytes.Clear(); bytes.Add((byte)(value & 0x7F)); while((value = value >> 7) > 0) { bytes.Add((byte)((value & 0x7F) | 0x80)); size++; } bytes.Reverse(); output.WriteBytes(bytes.ToArray()); return size; }
public static int EncodeUtf8String(IBerOutput output, string value) { byte[] bytes = Encoding.UTF8.GetBytes(value); output.WriteBytes(bytes); return bytes.Length; }
public static int EncodeByteArray(IBerOutput output, byte[] value) { output.WriteBytes(value); return value.Length; }
public static int EncodeAsciiString(IBerOutput output, string value) { byte[] bytes = AsciiEncoding.GetBytes(value); output.WriteBytes(bytes); return bytes.Length; }
internal override sealed void EncodeOverride(IBerOutput output) { if(IsDirty) Update(); output.WriteBytes(_encodedFrameHeader); foreach(var node in this) node.Encode(output); output.WriteBytes(BerEncoding.IndefiniteLengthTerminator); output.Flush(); }