From 07063813c1419924e8800e6db61e148d960db938 Mon Sep 17 00:00:00 2001 From: Daniel Walder Date: Sat, 29 Oct 2016 10:37:38 +1000 Subject: [PATCH] Made KaitaiStream.IsEof a property Also minor code cleanup on other properties --- KaitaiStream.cs | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/KaitaiStream.cs b/KaitaiStream.cs index 9d102e2..7ec8bbd 100644 --- a/KaitaiStream.cs +++ b/KaitaiStream.cs @@ -41,11 +41,7 @@ namespace Kaitai /// /// Check if the stream position is at the end of the stream /// - /// True if the pointer is at the end of the stream - public bool IsEof() - { - return BaseStream.Position >= BaseStream.Length; - } + public bool IsEof => BaseStream.Position >= BaseStream.Length; /// /// Seek to a specific position from the beginning of the stream @@ -59,25 +55,12 @@ namespace Kaitai /// /// Get the current position in the stream /// - /// - public long Pos - { - get { - return BaseStream.Position; - } - } + public long Pos => BaseStream.Position; /// /// Get the total length of the stream /// - /// - public long Size - { - get - { - return BaseStream.Length; - } - } + public long Size => BaseStream.Length; #endregion @@ -386,7 +369,7 @@ namespace Kaitai var bytes = new System.Collections.Generic.List(); while (true) { - if (IsEof()) + if (IsEof) { if (eosError) throw new EndOfStreamException($"End of stream reached, but no terminator `{terminator}` found"); break;