繁体   English   中英

附加到 C# 中的 Avro 文件

[英]Appending to an Avro file in C#

我想将 append 数据写入 Avro 文件。 该数据与 Avro 文件的 rest 具有相同的架构。 我看到 Java 的 appendTo 方法似乎可以做到这一点。 我有办法在 C# 中做到这一点吗?

File.AppendText

来自文档的示例:

    string path = @"c:\temp\MyTest.txt";
    // This text is added only once to the file.
    if (!File.Exists(path))
    {
        // Create a file to write to.
        using (StreamWriter sw = File.CreateText(path))
        {
            sw.WriteLine("Hello");
            sw.WriteLine("And");
            sw.WriteLine("Welcome");
        }   
    }

    // This text is always added, making the file longer over time
    // if it is not deleted.
    using (StreamWriter sw = File.AppendText(path))
    {
        sw.WriteLine("This");
        sw.WriteLine("is Extra");
        sw.WriteLine("Text");
    }   

    // Open the file to read from.
    using (StreamReader sr = File.OpenText(path))
    {
        string s = "";
        while ((s = sr.ReadLine()) != null)
        {
            Console.WriteLine(s);
        }
    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM