Package java.io

Examples of java.io.ObjectInputStream


        m.writeExternal(msg_out);
        msg_out.flush();
        msg_out.close();
        byte[] data=msg_data.toByteArray();
        ByteArrayInputStream msg_in_data=new ByteArrayInputStream(data);
        ObjectInputStream msg_in=new ObjectInputStream(msg_in_data);
        MethodCall m2=new MethodCall();
        m2.readExternal(msg_in);
        System.out.println(m2.getName());
        System.out.println(m2.getArgs().length);
    }
View Full Code Here


    oos.close();
  }

  public void verify() throws IOException, ClassNotFoundException {
    ByteArrayInputStream bis = new ByteArrayInputStream(baos.toByteArray());
    ois = new ObjectInputStream(bis);

    Log resuscitatedLog = (Log) ois.readObject();
    // tests that the "private transient Logger logger" field is non-null
    resuscitatedLog.debug("");
    resuscitatedLog.isDebugEnabled();
View Full Code Here

            remoteIs = _proxy.asyncFetch(_fetchSize);
        } catch (RemoteException e) {
            throw new XQRemoteException(e);
        }
        final FastBufferedInputStream bufferedIs = new FastBufferedInputStream(remoteIs);
        final ObjectInputStream ois;
        try {
            ois = new ObjectInputStream(bufferedIs);
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
        int count = 0;
        try {
            while(true) {
                boolean hasmore = ois.readBoolean();
                if(!hasmore) {
                    break;
                }
                ++count;
                Object ro = ois.readObject();
                Item fetched = (Item) ro;
                _fetchedQueue.offer(fetched);
                if(count == _fetchSize) {
                    break;
                }
View Full Code Here

        int fetched = fetchInternal(is);
        return fetched;
    }

    private int fetchInternal(InputStream is) {
        final ObjectInputStream ois;
        final int fetchedLength;
        try {
            ois = new ObjectInputStream(is);
            fetchedLength = ois.readInt();
        } catch (IOException ioe) {
            throw new XQRTException("failed to deserialize the fetched items", ioe);
        }
        try {
            for(int i = 0; i < fetchedLength; i++) {
                Object ro = ois.readObject();
                Item fetched = (Item) ro;
                _fetchedQueue.offer(fetched);
            }
        } catch (IOException ioe) {
            throw new XQRTException("failed to deserialize the fetched items", ioe);
View Full Code Here

* The main entry point for a worker process. Reads a serialized Callable from stdin, and executes it.
*/
public class GradleWorkerMain {
    public void run() throws Exception {
        // Read the main action from stdin and execute it
        ObjectInputStream instr = new ObjectInputStream(System.in);
        Callable<?> main = (Callable<?>) instr.readObject();
        main.call();
    }
View Full Code Here

        final ByteArrayOutputStream bo = new ByteArrayOutputStream();
        final ObjectOutputStream out = new ObjectOutputStream(bo);
        out.writeObject(report);

        final ObjectInputStream oin = new ObjectInputStream
          (new ByteArrayInputStream(bo.toByteArray()));
        final MasterReport e2 = (MasterReport) oin.readObject();
        assertNotNull(e2); // cannot assert equals, as this is not implemented.

      }
      catch (Exception e)
      {
View Full Code Here

        }

        try
        {
          final ByteArrayInputStream bin = new ByteArrayInputStream(bo.toByteArray());
          final ObjectInputStream oin = new ObjectInputStream(bin);
          final MasterReport report2 = (MasterReport) oin.readObject();
          report2.setDataFactory(model);

          assertTrue(FunctionalityTestLib.execGraphics2D(report2));
        }
        catch (Exception e)
View Full Code Here

    final ObjectOutputStream oout = new ObjectOutputStream(bo);
    oout.writeObject(in);
    oout.close();
    final ByteArrayInputStream bin = new ByteArrayInputStream(bo.toByteArray());
    final ObjectInputStream oin = new ObjectInputStream(bin);
    final Object o = oin.readObject();

  }
View Full Code Here

   * @return the hashmap containing the files names and lastModified times
   * @throws Exception if it fails to read hashmap
   */
  @SuppressWarnings("unchecked")
  protected HashMap<String, Long> readCacheFile(File file) throws Exception {
    ObjectInputStream dis = new ObjectInputStream(new FileInputStream(file));
    HashMap<String, Long> hashMap = (HashMap<String, Long>)dis.readObject();
    dis.close();
    return hashMap;
  }
View Full Code Here

      if (statusCode != HttpStatus.SC_OK) {
        log.error("调用Http方法出错: " + method.getStatusLine());
      }
      try {
        ObjectInputStream obj_in = new ObjectInputStream(method
            .getResponseBodyAsStream());
        responseBody = obj_in.readObject();
      } catch (Exception e) {
        responseBody = method.getResponseBodyAsString();
      }

      if (responseBody instanceof Exception) {
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.