Package org.jboss.serial.io

Examples of org.jboss.serial.io.JBossObjectInputStream.readObject()


  }

  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


  //
    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

      {
         FileInputStream fis = FISAction.open(file);
         ObjectInputStream in = new JBossObjectInputStream(fis);
         try
         {
            return (T) in.readObject();
         }
         finally
         {
            in.close();
            DeleteFileAction.delete(file);
View Full Code Here

      SerializableWrapper wrapper = (SerializableWrapper)target;
      byte[] payload = wrapper.getPayload();
      ByteArrayInputStream bais = new ByteArrayInputStream(payload);
      ObjectInputStream ois = new ObjectInputStream(bais);
      JBossObjectInputStream jbis = new JBossObjectInputStream(ois);
      Object result = jbis.readObject();
      return result;
     
   }
   public void serialize(final Object[] targets) throws Exception
   {
View Full Code Here

      {
         FileInputStream fis = FISAction.open(file);
         ObjectInputStream in = new JBossObjectInputStream(fis);
         try
         {
            return (T) in.readObject();
         }
         finally
         {
            in.close();
            DeleteFileAction.delete(file);
View Full Code Here

      {
         FileInputStream fis = FISAction.open(file);
         ObjectInputStream in = new JBossObjectInputStream(fis);
         try
         {
            return (T) in.readObject();
         }
         finally
         {
            in.close();
            DeleteFileAction.delete(file);
View Full Code Here

       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

            System.out.println(myTest.getClass().getName() +" produced " + byteArray.length + " on JBossSerialization");
            ByteArrayInputStream byteInput = new ByteArrayInputStream(byteArray);

            JBossObjectInputStream input = new JBossObjectInputStream(byteInput,buffer);

            Object value = input.readObject();

            assertNotSame(myTest,value);
            if (!(myTest instanceof String) && !(myTest instanceof String[]))
            {
              assertSame(myTest.getClass(),value.getClass());
View Full Code Here

        objout.flush();

        SizeBenchmarkTestCase.saveFileNoCheck("/tmp/check.bin",byteout.toByteArray());
       
        JBossObjectInputStream objectInput = new JBossObjectInputStream(new ByteArrayInputStream(byteout.toByteArray()));
        BaseClass baseNew = (BaseClass)objectInput.readObject();
        assertEquals(4,baseNew.doSomething(5));
  }

  public void testSimpleAOPSerializationOnClass() throws Exception
  {
View Full Code Here

        objout.flush();

        SizeBenchmarkTestCase.saveFileNoCheck("/tmp/check.bin",byteout.toByteArray());
       
        JBossObjectInputStream objectInput = new JBossObjectInputStream(new ByteArrayInputStream(byteout.toByteArray()));
        Class baseNew = (Class)objectInput.readObject();
        assertEquals(proxy.getClass(),baseNew);
        //assertEquals(4,baseNew.doSomething(5));
  }

  public void testSimpleAOPSerializationCollection() 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.