mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-03-10 00:23:29 +08:00
move code into correct directory structure
This commit is contained in:
41
src/UglyToad.Pdf/IO/ByteArrayInputBytes.cs
Normal file
41
src/UglyToad.Pdf/IO/ByteArrayInputBytes.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
namespace UglyToad.Pdf.IO
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class ByteArrayInputBytes : IInputBytes
|
||||
{
|
||||
private readonly IReadOnlyList<byte> bytes;
|
||||
|
||||
public ByteArrayInputBytes(IReadOnlyList<byte> 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];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user