writeLine() public method

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.
return void
コード例 #1
0
ファイル: RawTextTest.cs プロジェクト: dev218/GitSharp
 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
ファイル: DiffFormatter.cs プロジェクト: kkl713/GitSharp
 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
ファイル: DiffFormatter.cs プロジェクト: jagregory/GitSharp
 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
ファイル: RawTextTest.cs プロジェクト: dev218/GitSharp
 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));
 }