Package com.ngt.jopenmetaverse.shared.structureddata

Examples of com.ngt.jopenmetaverse.shared.structureddata.OSD.asDate()


      Calendar cal = Calendar.getInstance();
      cal.setTimeZone(TimeZone.getTimeZone("UTC"));
      cal.set(2008, 0, 1, 20, 10, 31);
        cal.set(Calendar.MILLISECOND, 0);
        Date dt = cal.getTime();
        Date dateLocal = llsdDateTime.asDate();
       
//        double t = 9717.36597327148;       
//      //System.out.print("\t" + Utils.bytesToHexString(bytes, "consumed bytes\t"));
//        System.out.print(Utils.bytesToHexString(Utils.doubleToBytes(t), "Double Bytes Big Endian"));
//        System.out.print(Utils.bytesToHexString(Utils.doubleToBytesLit(t), "Double Bytes Lit Endian"));
View Full Code Here


        Date dtOne = cal.getTime();
        OSD llsdDateOne = OSD.FromDate(dtOne);
        byte[] binaryDateOneSerialized = BinaryLLSDOSDParser.SerializeLLSDBinary(llsdDateOne);
        OSD llsdDateOneDS = BinaryLLSDOSDParser.DeserializeLLSDBinary(binaryDateOneSerialized);
        Assert.assertEquals(OSDType.Date, llsdDateOneDS.getType());
        Assert.assertEquals(dtOne, llsdDateOneDS.asDate());

      cal.set(2010, 11, 11, 10, 8, 20);
        Date dtTwo = cal.getTime();
        OSD llsdDateTwo = OSD.FromDate(dtTwo);
        byte[] binaryDateTwoSerialized = BinaryLLSDOSDParser.SerializeLLSDBinary(llsdDateTwo);
View Full Code Here

        Date dtTwo = cal.getTime();
        OSD llsdDateTwo = OSD.FromDate(dtTwo);
        byte[] binaryDateTwoSerialized = BinaryLLSDOSDParser.SerializeLLSDBinary(llsdDateTwo);
        OSD llsdDateTwoDS = BinaryLLSDOSDParser.DeserializeLLSDBinary(binaryDateTwoSerialized);
        Assert.assertEquals(OSDType.Date, llsdDateOneDS.getType());
        Assert.assertEquals(dtTwo, llsdDateTwoDS.asDate());
    }

    // Data for empty array { }
    private static byte[] binaryEmptyArrayValue = { 0x5b, 0x0, 0x0, 0x0, 0x0, 0x5d };
    // Encoding header + num of elements + tail
View Full Code Here

            cal.setTimeZone(TimeZone.getTimeZone("UTC"));
              cal.set(Calendar.MILLISECOND, 0);
             
              cal.set(2007, 11, 31, 20, 49, 10);
              Date dt = cal.getTime();
              Date dtDS = llsdOne.asDate();
              Assert.assertEquals(dt, dtDS);
          }

          @Test
          public void SerializeDate() throws IOException, OSDException
View Full Code Here

              Date dtOne = cal.getTime();
              OSD llsdOne = OSD.FromDate(dtOne);
              String sDtOne = NotationalLLSDOSDParser.SerializeLLSDNotation(llsdOne);
              OSD llsdOneDS = NotationalLLSDOSDParser.DeserializeLLSDNotation(sDtOne);
              Assert.assertEquals(OSDType.Date, llsdOneDS.getType());
              Date dtOneDS = llsdOneDS.asDate();
              Assert.assertEquals(dtOne, dtOneDS);

              cal.set(2010, 9, 11, 23, 00, 10);
              cal.set(Calendar.MILLISECOND, 100);
              Date dtTwo = cal.getTime();
View Full Code Here

             
              OSD llsdTwo = OSD.FromDate(dtTwo);
              String sDtTwo = NotationalLLSDOSDParser.SerializeLLSDNotation(llsdTwo);
              OSD llsdTwoDS = NotationalLLSDOSDParser.DeserializeLLSDNotation(sDtTwo);
              Assert.assertEquals(OSDType.Date, llsdTwoDS.getType());
              Date dtTwoDS = llsdTwoDS.asDate();
//              System.out.println(dtTwo.getTime() + " : " + dtTwoDS.getTime());
              Assert.assertEquals(dtTwo, dtTwoDS);

              // check if a *local* time can be serialized and deserialized
              cal.set(2009, 12, 30, 8, 25, 10);
View Full Code Here

              Date dtThree = cal.getTime();
              OSD llsdDateThree = OSD.FromDate(dtThree);
              String sDateThreeSerialized = NotationalLLSDOSDParser.SerializeLLSDNotation(llsdDateThree);
              OSD llsdDateThreeDS = NotationalLLSDOSDParser.DeserializeLLSDNotation(sDateThreeSerialized);
              Assert.assertEquals(OSDType.Date, llsdDateThreeDS.getType());
              Assert.assertEquals(dtThree, llsdDateThreeDS.asDate());
          }

          @Test
          public void SerializeBinary() throws OSDException, IOException
          {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.