Example #1
0
 /// <summary>Read a single byte from the stream.</summary>
 /// <exception cref="System.IO.IOException"/>
 public override int Read()
 {
     if (pos < buffer.Length)
     {
         return(buffer[pos++]);
     }
     if (!fileReader.HasNext())
     {
         return(-1);
     }
     writer.Write(fileReader.Next(), encoder);
     encoder.Flush();
     if (!fileReader.HasNext())
     {
         // Write a new line after the last Avro record.
         output.Write(Runtime.GetBytesForString(Runtime.GetProperty("line.separator"
                                                                    ), Charsets.Utf8));
         output.Flush();
     }
     pos    = 0;
     buffer = output.ToByteArray();
     output.Reset();
     return(Read());
 }