Package com.ngt.jopenmetaverse.shared.structureddata

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


//          data.getMap(data);
         
          if ((osd = map.get("login")) !=null)
          {
            boolean loginSuccess = osd.asBoolean();
            boolean redirect = (osd.asString().equals("indeterminate"));

            if (redirect)
            {
              // Login redirected
View Full Code Here


                   ((char)character != mapEndNotationMarker))
             {
                 OSD osdKey = DeserializeLLSDNotationElement(reader);
                 if (osdKey.getType() != OSDType.String)
                     throw new OSDException("Notation LLSD parsing: Invalid key in map");
                 String key = osdKey.asString();

                 character = ReadAndSkipWhitespace(reader);
                 if ((char)character != keyNotationDelimiter)
                     throw new OSDException("Notation LLSD parsing: Unexpected end of stream in map.");
                 if ((char)character != keyNotationDelimiter)
View Full Code Here

  public static String ParseString(String key, OSDMap reply)
  {
    OSD osd;
    if (((osd = reply.get(key)) != null))
      return osd.asString();
    else
      return "";
  }

  public static String ParseString(String key, Map reply)
View Full Code Here

      {
        return ((OSDArray)osd).asVector3();
      }
      else if (osd.getType().equals(OSDType.String))
      {
        OSDArray array = (OSDArray)NotationalLLSDOSDParser.DeserializeLLSDNotation(osd.asString());
        return array.asVector3();
      }
    }

    return Vector3.Zero;
View Full Code Here

    @Test
    public void DeserializeUUID() throws IOException, OSDException
    {
        OSD llsdAUUID = BinaryLLSDOSDParser.DeserializeLLSDBinary(binaryAUUID);
        Assert.assertEquals(OSDType.UUID, llsdAUUID.getType());
        Assert.assertEquals("97f4aeca-88a1-42a1-b385-b97b18abb255", llsdAUUID.asString());

        OSD llsdZeroUUID = BinaryLLSDOSDParser.DeserializeLLSDBinary(binaryZeroUUID);
        Assert.assertEquals(OSDType.UUID, llsdZeroUUID.getType());
        Assert.assertEquals("00000000-0000-0000-0000-000000000000", llsdZeroUUID.asString());
View Full Code Here

        Assert.assertEquals(OSDType.UUID, llsdAUUID.getType());
        Assert.assertEquals("97f4aeca-88a1-42a1-b385-b97b18abb255", llsdAUUID.asString());

        OSD llsdZeroUUID = BinaryLLSDOSDParser.DeserializeLLSDBinary(binaryZeroUUID);
        Assert.assertEquals(OSDType.UUID, llsdZeroUUID.getType());
        Assert.assertEquals("00000000-0000-0000-0000-000000000000", llsdZeroUUID.asString());

    }

    @Test
    public void SerializeUUID() throws Exception
View Full Code Here

    public void DeserializeString() throws IOException, OSDException
    {
        OSD llsdEmptyString = BinaryLLSDOSDParser.DeserializeLLSDBinary(binaryEmptyString);
        Assert.assertEquals(OSDType.String, llsdEmptyString.getType());
        String contentEmptyString = "";
        Assert.assertEquals(contentEmptyString, llsdEmptyString.asString());

        OSD llsdLongString = BinaryLLSDOSDParser.DeserializeLLSDBinary(binaryLongString);
        Assert.assertEquals(OSDType.String, llsdLongString.getType());
        String contentLongString = "abcdefghijklmnopqrstuvwxyz01234567890";
        Assert.assertEquals(contentLongString, llsdLongString.asString());
View Full Code Here

        Assert.assertEquals(contentEmptyString, llsdEmptyString.asString());

        OSD llsdLongString = BinaryLLSDOSDParser.DeserializeLLSDBinary(binaryLongString);
        Assert.assertEquals(OSDType.String, llsdLongString.getType());
        String contentLongString = "abcdefghijklmnopqrstuvwxyz01234567890";
        Assert.assertEquals(contentLongString, llsdLongString.asString());
    }

    @Test
    public void SerializeString() throws Exception
    {
View Full Code Here

//        System.out.println("Node Value:" + contentAString);
        OSD llsdAString = OSD.FromString(contentAString);
        byte[] binaryAString = BinaryLLSDOSDParser.SerializeLLSDBinary(llsdAString);
        OSD llsdAStringDS = BinaryLLSDOSDParser.DeserializeLLSDBinary(binaryAString);
        Assert.assertEquals(OSDType.String, llsdAStringDS.getType());
        Assert.assertEquals(contentAString, llsdAStringDS.asString());

        // we also test for a 4byte character.
        String xml = "<x>&#x10137;</x>";
        byte[] bytesTwo = xml.getBytes(Charset.forName("UTF8"));
        DocumentBuilderFactory dbf2 = DocumentBuilderFactory.newInstance();
View Full Code Here

        OSD llsdStringOne = OSD.FromString(contentAString2);
        byte[] binaryAStringOneSerialized = BinaryLLSDOSDParser.SerializeLLSDBinary(llsdStringOne);
        OSD llsdStringOneDS = BinaryLLSDOSDParser.DeserializeLLSDBinary(binaryAStringOneSerialized);
        Assert.assertEquals(OSDType.String, llsdStringOneDS.getType());
        Assert.assertEquals(contentAString2, llsdStringOneDS.asString());

    }

    // Be careful. The current and above mentioned reference implementation has a bug that
    // doesnt allow proper binary Uri encoding.
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.