Package com.ngt.jopenmetaverse.shared.structureddata

Examples of com.ngt.jopenmetaverse.shared.structureddata.OSDBinary


  @Test
  public void DeserializeBinary()
  {
    OSD theSD = null;
    OSDArray array = null;
    OSDBinary tempBinary = null;

    String testSD = "<?xml version='1.0' encoding='UTF-8'?> \n" +
        "<llsd> \n" +
        "<array> \n" +
        "<binary encoding='base64'>cmFuZG9t</binary> \n" +
        "<binary>dGhlIHF1aWNrIGJyb3duIGZveA==</binary> \n" +
        "<binary/> \n" +
        "</array> \n" +
        "</llsd>";

    //Deserialize the string
    byte[] bytes = Utils.stringToBytes(testSD);
    theSD =XmlLLSDOSDParser.DeserializeLLSDXml(bytes);

    Assert.assertTrue(theSD instanceof OSDArray);
    array = (OSDArray)theSD;

    Assert.assertEquals(OSDType.Binary, array.get(0).getType());
    tempBinary = (OSDBinary)array.get(0);
    byte[] testData1 = {114, 97, 110, 100, 111, 109};
    TestHelper.TestBinary(tempBinary, testData1);

    Assert.assertEquals(OSDType.Binary, array.get(1).getType());
    tempBinary = (OSDBinary)array.get(1);
    byte[] testData2 = {116, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98,
        114, 111, 119, 110, 32, 102, 111, 120};
    TestHelper.TestBinary(tempBinary, testData2);

    Assert.assertEquals(OSDType.Binary, array.get(1).getType());
    tempBinary = (OSDBinary)array.get(2);
    Assert.assertEquals(0, tempBinary.asBinary().length);
  }
View Full Code Here


  @Test
  public void DeserializeBinary()
  {
    OSD theSD = null;
    OSDArray array = null;
    OSDBinary tempBinary = null;

    String str1 = "This is test String 1";
    byte[] bytes1 = Utils.stringToBytes(str1);
    String str2 = "This is test String 2";
    byte[] bytes2 = Utils.stringToBytes(str2);
View Full Code Here

TOP

Related Classes of com.ngt.jopenmetaverse.shared.structureddata.OSDBinary

Copyright © 2018 www.massapicom. 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.