Package org.jboss.serial.io

Examples of org.jboss.serial.io.JBossObjectInputStreamSharedTree


public class JBossSerializationObjectStreamSource implements ObjectStreamSource
{

   public ObjectInput getObjectInput(InputStream input) throws IOException
   {
      return new JBossObjectInputStreamSharedTree(input);
   }
View Full Code Here


    objOut.writeObject(circular.getReferences());
    objOut.writeObject(circular);
    objOut.reset();
    objOut.writeObject(circular.getReferences());
   
    ObjectInputStream objInput = new JBossObjectInputStreamSharedTree(new ByteArrayInputStream(byteOut.toByteArray()));
   
    Object first = objInput.readObject();
    TestCircularReferences second = (TestCircularReferences)objInput.readObject();
    Object third = objInput.readObject();
    assertSame((Object)second.getReferences(),first);
    assertEquals(circular.getReferences().size(),((Collection)third).size());
    assertNotSame(third,second);
  }
View Full Code Here

          calledResolve=0;
          ClassMetamodelFactory.clear(false);
          for (int i=0;i<20;i++)
          {
              ByteArrayInputStream byteInpt = new ByteArrayInputStream(byteOut.toByteArray());
              JBossObjectInputStream is = new JBossObjectInputStreamSharedTree(byteInpt)
              {
            protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
              calledResolve++;
              return super.resolveClass(desc);
            }
               
              };
            domain2= is.readObject();
          }
          assertTrue("ReadResolve wasn't called for shared tree",calledResolve>0);

          calledResolve=0;
          for (int i=0;i<20;i++)
          {
              ByteArrayInputStream byteInpt = new ByteArrayInputStream(byteOut.toByteArray());
              JBossObjectInputStream is = new JBossObjectInputStreamSharedTree(byteInpt)
              {
            protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
              calledResolve++;
              return super.resolveClass(desc);
            }
               
              };
            domain2= is.readObject();
          }
          assertTrue("ReadResolve wasn't supposed to be called here",calledResolve==0);
   
    }
    catch (Throwable e)
View Full Code Here

TOP

Related Classes of org.jboss.serial.io.JBossObjectInputStreamSharedTree

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.