namespace UglyToad.Pdf.IO { using System.Collections.Generic; public class ByteArrayInputBytes : IInputBytes { private readonly IReadOnlyList bytes; public ByteArrayInputBytes(IReadOnlyList bytes) { this.bytes = bytes; CurrentOffset = -1; } public int CurrentOffset { get; private set; } public bool MoveNext() { if (CurrentOffset == bytes.Count - 1) { return false; } CurrentOffset++; CurrentByte = bytes[CurrentOffset]; return true; } public byte CurrentByte { get; private set; } public byte? Peek() { if (CurrentOffset == bytes.Count - 1) { return null; } return bytes[CurrentOffset + 1]; } } }