Examples of ObjectInputStream


Examples of java.io.ObjectInputStream

            run()
          {
                while ( true ){
                 
                  Socket socket      = null;
                  ObjectInputStream  ois  = null;
                 
                  try{
                    socket = server_socket.accept();
                   
                    String address = socket.getInetAddress().getHostAddress();
                   
                    if ( !( address.equals("localhost") || address.equals("127.0.0.1"))){
                     
                      socket.close();
                     
                      continue;
                    }
                   
                    ois = new ObjectInputStream( socket.getInputStream());
                   
                    ois.readInt()// version
                   
                    String  header = (String)ois.readObject();
                   
                    if ( !header.equals( getHeader())){
                     
                      log.messageLogged(
                          LoggerChannel.LT_ERROR,
                          "SingleInstanceHandler: invalid header - " + header );
                     
                      continue;
                    }

                    String[]  args = (String[])ois.readObject();
                   
                    handler.processArguments( args );
                   
                  }catch( Throwable e ){
                   
                    log.messageLogged( "SingleInstanceHandler: receive error", e );

                  }finally{
                   
                    if ( ois != null ){
                      try{
                        ois.close();
                       
                      }catch( Throwable e ){
                      }
                    }
                   
View Full Code Here

Examples of java.io.ObjectInputStream

        beans        = (Vector) v.get(XMLBeans.INDEX_BEANINSTANCES);
        connections  = (Vector) v.get(XMLBeans.INDEX_BEANCONNECTIONS);
        //connections  = new Vector();
      } /* binary */ else {
        InputStream is = new FileInputStream(oFile);
        ObjectInputStream ois = new ObjectInputStream(is);
        beans = (Vector) ois.readObject();
        connections = (Vector) ois.readObject();
        ois.close();
      }               

      integrateFlow(beans, connections, true, false);
      setEnvironment();
      if (newTab) {
View Full Code Here

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

Examples of java.io.ObjectInputStream

              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

Examples of java.io.ObjectInputStream

  
   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

Examples of java.io.ObjectInputStream

   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

Examples of java.io.ObjectInputStream

   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

Examples of java.io.ObjectInputStream

      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

Examples of java.io.ObjectInputStream

      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

Examples of java.io.ObjectInputStream

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