Package org.jboss.serial.io

Examples of org.jboss.serial.io.JBossObjectInputStream


      testClass=null;
      childObject = null;
      forceOutOfMemoryError();
      forceGC();
     
      JBossObjectInputStream objInput = new JBossObjectInputStream(new ByteArrayInputStream(byteOut.toByteArray()),loader2);
      Object newObject = objInput.readObject();
    }
    testClass=null;
    loader1=null;
    forceOutOfMemoryError();
    forceGC();
View Full Code Here


                output.writeObject(dataObject);
                output.flush();
                buffOut.flush();

                ByteArrayInputStream inptByte = new ByteArrayInputStream(outByte.toByteArray());
                ObjectInputStream input = new JBossObjectInputStream(inptByte);
                Object obj=null;
                try
                {
                  obj = input.readObject();
                }
                catch (Throwable e)
                {
                  e.printStackTrace();
                  if (retry)
View Full Code Here

      objOut.writeObject(rootObject);
      objOut.flush();

      forceCrossedClassLoaderRelease();
     
      JBossObjectInputStream objInput = new JBossObjectInputStream(new ByteArrayInputStream(byteOut.toByteArray()),loader);
      Object newObject = objInput.readObject();
    }
    testClass=null;
    loader=null;
    forceOutOfMemoryError();
    forceGC();
View Full Code Here

      JBossObjectOutputStream objOut = new JBossObjectOutputStream(byteOut);
     
      objOut.writeObject(rootObject);
      objOut.flush();
     
      JBossObjectInputStream objInput = new JBossObjectInputStream(new ByteArrayInputStream(byteOut.toByteArray()),loader);
      Object newObject = objInput.readObject();
    }
    testClass=null;
    loader=null;
    forceOutOfMemoryError();
    forceGC();
View Full Code Here

            out.writeObject(myTest);
            out.flush();


            ByteArrayInputStream byteInput = new ByteArrayInputStream(byteOut.toByteArray());
            JBossObjectInputStream input = new JBossObjectInputStream(byteInput,buffer);

            Object value = input.readObject();

            assertTrue(value!=myTest);
            assertTrue(value.getClass()==myTest.getClass());
            if (!(myTest instanceof String[]))assertTrue(value.equals(myTest));
        }
View Full Code Here

            out.writeObjectUsingDataContainer(myTest);
            out.flush();


            ByteArrayInputStream byteInput = new ByteArrayInputStream(byteOut.toByteArray());
            JBossObjectInputStream input = new JBossObjectInputStream(byteInput,buffer);

            Object value = input.readObjectUsingDataContainer();

            assertTrue(value!=myTest);
            assertTrue(value.getClass()==myTest.getClass());
            if (!(myTest instanceof String[]))assertTrue(value.equals(myTest));
        }
View Full Code Here

      byteArray = byteOut.toByteArray();

      ByteArrayInputStream byteInput = new ByteArrayInputStream(byteArray);

      JBossObjectInputStream input = new JBossObjectInputStream(
          byteInput, buffer);

      Object value = input.readObject();

      assertNotSame(myTest, value);
      assertSame(myTest.getClass(), value.getClass());
      assertEquals(myTest, value);
    }
View Full Code Here

          calledResolve=0;
          Object domain2 = null;
          for (int i=0;i<20;i++)
          {
              ByteArrayInputStream byteInpt = new ByteArrayInputStream(byteOut.toByteArray());
              JBossObjectInputStream is = new JBossObjectInputStream(byteInpt)
              {
            protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
              try
              {
                calledResolve++;
                return super.resolveClass(desc);
              }
              catch (Throwable e)
              {
                e.printStackTrace(System.out);
                return null;
              }
            }
               
              };
            domain2= is.readObject();
          }
          assertNotSame(domain,domain2);
          if (domain instanceof String[])
          {
            assertTrue(Arrays.equals((String[])domain, (String[])domain2));
          }
          else
          {
            assertEquals(domain,domain2);
          }
          assertTrue("ReadResolve wasn't called",calledResolve>0);

          if (domain instanceof TestNonSerializableSDF )
          {
            assertTrue("ReadResolve was called too often",calledResolve<20);
          }
          else
          {
            assertTrue("ReadResolve was called too often",calledResolve<10);
           
          }
 
          calledResolve=0;
          for (int i=0;i<20;i++)
          {
              ClassMetamodelFactory.clear(false);
              ByteArrayInputStream byteInpt = new ByteArrayInputStream(byteOut.toByteArray());
              JBossObjectInputStream is = new JBossObjectInputStream(byteInpt)
              {
            protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
              calledResolve++;
              return super.resolveClass(desc);
            }
               
              };
            domain2= is.readObject();
          }
          assertTrue("ReadResolve wasn't called as often as it should be",calledResolve>10);
 
          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

        JBossObjectOutputStream objout = new JBossObjectOutputStream(byteOut);
        LocalMarshalledValue tstValue = new LocalMarshalledValue(obj);
        objout.writeObject(tstValue);
        objout.flush();

        JBossObjectInputStream objinput = new JBossObjectInputStream(new ByteArrayInputStream(byteOut.toByteArray()));
        LocalMarshalledValue localValue = (LocalMarshalledValue)objinput.readObject();

        Object value = localValue.get();
        System.out.println(value);

        assertEquals(obj,value);
View Full Code Here

      ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
      JBossObjectOutputStream objOut = new JBossObjectOutputStream(byteOut);
      objOut.writeObject(proxyPoint);
     
      ByteArrayInputStream byteInp = new ByteArrayInputStream(byteOut.toByteArray());
      JBossObjectInputStream objInput = new JBossObjectInputStream(byteInp);
      DataPoint proxyPoint2 = (DataPoint)objInput.readObject();
     
      try
      {
        proxyPoint2.exception();
        fail("An exception should be generated");
View Full Code Here

TOP

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

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.