hessiancsharp.io.CDateDeserializer.MakeCSharpDate C# (CSharp) Method

MakeCSharpDate() public static method

Makes a C# DateTime object from a Java ticks value from java.util.Date.getTime().
public static MakeCSharpDate ( long javaDate ) : System.DateTime
javaDate long
return System.DateTime
        public static DateTime MakeCSharpDate(long javaDate)
        {
            return JavaUtcConverter.ConvertJavaUtcTicksToLocalDateTime(javaDate);
        }

Usage Example

示例#1
0
        /// <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);
            }
        }
All Usage Examples Of hessiancsharp.io.CDateDeserializer::MakeCSharpDate