diff options
Diffstat (limited to 'crypto/src/util/io/pem/PemReader.cs')
-rw-r--r-- | crypto/src/util/io/pem/PemReader.cs | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/crypto/src/util/io/pem/PemReader.cs b/crypto/src/util/io/pem/PemReader.cs index a32ca8181..cd19e95b8 100644 --- a/crypto/src/util/io/pem/PemReader.cs +++ b/crypto/src/util/io/pem/PemReader.cs @@ -1,8 +1,7 @@ using System; -using System.Collections; +using System.Collections.Generic; using System.IO; - using Org.BouncyCastle.Utilities.Encoders; namespace Org.BouncyCastle.Utilities.IO.Pem @@ -13,11 +12,9 @@ namespace Org.BouncyCastle.Utilities.IO.Pem private readonly TextReader reader; private readonly MemoryStream buffer; private readonly StreamWriter textBuffer; - private readonly IList pushback = Platform.CreateArrayList(); + private readonly List<int> pushback = new List<int>(); int c = 0; - - public PemReader(TextReader reader) { if (reader == null) @@ -47,7 +44,7 @@ namespace Org.BouncyCastle.Utilities.IO.Pem // Look for BEGIN // - for (; ; ) + for (;;) { // Seek a leading dash, ignore anything up to that point. @@ -107,7 +104,7 @@ namespace Org.BouncyCastle.Utilities.IO.Pem // Look for a colon for up to 64 characters, as an indication there might be a header. // - IList headers = Platform.CreateArrayList(); + var headers = new List<PemHeader>(); while (seekColon(64)) { @@ -227,7 +224,7 @@ namespace Org.BouncyCastle.Utilities.IO.Pem { c = 0; bool colonFound = false; - IList read = Platform.CreateArrayList(); + var read = new List<int>(); for (; upTo>=0 && c >=0; upTo--) { @@ -308,7 +305,6 @@ namespace Org.BouncyCastle.Utilities.IO.Pem return true; } - /// <summary> /// Consume until dash. @@ -338,8 +334,6 @@ namespace Org.BouncyCastle.Utilities.IO.Pem return c > -1; } - - private void PushBack(int value) { if (pushback.Count == 0) @@ -351,21 +345,16 @@ namespace Org.BouncyCastle.Utilities.IO.Pem } } - private int Read() { - if (pushback.Count>0) + if (pushback.Count > 0) { - int i = (int)pushback[0]; + int i = pushback[0]; pushback.RemoveAt(0); return i; } return reader.Read(); } - - - - } } |