Package java.io

Examples of java.io.ObjectOutputStream.writeObject()


      for (Enumeration e = agents.elements(); e.hasMoreElements();) {
        Agent agent = (Agent) e.nextElement();
        // Don't put the agent factory
        if (! (agent instanceof AgentFactory)) {
          oos.writeObject(agent.getId());
          oos.writeObject(agent);
          if (agent instanceof BagSerializer) {
            ((BagSerializer) agent).writeBag(oos);
          }
        }
      }
View Full Code Here


          Message msg = (Message) qinFromExt.elementAt(i);
          logmon.log(BasicLevel.DEBUG,
                     AgentServer.getName() + " getState() -> " + msg);
        }
      }
      oos.writeObject(qinFromExt);
      reply.messages = baos.toByteArray();
    } finally {
      try {
        oos.close();
      } catch (Exception exc) {}
View Full Code Here

    if (data != null) {
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      ObjectOutputStream out;
      try {
        out = new ObjectOutputStream(bos);
        out.writeObject(data);
        out.close();
        contentData = new ContentData();
        contentData.setContent(bos.toByteArray());
        contentData.setAccessType(AccessType.Inline);
      } catch (IOException e) {
View Full Code Here

        assertNotNull(report);
        report.clone();

        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.
View Full Code Here

        final ByteArrayOutputStream bo = new ByteArrayOutputStream();
        try
        {
          final ObjectOutputStream oout = new ObjectOutputStream(bo);
          oout.writeObject(report);
          oout.close();
        }
        catch (Exception e)
        {
          logger.debug("Failed to write " + handler.getDemoName(), e);
View Full Code Here

          throws IOException, ClassNotFoundException
  {
    final ByteArrayOutputStream bo = new ByteArrayOutputStream();

    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

   * @param filesLastModified the hashmap containing files names and lastModified times
   * @throws Exception if it fails to write file
   */
  protected void writeCacheFile(File file, HashMap<String, Long> filesLastModified) throws Exception {
    ObjectOutputStream dos = new ObjectOutputStream(new FileOutputStream(file));
    dos.writeObject(filesLastModified);
    dos.close();
  }

  /**
   * Edits the ClassPath at runtime to include the jars
View Full Code Here

  private byte[] constructArgs(HttpMethod method, Object args)
      throws IOException {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream obj_out = new ObjectOutputStream(bos);
    obj_out.writeObject(args);
    byte[] output = bos.toByteArray();
    return output;
  }
}
View Full Code Here

    else for( int i = 0; i < size; i++ ) bitsForWords += documentsOutputBitStream.writeDelta( termsFrequencyKeeper.encode( fieldContent.getInt( i ) ) );
  }

  public void nonTextField( Object o ) throws IOException {
    final ObjectOutputStream oos = new ObjectOutputStream( nonTextZipDataOutputStream );
    oos.writeObject( o );
    oos.flush();
  }

  public static int writeSelfDelimitedUtf8String( final OutputBitStream obs, final CharSequence s ) throws IOException {
    final int len = s.length();
View Full Code Here

   * @see org.jrest4guice.ResponseWriter#writeResult(javax.servlet.http.HttpServletResponse, java.lang.Object, java.lang.String)
   */
  public void writeResult(Method method,ByteArrayOutputStream out, Object result,String charset ,Map options) throws Need2RedirectException {
    try {
      ObjectOutputStream obj_out = new ObjectOutputStream(out);
      obj_out.writeObject(result);
      obj_out.flush();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
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.