public writeLine ( |
||
@out | ||
i | int | /// Index of the line to extract. Note this is 0-based, so line /// number 1 is actually index 0. |
Результат | void |
public void testWriteLine1() { var a = new RawText(Constants.encodeASCII("foo-a\nfoo-b\n")); var o = new MemoryStream(); a.writeLine(o, 0); byte[] r = o.ToArray(); Assert.AreEqual("foo-a", RawParseUtils.decode(r)); }
private static void WriteLine(Stream @out, char prefix, RawText text, int cur) { @out.WriteByte(Convert.ToByte(prefix)); text.writeLine(@out, cur); @out.WriteByte(Convert.ToByte('\n')); if (cur + 1 == text.size() && text.isMissingNewlineAtEnd()) { @out.Write(NoNewLine, 0, NoNewLine.Length); } }
private static void WriteLine(Stream @out, char prefix, RawText text, int cur) { @out.WriteByte(Convert.ToByte(prefix)); text.writeLine(@out, cur); @out.WriteByte(Convert.ToByte('\n')); if (cur + 1 == text.size() && text.isMissingNewlineAtEnd()) { @out.Write(NoNewLine, 0, NoNewLine.Length); } }
public void testWriteLine3() { var a = new RawText(Constants.encodeASCII("a\n\nb\n")); var o = new MemoryStream(); a.writeLine(o, 1); byte[] r = o.ToArray(); Assert.AreEqual(string.Empty, RawParseUtils.decode(r)); }