/// <summary>
/// Reads an arbitrary object from the input stream.
/// </summary>
/// <returns>Read object</returns>
/// <exception cref="CHessianException"/>
public override object ReadObject()
{
int intTag = Read();
switch (intTag)
{
case PROT_NULL:
return(null);
case PROT_BOOLEAN_TRUE:
return(true);
case PROT_BOOLEAN_FALSE:
return(false);
case PROT_INTEGER_TYPE:
return(ParseInt());
case PROT_LONG_TYPE:
return(ParseLong());
case PROT_DOUBLE_TYPE:
return(ParseDouble());
case PROT_STRING_INITIAL:
case PROT_STRING_FINAL:
{
m_blnIsLastChunk = intTag == PROT_STRING_FINAL;
m_intChunkLength = (Read() << 8) + Read();
return(LoadString());
}
case PROT_MAP_TYPE:
{
String strType = ReadType();
return(m_serializerFactory.ReadMap(this, strType));
}
case PROT_DATE_TYPE:
{
/*
* Eine Windows-Dateizeit ist ein 64-Bit-Wert, der die Anzahl
* von 100-Nanosekunden-Intervallen darstellt, die seit 1. Januar 1601,
* 00:00 u. Z. koordinierter Weltzeit (Coordinated Universal Time, UTC)
* verstrichen sind. */
long javaTime = ParseLong();
return(CDateDeserializer.MakeCSharpDate(javaTime));
}
case PROT_REF_TYPE:
{
int intRefNumber = ParseInt();
return(m_arrRefs[intRefNumber]);
}
case 'r':
{
throw new CHessianException("remote type is not implemented");
}
#if !COMPACT_FRAMEWORK
case PROT_XML_INITIAL:
case PROT_XML_FINAL:
{
m_blnIsLastChunk = intTag == PROT_XML_FINAL;
m_intChunkLength = (Read() << 8) + Read();
return(parseXML());
}
#endif
case PROT_BINARY_START:
case PROT_BINARY_END:
{
m_blnIsLastChunk = intTag == PROT_BINARY_END;
m_intChunkLength = (Read() << 8) + Read();
int intData;
MemoryStream memoryStream = new MemoryStream();
while ((intData = ParseByte()) >= 0)
{
memoryStream.WriteByte((byte)intData);
}
return(memoryStream.ToArray());
}
case PROT_LIST_TYPE:
{
string strType = this.ReadType();
int intLength = this.ReadLength();
return(m_serializerFactory.ReadList(this, intLength, strType));
}
default:
throw new CHessianException("unknown code:" + (char)intTag);
}
}