Package org.jboss.serial.io

Examples of org.jboss.serial.io.JBossObjectOutputStream.writeObject()


 
          ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
          byteOut.reset();
 
          JBossObjectOutputStream out = new JBossObjectOutputStream(byteOut,buffer);
          out.writeObject(myTest);
          out.flush();
 
 
          ByteArrayInputStream byteInput = new ByteArrayInputStream(byteOut.toByteArray());
          JBossObjectInputStream input = new JBossObjectInputStream(byteInput,buffer);
View Full Code Here


    public void testNonSerializableOptionTrue() throws Exception
    {
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        JBossObjectOutputStream out = new JBossObjectOutputStream(byteOut);
        Object obj = NonSerializableTestData.createObj();
        out.writeObject(obj);
        out.flush();

        ByteArrayInputStream byteInput = new ByteArrayInputStream(byteOut.toByteArray());
        JBossObjectInputStream inp = new JBossObjectInputStream(byteInput);
View Full Code Here

        JBossObjectOutputStream out = new JBossObjectOutputStream(byteOut,true);
        Object obj = NonSerializableTestData.createObj();

        try
        {
            out.writeObject(obj);
            fail ("It was supposed to thrown a NonSerialiableException");
        }
        catch (Exception e)
        {
        }
View Full Code Here

    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

        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

       String tmp= System.getProperty("java.io.tmpdir") + "/";

       FileOutputStream fos = new FileOutputStream(tmp + fileName);
       JBossObjectOutputStream oos = new JBossObjectOutputStream(fos);
      
       oos.writeObject(container);
      
       oos.close();
       fos.close();

       // no exception... unit test passes
View Full Code Here

  public void testJBoss() throws Exception
  {
    ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
    JBossObjectOutputStream objOut = new JBossObjectOutputStream(byteOut);
    TestReadResolveNull objNull = TestReadResolveNull.createTestInstance();
    objOut.writeObject(objNull);
    objOut.close();
    ObjectInputStream input = new JBossObjectInputStream(new ByteArrayInputStream(byteOut.toByteArray()));
    Object obj = input.readObject();
    assertNull(obj);
   
View Full Code Here

  public void testJBossOnClassReferences() throws Exception
  {
    ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
    ObjectOutputStream objOut = new JBossObjectOutputStream(byteOut);
    TestReferences obj1 = new TestReferences();
    objOut.writeObject(obj1);
    objOut.close();
    ObjectInputStream input = new JBossObjectInputStream(new ByteArrayInputStream(byteOut.toByteArray()));
    Object obj2 = input.readObject();
   
    System.out.println("obj2=" + obj2);
View Full Code Here

                    int result = objRead.getProxy().doSomething();

                    BufferedOutputStream bufOut = new BufferedOutputStream(socket.getOutputStream());
                    JBossObjectOutputStream objOut = new JBossObjectOutputStream(bufOut);

                     objOut.writeObject(new Integer(result));
                     objOut.flush();


                 }
                 catch(SocketException e)
View Full Code Here

    public static byte[] saveObjectIntoJBoss(Object obj) throws Exception
    {
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        JBossObjectOutputStream objOut = new JBossObjectOutputStream(byteOut);
        objOut.writeObject(obj);;

        return byteOut.toByteArray();
    }

    public static Object readObjectIntoJBoss(byte[] byteArray) throws Exception
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.