Esempio n. 1
0
        public bool MoveNext()
        {
            if (this.stream.Position == this.stream.Length)
            {
                return(false);
            }

            int objectCount = this.decoder.DecodeInt();
            int blockSize   = this.decoder.DecodeInt();

            this.current = new AvroBufferReaderBlock <T>(this.serializer, this.codec, this.decoder.DecodeFixed(blockSize), objectCount);
            var marker = this.decoder.DecodeFixed(this.header.SyncMarker.Length);

            if (!marker.SequenceEqual(this.header.SyncMarker))
            {
                throw new SerializationException("Synchronization marker defined in the header does not match the read one.");
            }
            return(true);
        }
Esempio n. 2
0
 internal static IEnumerable <string> ToBody(this IAvroReaderBlock <object> x) => x.Objects.Cast <dynamic>()
 .Select(record => Encoding.UTF8.GetString(record.Body)).Cast <string>();