diff options
author | Jiyoung Yun <jy910.yun@samsung.com> | 2017-06-13 18:47:36 +0900 |
---|---|---|
committer | Jiyoung Yun <jy910.yun@samsung.com> | 2017-06-13 18:47:36 +0900 |
commit | 61d6a817e39d3bae0f47dbc09838d51db22a5d30 (patch) | |
tree | cb37caa1784bc738b976273335d6ed04a7cc80b0 /src/mscorlib/shared/System/Text/UTF8Encoding.cs | |
parent | 5b975f8233e8c8d17b215372f89ca713b45d6a0b (diff) | |
download | coreclr-61d6a817e39d3bae0f47dbc09838d51db22a5d30.tar.gz coreclr-61d6a817e39d3bae0f47dbc09838d51db22a5d30.tar.bz2 coreclr-61d6a817e39d3bae0f47dbc09838d51db22a5d30.zip |
Imported Upstream version 2.0.0.11992upstream/2.0.0.11992
Diffstat (limited to 'src/mscorlib/shared/System/Text/UTF8Encoding.cs')
-rw-r--r-- | src/mscorlib/shared/System/Text/UTF8Encoding.cs | 79 |
1 files changed, 4 insertions, 75 deletions
diff --git a/src/mscorlib/shared/System/Text/UTF8Encoding.cs b/src/mscorlib/shared/System/Text/UTF8Encoding.cs index 5cfa89018a..ee5c92c3a8 100644 --- a/src/mscorlib/shared/System/Text/UTF8Encoding.cs +++ b/src/mscorlib/shared/System/Text/UTF8Encoding.cs @@ -34,7 +34,6 @@ namespace System.Text // used mostly to distinguish UTF-8 text from other encodings, and doesn't // switch the byte orderings. - [Serializable] public class UTF8Encoding : Encoding { /* @@ -53,7 +52,6 @@ namespace System.Text private const int UTF8_CODEPAGE = 65001; // Allow for devirtualization (see https://github.com/dotnet/coreclr/pull/9230) - [Serializable] internal sealed class UTF8EncodingSealed : UTF8Encoding { public UTF8EncodingSealed(bool encoderShouldEmitUTF8Identifier) : base(encoderShouldEmitUTF8Identifier) { } @@ -2521,7 +2519,6 @@ namespace System.Text UTF8_CODEPAGE + (_emitUTF8Identifier ? 1 : 0); } - [Serializable] private sealed class UTF8Encoder : EncoderNLS, ISerializable { // We must save a high surrogate value until the next call, looking @@ -2533,46 +2530,10 @@ namespace System.Text // base calls reset } - // Constructor called by serialization, have to handle deserializing from Everett - internal UTF8Encoder(SerializationInfo info, StreamingContext context) - { - // Any info? - if (info == null) throw new ArgumentNullException(nameof(info)); - Contract.EndContractBlock(); - - // Get common info - this.m_encoding = (Encoding)info.GetValue("encoding", typeof(Encoding)); - - // SurrogateChar happens to mean the same thing - this.surrogateChar = (int)info.GetValue("surrogateChar", typeof(int)); - - try - { - this.m_fallback = (EncoderFallback)info.GetValue("m_fallback", typeof(EncoderFallback)); - } - catch (SerializationException) - { - this.m_fallback = null; - } - } - - // ISerializable implementation, get data for this object + // ISerializable implementation void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { - // Any info? - if (info == null) throw new ArgumentNullException(nameof(info)); - Contract.EndContractBlock(); - - // Save Whidbey data - // Just need Everett maxCharSize (BaseCodePageEncoding) or m_maxByteSize (MLangBaseCodePageEncoding) - info.AddValue("encoding", this.m_encoding); - info.AddValue("surrogateChar", this.surrogateChar); - - info.AddValue("m_fallback", this.m_fallback); - - // Extra stuff for Everett that Whidbey doesn't use - info.AddValue("storedSurrogate", this.surrogateChar > 0 ? true : false); - info.AddValue("mustFlush", false); // Everett doesn't actually use this either, but it accidently serialized it! + throw new PlatformNotSupportedException(); } public override void Reset() @@ -2593,7 +2554,6 @@ namespace System.Text } } - [Serializable] private sealed class UTF8Decoder : DecoderNLS, ISerializable { // We'll need to remember the previous information. See the comments around definition @@ -2608,44 +2568,13 @@ namespace System.Text // Constructor called by serialization, have to handle deserializing from Everett internal UTF8Decoder(SerializationInfo info, StreamingContext context) { - // Any info? - if (info == null) throw new ArgumentNullException(nameof(info)); - Contract.EndContractBlock(); - - // Get common info - this.m_encoding = (Encoding)info.GetValue("encoding", typeof(Encoding)); - - try - { - // Get whidbey version of bits - this.bits = (int)info.GetValue("wbits", typeof(int)); - this.m_fallback = (DecoderFallback)info.GetValue("m_fallback", typeof(DecoderFallback)); - } - catch (SerializationException) - { - // Everett calls bits bits instead of wbits, so this is Everett - this.bits = 0; - this.m_fallback = null; - } + throw new PlatformNotSupportedException(); } // ISerializable implementation, get data for this object void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { - // Any info? - if (info == null) throw new ArgumentNullException(nameof(info)); - Contract.EndContractBlock(); - - // Save new Whidbey data - info.AddValue("encoding", this.m_encoding); - info.AddValue("wbits", this.bits); // Special whidbey bits name - info.AddValue("m_fallback", this.m_fallback); - - // Everett has extra stuff, we set it all to 0 in case this deserializes in Everett - info.AddValue("bits", (int)0); - info.AddValue("trailCount", (int)0); - info.AddValue("isSurrogate", false); - info.AddValue("byteSequence", (int)0); + throw new PlatformNotSupportedException(); } public override void Reset() |