Inheritance: System.Text.Encoding
コード例 #1
0
			public ForwardingEncoder (Encoding enc)
			{
				var fallback = enc.EncoderFallback;

				if (fallback != null)
					Fallback = fallback;

				encoding = enc;
			}
コード例 #2
0
		// Convert between two encodings.
		public static byte[] Convert (Encoding srcEncoding, Encoding dstEncoding, byte[] bytes)
		{
			if (srcEncoding == null)
				throw new ArgumentNullException ("srcEncoding");

			if (dstEncoding == null)
				throw new ArgumentNullException ("dstEncoding");

			if (bytes == null)
				throw new ArgumentNullException ("bytes");

			return dstEncoding.GetBytes (srcEncoding.GetChars (bytes, 0, bytes.Length));
		}
コード例 #3
-1
		public static byte[] Convert (Encoding srcEncoding, Encoding dstEncoding, byte[] bytes, int index, int count)
		{
			if (srcEncoding == null)
				throw new ArgumentNullException ("srcEncoding");

			if (dstEncoding == null)
				throw new ArgumentNullException ("dstEncoding");

			if (bytes == null)
				throw new ArgumentNullException ("bytes");

			if (index < 0 || index > bytes.Length)
				throw new ArgumentOutOfRangeException ("index");

			if (count < 0 || (bytes.Length - index) < count)
				throw new ArgumentOutOfRangeException ("count");

			return dstEncoding.GetBytes (srcEncoding.GetChars (bytes, index, count));
		}