private static ByteArrayBuffer Encode(Encoding charset, string @string) { ByteBuffer encoded = charset.Encode(CharBuffer.Wrap(@string)); ByteArrayBuffer bab = new ByteArrayBuffer(encoded.Remaining()); bab.Append(((byte[])encoded.Array()), encoded.Position(), encoded.Remaining()); return bab; }
/// <exception cref="System.IO.IOException"></exception> private static void WriteBytes(ByteArrayBuffer b, OutputStream @out) { @out.Write(b.Buffer(), 0, b.Length()); }