writeLine() публичный Метод

Write a specific line to the output stream, without its trailing LF. The specified line is copied as-is, with no character encoding translation performed. If the specified line ends with an LF ('\n'), the LF is not copied. It is up to the caller to write the LF, if desired, between output lines.
/// the stream write operation failed. ///
public writeLine ( Stream @out, int i ) : void
@out System.IO.Stream
i int /// Index of the line to extract. Note this is 0-based, so line /// number 1 is actually index 0.
Результат void
Пример #1
0
 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));
 }
Пример #2
0
 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);
     }
 }
Пример #3
0
 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);
     }
 }
Пример #4
0
 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));
 }