summary refs log tree commit diff
path: root/crypto/src/util/io/pem
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-06-29 14:15:10 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-06-29 14:15:10 +0700
commit435210f10fd927653ce8fbc04ec537ae5d8966b6 (patch)
tree27b6ed1c029db271c3429ac57629d7f0156c5fed /crypto/src/util/io/pem
parentRefactoring around Platform (diff)
downloadBouncyCastle.NET-ed25519-435210f10fd927653ce8fbc04ec537ae5d8966b6.tar.xz
Generics migration complete
Diffstat (limited to 'crypto/src/util/io/pem')
-rw-r--r--crypto/src/util/io/pem/PemObject.cs18
-rw-r--r--crypto/src/util/io/pem/PemReader.cs25
-rw-r--r--crypto/src/util/io/pem/PemWriter.cs1
3 files changed, 15 insertions, 29 deletions
diff --git a/crypto/src/util/io/pem/PemObject.cs b/crypto/src/util/io/pem/PemObject.cs
index fce429f39..2a152f81d 100644
--- a/crypto/src/util/io/pem/PemObject.cs
+++ b/crypto/src/util/io/pem/PemObject.cs
@@ -1,26 +1,24 @@
 using System;
-using System.Collections;
-
-using Org.BouncyCastle.Utilities.Collections;
+using System.Collections.Generic;
 
 namespace Org.BouncyCastle.Utilities.IO.Pem
 {
 	public class PemObject
 		: PemObjectGenerator
 	{
-		private string		type;
-		private IList		headers;
-		private byte[]		content;
+		private string type;
+		private IList<PemHeader> headers;
+		private byte[] content;
 
 		public PemObject(string type, byte[] content)
-			: this(type, Platform.CreateArrayList(), content)
+			: this(type, new List<PemHeader>(), content)
 		{
 		}
 
-		public PemObject(string type, IList headers, byte[] content)
+		public PemObject(string type, IList<PemHeader> headers, byte[] content)
 		{
 			this.type = type;
-            this.headers = Platform.CreateArrayList(headers);
+            this.headers = new List<PemHeader>(headers);
 			this.content = content;
 		}
 
@@ -29,7 +27,7 @@ namespace Org.BouncyCastle.Utilities.IO.Pem
 			get { return type; }
 		}
 
-		public IList Headers
+		public IList<PemHeader> Headers
 		{
 			get { return headers; }
 		}
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();
         }
-
-
-
-
 	}
 }
diff --git a/crypto/src/util/io/pem/PemWriter.cs b/crypto/src/util/io/pem/PemWriter.cs
index e85b31543..87968a727 100644
--- a/crypto/src/util/io/pem/PemWriter.cs
+++ b/crypto/src/util/io/pem/PemWriter.cs
@@ -1,5 +1,4 @@
 using System;
-using System.Collections;
 using System.IO;
 
 using Org.BouncyCastle.Utilities.Encoders;