Package java.io

Examples of java.io.ObjectInput.readObject()


        byte[] bytes = bos.toByteArray( );

        // Deserialize from a byte array
        ObjectInput in = new ObjectInputStream(
                                                new ByteArrayInputStream( bytes ) );
        conflictResolver = ( ConflictResolver ) in.readObject( );
        in.close( );
    }
}
View Full Code Here


        // Get the bytes of the serialized object
        byte[] bytes = bos.toByteArray( );

        // Deserialize from a byte array
        ObjectInput in = new ObjectInputStream( new ByteArrayInputStream( bytes ) );
        rule = (Rule) in.readObject( );
        in.close( );

        assertEquals( 42,
                      rule.getSalience( ) );
        assertEquals( 22,
View Full Code Here

        // Get the bytes of the serialized object
        byte[] bytes = bos.toByteArray( );

        // Deserialize from a byte array
        ObjectInput in = new ObjectInputStream( new ByteArrayInputStream( bytes ) );
        ruleSet = (RuleSet) in.readObject( );
        in.close( );

        assertLength( 2,
                      ruleSet.getRules( ) );
    }
View Full Code Here

  public static Serializable deserializeFromFile(String filename){
    try{
      InputStream file = new FileInputStream(filename);
        InputStream buffer = new BufferedInputStream(file);
        ObjectInput input = new ObjectInputStream (buffer);
        return (Serializable) input.readObject();
    }catch(Exception ex){
      throw new RuntimeException("Error while deserializing " + MyUtilities.getStackTrace(ex));
    }
  }
 
View Full Code Here

    }

    protected Object serializeIn(final byte[] bytes) throws IOException,
                                                    ClassNotFoundException {
        final ObjectInput in = new ObjectInputStream( new ByteArrayInputStream( bytes ) );
        final Object obj = in.readObject();
        in.close();
        return obj;
    }

    protected byte[] serializeOut(final Object obj) throws IOException {
View Full Code Here

    }

    protected Object serializeIn(final byte[] bytes) throws IOException,
                                                    ClassNotFoundException {
        final ObjectInput in = new ObjectInputStream( new ByteArrayInputStream( bytes ) );
        final Object obj = in.readObject();
        in.close();
        return obj;
    }

    protected byte[] serializeOut(final Object obj) throws IOException {
View Full Code Here

    }

    protected Object serializeIn(final byte[] bytes) throws IOException,
                                                    ClassNotFoundException {
        final ObjectInput in = new ObjectInputStream( new ByteArrayInputStream( bytes ) );
        final Object obj = in.readObject();
        in.close();
        return obj;
    }

    protected byte[] serializeOut(final Object obj) throws IOException {
View Full Code Here

        MinifyProperty minifyProperty = null;
        try {
            InputStream file = new FileInputStream("MinifyProperty.nb");
            InputStream buffer = new BufferedInputStream(file);
            input = new ObjectInputStream(buffer);
            minifyProperty = (MinifyProperty) input.readObject();
        } catch (ClassNotFoundException ex) {
            Exceptions.printStackTrace(ex);
        } catch (IOException ex) {
            minifyProperty = MinifyProperty.getDefaultInstance();
            //Exceptions.printStackTrace(ex);
View Full Code Here

      ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
      ObjectInput oi = marshaller.startObjectInput(in, false);
      try {
         assert oi.readInt() == 1 : "we have 3 different buckets";
         assert oi.readObject().equals(fcs.getLockFromKey("k1") + "");
         assert oi.readInt() > 0; //size on disk
      } finally {
         marshaller.finishObjectInput(oi);
      }
   }
View Full Code Here

                    //Object obj = objStream.readObject();



                    ObjectInput containerInput = new JBossObjectInputStream(bufStream);
                    TestProxy objRead = (TestProxy)containerInput.readObject();
                    int result = objRead.getProxy().doSomething();

                    BufferedOutputStream bufOut = new BufferedOutputStream(socket.getOutputStream());
                    JBossObjectOutputStream objOut = new JBossObjectOutputStream(bufOut);
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.