Package org.jboss.serial.io

Examples of org.jboss.serial.io.JBossObjectInputStream


      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);
         
          BigDecimal result = obj2.getValue().add(obj2.getValue2());
          System.out.println("result = " + result);
View Full Code Here


        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

        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

        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

      
       objOut.writeObject(largeString);
       objOut.close();
      
       ByteArrayInputStream byteInput = new ByteArrayInputStream(byteArray.toByteArray());
       JBossObjectInputStream objInp = new JBossObjectInputStream(byteInput);
      
       String newString = (String)objInp.readObject();
      
       assertEquals(largeString.length(), newString.length());
       assertEquals(largeString,newString);

    }
View Full Code Here

   private static boolean trace = log.isTraceEnabled();

   public ObjectInputStream createInput(InputStream input, ClassLoader loader) throws IOException
   {
      if (trace) { log.trace(this + " creating JBossObjectInputStream"); }
      return new JBossObjectInputStream(input, loader, new StringUtilBuffer(10024, 10024));
   }
View Full Code Here

   private static boolean trace = log.isTraceEnabled();

   public ObjectInputStream createInput(InputStream input, ClassLoader loader) throws IOException
   {
      if (trace) { log.trace(this + " creating JBossObjectInputStream"); }
      return new JBossObjectInputStream(input, loader, new StringUtilBuffer(10024, 10024));
   }
View Full Code Here

   private static boolean trace = log.isTraceEnabled();

   public ObjectInputStream createInput(InputStream input, ClassLoader loader) throws IOException
   {
      if (trace) { log.trace(this + " creating JBossObjectInputStream"); }
      return new JBossObjectInputStream(input, loader, new StringUtilBuffer(10024, 10024));
   }
View Full Code Here

  public String getContentType() {
    return "application/jboss-serialization";
  }

  public Serializable deserialize(Class<? extends Serializable> baseClass, InputStream in) throws IOException {
    ObjectInputStream oo = new JBossObjectInputStream(in);
    try {
      return (Serializable)oo.readObject();
    } catch (ClassNotFoundException e) {// 此异常是运行期不可恢复的错误,不应强制调用者捕获
      throw new IOException("序列化类文件找不到:" + e.getMessage());
    }
  }
View Full Code Here

  //  Convert back to Serializable
  //
    try
    {
      ByteArrayInputStream in = new ByteArrayInputStream(bytes);
      JBossObjectInputStream ois = new JBossObjectInputStream(in);
      return (Serializable) ois.readObject();
    }
    catch (Exception e)
    {
      throw new ConvertorException("Error converting Serializable", e);
    }
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.