本文整理汇总了C#中CompactBinaryReader.ReadInt32方法的典型用法代码示例。如果您正苦于以下问题:C# CompactBinaryReader.ReadInt32方法的具体用法?C# CompactBinaryReader.ReadInt32怎么用?C# CompactBinaryReader.ReadInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CompactBinaryReader
的用法示例。
在下文中一共展示了CompactBinaryReader.ReadInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadDirect
public override object ReadDirect(CompactBinaryReader reader, object graph)
{
Int32[] array = (Int32[])graph;
for (int i = 0; i < array.Length; i++)
array[i] = reader.ReadInt32();
return array;
}
示例2: SkipDirect
public override void SkipDirect(CompactBinaryReader reader, object graph)
{
int length = reader.ReadInt32();
IList list = (IList)graph;
for (int i = 0; i < length; i++)
reader.SkipObject();
}
示例3: ReadDirect
public override object ReadDirect(CompactBinaryReader reader, object graph)
{
int length = reader.ReadInt32();
IList list = (IList)graph;
for (int i = 0; i < length; i++)
list.Add(reader.ReadObject());
return list;
}
示例4: Read
public override object Read(CompactBinaryReader reader)
{
int length = reader.ReadInt32();
byte[] stream = new byte[length];
stream = reader.ReadBytes(length);
return UTF8Encoding.UTF8.GetString(stream);
//return reader.ReadString();
}
示例5: Instantiate
public override object Instantiate(CompactBinaryReader reader)
{
int length = reader.ReadInt32();
string typeName = reader.ReadString();
Type t = Type.GetType(typeName);
object graph = Array.CreateInstance(t, length);
return graph;
}
示例6: SkipDirect
public override void SkipDirect(CompactBinaryReader reader, object graph)
{
int length = reader.ReadInt32();
IDictionary dict = (IDictionary)graph;
for (int i = 0; i < length; i++)
{
reader.SkipObject();
reader.SkipObject();
}
}
示例7: Skip
public override void Skip(CompactBinaryReader reader)
{
int cookie = reader.ReadInt32();
object custom = reader.Context.GetObject(cookie);
if (custom == null)
{
custom = SessionStateItemCollection.Deserialize(reader.BaseReader);
reader.Context.RememberObject(custom,false);
}
}
示例8: Read
public override sealed object Read(CompactBinaryReader reader)
{
int cookie = reader.ReadInt32();
object graph = reader.Context.GetObject(cookie);
if (graph == null)
{
bool bKnown = false;
graph = Instantiate(reader);
if (graph != null)
{
reader.Context.RememberObject(graph,false);
bKnown = true;
}
if (VersionCompatible)
{
long startPosition = 0;
int dataLength = 0;
long endPosition = 0;
startPosition = reader.BaseReader.BaseStream.Position;
dataLength = reader.ReadInt32();
graph = ReadDirect(reader, graph);
if (dataLength != -1 && (endPosition - startPosition) < dataLength)
{
endPosition = reader.BaseReader.BaseStream.Position;
reader.SkipBytes((int)(dataLength - (endPosition - startPosition)));
}
}
else
{
graph = ReadDirect(reader, graph);
}
if (!bKnown)
{
reader.Context.RememberObject(graph,false);
}
}
return graph;
}
示例9: Read
/// <summary>
/// Uses a <see cref="BinaryFormatter"/> to read an object of
/// type <see cref="ActualType"/> from the underlying stream.
/// </summary>
/// <param name="reader">stream reader</param>
/// <returns>object read from the stream reader</returns>
public override object Read(CompactBinaryReader reader)
{
int cookie = reader.ReadInt32();
object custom = reader.Context.GetObject(cookie);
if (custom == null)
{
custom = HttpStaticObjectsCollection.Deserialize(reader.BaseReader);
reader.Context.RememberObject(custom,false);
}
return custom;
}
开发者ID:javithalion,项目名称:NCache,代码行数:17,代码来源:SessionStateStaticObjectCollectionSerializationSurrogate.cs
示例10: Skip
public override void Skip(CompactBinaryReader reader)
{
int cookie = reader.ReadInt32();
object custom = reader.Context.GetObject(cookie);
if (custom == null)
{
BinaryFormatter formatter = new BinaryFormatter();
custom = formatter.Deserialize(reader.BaseReader.BaseStream);
reader.Context.RememberObject(custom,false);
}
}
示例11: ReadDirect
public override object ReadDirect(CompactBinaryReader reader, object graph)
{
int length = reader.ReadInt32();
IDictionary dict = (IDictionary)graph;
for (int i = 0; i < length; i++)
{
object key = reader.ReadObject();
object value = reader.ReadObject();
dict.Add(key, value);
}
return dict;
}
示例12: Read
/// <summary>
/// Uses a <see cref="BinaryFormatter"/> to read an object of
/// type <see cref="ActualType"/> from the underlying stream.
/// </summary>
/// <param name="reader">stream reader</param>
/// <returns>object read from the stream reader</returns>
public override object Read(CompactBinaryReader reader)
{
int cookie = reader.ReadInt32();
object custom = reader.Context.GetObject(cookie);
if (custom == null)
{
//using new instance of binary fomatter instead of static which may cause exception when shared by multiple threads.
BinaryFormatter formatter = new BinaryFormatter();
custom = formatter.Deserialize(reader.BaseReader.BaseStream);
reader.Context.RememberObject(custom, false);
}
return custom;
}
示例13: SkipDirect
public override void SkipDirect(CompactBinaryReader reader, object graph)
{
String[] array = (String[])graph;
for (int i = 0; i < array.Length; i++)
{
int length = reader.ReadInt16();
if (length == 0)
{
array[i] = null;
continue;
}
length = reader.ReadInt32();
reader.ReadBytes(length);
}
}
示例14: Instantiate
public override object Instantiate(CompactBinaryReader reader)
{
int argumentsCount = reader.ReadInt32();
Type[] arguments = new Type[argumentsCount];
for (int i = 0; i < argumentsCount; i++)
{
string typeName = reader.ReadString();
arguments[i] = Type.GetType(typeName);
}
object graph = SurrogateHelper.CreateGenericType("System.Collections.Generic.List", arguments);
return graph;
}
示例15: ReadDirect
public override object ReadDirect(CompactBinaryReader reader, object graph)
{
String[] array = (String[])graph;
for (int i = 0; i < array.Length; i++)
{
if (reader.ReadInt16() == 0)
continue;
int length = reader.ReadInt32();
byte[] stream = new byte[length];
stream = reader.ReadBytes(length);
array[i] = UTF8Encoding.UTF8.GetString(stream);
}
return array;
}