Examples of JBossObjectOutputStream


Examples of org.jboss.serial.io.JBossObjectOutputStream

    }

    public void testClientCall() throws Exception
    {

       ObjectOutput output = new JBossObjectOutputStream(socket.getOutputStream());
       ObjectInput input = new JBossObjectInputStream((socket.getInputStream()));

       TestProxy proxy = TestProxy.createTestInstance();
       output.writeObject(proxy);
       output.flush();

       Integer obj = (Integer)input.readObject();

       System.out.println("response: " + obj);
View Full Code Here

Examples of org.jboss.serial.io.JBossObjectOutputStream

{
    static Random random = new Random();
    private void testObject(Object obj) throws Exception
    {
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        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();
View Full Code Here

Examples of org.jboss.serial.io.JBossObjectOutputStream

            fos = new FileOutputStream(file);
            bufStream = new BufferedOutputStream(fos, 200000);
            if (useJBS)
            {
                oos = new JBossObjectOutputStream(bufStream);
            } else
            {
                oos = new ObjectOutputStream(bufStream);
            }
View Full Code Here

Examples of org.jboss.serial.io.JBossObjectOutputStream

    {
      for (int i=0;i<1000;i++)
      {
      TestWithBigDecimal obj = TestWithBigDecimal.createTestInstance();
          ByteArrayOutputStream byteout = new ByteArrayOutputStream();
          JBossObjectOutputStream out = new JBossObjectOutputStream (byteout);
          out.writeObject(obj);
          out.flush();
          JBossObjectInputStream inp = new JBossObjectInputStream (new ByteArrayInputStream(byteout.toByteArray()));
          TestWithBigDecimal obj2 = (TestWithBigDecimal)inp.readObject();
          assertTrue(obj!=obj2);
          assertEquals(obj,obj2);
         
View Full Code Here

Examples of org.jboss.serial.io.JBossObjectOutputStream

    public void testJBossSerialization() throws Exception
    {
        Object obj = TestParent.createTestInstance();
        ByteArrayOutputStream byteout = new ByteArrayOutputStream();
        JBossObjectOutputStream out = new JBossObjectOutputStream (byteout);
        out.writeObject(obj);
        out.flush();
        JBossObjectInputStream inp = new JBossObjectInputStream (new ByteArrayInputStream(byteout.toByteArray()));
        Object obj2 = inp.readObject();
        assertTrue(obj!=obj2);
        assertEquals(obj,obj2);
    }
View Full Code Here

Examples of org.jboss.serial.io.JBossObjectOutputStream

*/
public class SafeToReuseTestCase extends TestCase {

    public void testReuseOnCloning() throws Exception
    {
        JBossObjectOutputStream out = new JBossObjectOutputStream(null);

        SafeCloningRepository safeToReuse = new SafeCloningRepository(new SafeClone()
        {
            public boolean isSafeToReuse(Object obj) {
                return (obj instanceof ChildObject);
            }
        });

        RootObject first = new RootObject();
        RootObject second = (RootObject)out.smartClone(first,safeToReuse);

        assertTrue(first!=second);
        assertEquals(first,second);
        assertEquals(first.child,second.child);
        assertTrue(first.child==second.child);
View Full Code Here

Examples of org.jboss.serial.io.JBossObjectOutputStream

    public void testJBossSerialization() throws Exception
    {
        Object obj = new TestClassReferenceTest();
        ByteArrayOutputStream byteout = new ByteArrayOutputStream();
        JBossObjectOutputStream out = new JBossObjectOutputStream (byteout);
        out.writeObject(obj);
        out.flush();
        JBossObjectInputStream inp = new JBossObjectInputStream (new ByteArrayInputStream(byteout.toByteArray()));
        Object obj2 = inp.readObject();
        assertTrue(obj!=obj2);
        assertEquals(obj,obj2);
    }
View Full Code Here

Examples of org.jboss.serial.io.JBossObjectOutputStream

        assertEquals(6,proxy.doSomething());


        ByteArrayOutputStream byteout = new ByteArrayOutputStream();
        JBossObjectOutputStream out = new JBossObjectOutputStream (byteout);
        out.writeObject(proxy);
        out.flush();
        JBossObjectInputStream inp = new JBossObjectInputStream (new ByteArrayInputStream(byteout.toByteArray()));
        InterfaceForProxy proxy2 = (InterfaceForProxy)inp.readObject();
        assertEquals(6,proxy2.doSomething());
    }
View Full Code Here

Examples of org.jboss.serial.io.JBossObjectOutputStream

       String largeString = sb.toString();
       assertEquals(stringSize, largeString.length());
      
       ByteArrayOutputStream byteArray = new ByteArrayOutputStream();
       JBossObjectOutputStream objOut = new JBossObjectOutputStream(byteArray);
      
       objOut.writeObject(largeString);
       objOut.close();
      
       ByteArrayInputStream byteInput = new ByteArrayInputStream(byteArray.toByteArray());
       JBossObjectInputStream objInp = new JBossObjectInputStream(byteInput);
      
       String newString = (String)objInp.readObject();
View Full Code Here

Examples of org.jboss.serial.io.JBossObjectOutputStream

   }

   public ObjectOutputStream createOutput(OutputStream output) throws IOException
   {
      if (trace) { log.trace(this + " creating JBossObjectOutputStream"); }
      return new JBossObjectOutputStream(output, new StringUtilBuffer(10024, 10024));
   }
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.