N
/// <summary> /// Writes enum to the output stream /// </summary> /// <param name="obj"> Enum to write</param> /// <param name="abstractHessianOutput">Instance of the hessian output</param> public override void WriteObject(object obj, AbstractHessianOutput abstractHessianOutput) { // immer den Referenzzähler hochzählen! // (manche enums mit nullable funktionieren nicht) object unrefobj = new object(); if (abstractHessianOutput.AddRef(unrefobj)) { return; } if (obj == null) { abstractHessianOutput.WriteNull(); } else { Type enumType = obj.GetType(); string name = //Enum.GetName(enumType, obj); ((Enum)obj).ToString(); // das geht auch mit .NET Mobile abstractHessianOutput.WriteMapBegin(enumType.FullName); abstractHessianOutput.WriteObject("name"); abstractHessianOutput.WriteObject(name); abstractHessianOutput.WriteMapEnd(); } }
/// <summary> /// Writes Instance of the DateTime class /// </summary> /// <param name="objDate">Instance of the DateTime class</param> /// <param name="abstractHessianOutput">HessianOutput - Stream</param> public override void WriteObject(Object objDate, AbstractHessianOutput abstractHessianOutput) { if (objDate == null) abstractHessianOutput.WriteNull(); else { abstractHessianOutput.WriteUTCDate(MakeJavaDate((DateTime)objDate)); } }
/// <summary> /// Writes Instance of the DateTime class /// </summary> /// <param name="objDate">Instance of the DateTime class</param> /// <param name="abstractHessianOutput">HessianOutput - Stream</param> public override void WriteObject(Object objDate, AbstractHessianOutput abstractHessianOutput) { if (objDate == null) { abstractHessianOutput.WriteNull(); } else { abstractHessianOutput.WriteUTCDate(MakeJavaDate((DateTime)objDate)); } }
/// <summary> /// Writes Instance of the DateTime class /// </summary> /// <param name="objDate">Instance of the DateTime class</param> /// <param name="abstractHessianOutput">HessianOutput - Stream</param> public override void WriteObject(Object objDate, AbstractHessianOutput abstractHessianOutput) { if (objDate == null) abstractHessianOutput.WriteNull(); else { /*Type type = objDate.GetType(); abstractHessianOutput.WriteMapBegin(type.FullName); abstractHessianOutput.WriteString("value"); abstractHessianOutput.WriteUTCDate(((((DateTime) objDate).Ticks - ticksDifference) / ticksDivider) - (long) TimeZone.CurrentTimeZone.GetUtcOffset(((DateTime) objDate)).TotalMilliseconds); abstractHessianOutput.WriteMapEnd(); */ abstractHessianOutput.WriteUTCDate(MakeJavaDate((DateTime)objDate)); //abstractHessianOutput.WriteUTCDate(((DateTime)objDate).ToFileTimeUtc()); } }
/// <summary> /// Serialization of stream valued objects /// </summary> /// <param name="obj">Object to serialize</param> /// <param name="abstractHessianOutput">HessianOutput - Instance</param> public override void WriteObject(object obj, AbstractHessianOutput abstractHessianOutput) { Stream inStream = (Stream) obj; if (inStream == null) abstractHessianOutput.WriteNull(); else { byte[] buf = new byte[1024]; int len; while ((len = inStream.Read(buf, 0, buf.Length)) > 0) { abstractHessianOutput.WriteByteBufferPart(buf, 0, len); } abstractHessianOutput.WriteByteBufferEnd(buf, 0, 0); } }
/// <summary> /// Serialization of stream valued objects /// </summary> /// <param name="obj">Object to serialize</param> /// <param name="abstractHessianOutput">HessianOutput - Instance</param> public override void WriteObject(object obj, AbstractHessianOutput abstractHessianOutput) { Stream inStream = (Stream)obj; if (inStream == null) { abstractHessianOutput.WriteNull(); } else { byte[] buf = new byte[1024]; int len; while ((len = inStream.Read(buf, 0, buf.Length)) > 0) { abstractHessianOutput.WriteByteBufferPart(buf, 0, len); } abstractHessianOutput.WriteByteBufferEnd(buf, 0, 0); } }
/// <summary> /// Writes enum to the output stream /// </summary> /// <param name="obj"> Enum to write</param> /// <param name="abstractHessianOutput">Instance of the hessian output</param> public override void WriteObject(object obj, AbstractHessianOutput abstractHessianOutput) { // immer den Referenzzähler hochzählen! // (manche enums mit nullable funktionieren nicht) object unrefobj = new object(); if (abstractHessianOutput.AddRef(unrefobj)) return; if (obj == null) { abstractHessianOutput.WriteNull(); } else { Type enumType = obj.GetType(); string name = //Enum.GetName(enumType, obj); ((Enum)obj).ToString(); // das geht auch mit .NET Mobile abstractHessianOutput.WriteMapBegin(enumType.FullName); abstractHessianOutput.WriteObject("name"); abstractHessianOutput.WriteObject(name); abstractHessianOutput.WriteMapEnd(); } }