Package java.io

Examples of java.io.ObjectOutputStream$Caches


  public SerializationTest(String name) {
    super(name);
  }

  protected void setUp() throws Exception {
    oos = new ObjectOutputStream(baos);
    super.setUp();
  }
View Full Code Here


    responseHandler.waitTillDone(5000);
    responseHandler = new BlockingTaskOperationResponseHandler();
    ContentData contentData = null;
    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) {
        e.printStackTrace();
View Full Code Here

        final MasterReport report = ReportGenerator.getInstance().parseReport(url);
        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);
          fail();
View Full Code Here

  private static void testSerialization (Object in)
          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 file the file to write out to
   * @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();
  }
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();
  }
View Full Code Here

  /* (non-Javadoc)
   * @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

  @Override
  public Object javaToSqlArg(FieldType fieldType, Object obj) throws SQLException {
    try {
      ByteArrayOutputStream outStream = new ByteArrayOutputStream();
      ObjectOutputStream objOutStream = new ObjectOutputStream(outStream);
      objOutStream.writeObject(obj);
      return outStream.toByteArray();
    } catch (Exception e) {
      throw SqlExceptionUtil.create("Could not write serialized object to byte array: " + obj, e);
    }
  }
View Full Code Here

TOP

Related Classes of java.io.ObjectOutputStream$Caches

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.