Deveel.Data.Serialization.BinarySerializer.ReadValue C# (CSharp) Method

ReadValue() private static method

private static ReadValue ( BinaryReader reader, Encoding encoding ) : object
reader BinaryReader
encoding Encoding
return object
		private static object ReadValue(BinaryReader reader, Encoding encoding) {
			var typeCode = reader.ReadByte();
			var nullCheck = reader.ReadBoolean();

			if (nullCheck)
				return null;

			if (typeCode == BooleanType)
				return reader.ReadBoolean();
			if (typeCode == ByteType)
				return reader.ReadByte();
			if (typeCode == Int16Type)
				return reader.ReadInt16();
			if (typeCode == Int32Type)
				return reader.ReadInt32();
			if (typeCode == Int64Type)
				return reader.ReadInt64();
			if (typeCode == SingleType)
				return reader.ReadSingle();
			if (typeCode == DoubleType)
				return reader.ReadDouble();
			if (typeCode == StringType)
				return reader.ReadString();
			if (typeCode == ObjectType)
				return ReadObject(reader, encoding);
			if (typeCode == ArrayType)
				return ReadArray(reader, encoding);

			throw new NotSupportedException("Invalid type code in serialization graph");
		}