Package java.io

Examples of java.io.ObjectInputStream


        throw( new DistributedDatabaseException( "charset error", e ));
      }
    }else{
     
      try{
        ObjectInputStream  iis = new ObjectInputStream( new ByteArrayInputStream( data ));
       
        Object  res = iis.readObject();
       
        if ( target.isInstance( res )){
         
          return( res );
         
View Full Code Here


              0);
          tempV = (Vector) xml.read(sFile);
        }
        else {*/
        InputStream is = new FileInputStream(sFile);
        ObjectInputStream ois = new ObjectInputStream(is);
        tempV = (Vector)ois.readObject();
        ois.close();
        //}
      } catch (Exception ex) {
        System.err.println("[KnowledgeFlow] Problem reading user components.");
        ex.printStackTrace();
        return;
View Full Code Here

  
   public void testSingleMethodCall() throws Exception
   {
      m.objectToObjectStream(command1, stream);
      stream.close();
      ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(byteStream.toByteArray()));
      Object result = m.objectFromObjectStream(in);
      assertEquals(command1.getClass(), result.getClass());
   }
View Full Code Here

   public void testListOfMethodCalls() throws Exception
   {
      m.objectToObjectStream(list, stream);
      stream.close();
      ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(byteStream.toByteArray()));
      Object result = m.objectFromObjectStream(in);
      assertEquals(list.getClass(), result.getClass());
      assertEquals(list.size(), ((List) result).size());
      assert ((List) result).get(0) instanceof PutDataMapCommand;
      assert ((List) result).get(1) instanceof PutDataMapCommand;
View Full Code Here

   public void testMethodCallsInPrepare() throws Exception
   {
      m.objectToObjectStream(prepareComand, stream);
      stream.close();
      ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(byteStream.toByteArray()));
      Object result = m.objectFromObjectStream(in);

      assertEquals(prepareComand.getClass(), result.getClass());
      PrepareCommand prepareCallRes = (PrepareCommand) result;
      List listResult = prepareCallRes.getModifications();
View Full Code Here

      oos.close();
      baos.flush();
      baos.close();
      byte[] bytes = baos.toByteArray();
      int byteL = bytes.length;
      assert i == m.readUnsignedInt(new ObjectInputStream(new ByteArrayInputStream(bytes)));
      return byteL;
   }
View Full Code Here

      oos.close();
      baos.flush();
      baos.close();
      byte[] bytes = baos.toByteArray();
      int byteL = bytes.length;
      assert i == m.readUnsignedLong(new ObjectInputStream(new ByteArrayInputStream(bytes)));
      return byteL;
   }
View Full Code Here

      byte[] s = {1, 2, 3, 4};
      m.objectToObjectStream(s, out);
      out.close();

      ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
      ObjectInputStream ois = new ObjectInputStream(bin);

      Object o = m.objectFromObjectStream(ois);

      ois.close();

      assert o instanceof byte[];
      byte[] oS = (byte[]) o;
      assert oS.length == 4;
      assert oS[0] == 1;
View Full Code Here

      Byte[] s = new Byte[]{1, 2, 3, 4};
      m.objectToObjectStream(s, out);
      out.close();

      ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
      ObjectInputStream ois = new ObjectInputStream(bin);

      Object o = m.objectFromObjectStream(ois);

      ois.close();

      assert o instanceof Byte[];
      Byte[] oS = (Byte[]) o;
      assert oS.length == 4;
      assert oS[0] == 1;
View Full Code Here

      Object[] s = {"Hello", Fqn.fromString("/a"), 1, null};
      m.objectToObjectStream(s, out);
      out.close();

      ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
      ObjectInputStream ois = new ObjectInputStream(bin);

      Object o = m.objectFromObjectStream(ois);

      ois.close();

      assert o instanceof Object[];
      Object[] oS = (Object[]) o;
      assert oS.length == 4;
      assert oS[0].equals("Hello");
View Full Code Here

TOP

Related Classes of java.io.ObjectInputStream

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.