Package java.io

Examples of java.io.ObjectOutputStream


   }

   private int getAndTestSize(CacheMarshaller200 m, long i) throws IOException
   {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
      m.writeUnsignedLong(oos, i);
      oos.flush();
      oos.close();
      baos.flush();
      baos.close();
      byte[] bytes = baos.toByteArray();
      int byteL = bytes.length;
      assert i == m.readUnsignedLong(new ObjectInputStream(new ByteArrayInputStream(bytes)));
View Full Code Here


{
   public void testArrayTypes() throws Exception
   {
      Marshaller m = new CacheMarshaller300();
      ByteArrayOutputStream bout = new ByteArrayOutputStream();
      ObjectOutputStream out = new ObjectOutputStream(bout);
      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);
View Full Code Here

   public void testBoxedArrayTypes() throws Exception
   {
      Marshaller m = new CacheMarshaller300();
      ByteArrayOutputStream bout = new ByteArrayOutputStream();
      ObjectOutputStream out = new ObjectOutputStream(bout);
      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);
View Full Code Here

   public void testMixedArrayTypes() throws Exception
   {
      Marshaller m = new CacheMarshaller300();
      ByteArrayOutputStream bout = new ByteArrayOutputStream();
      ObjectOutputStream out = new ObjectOutputStream(bout);
      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);
View Full Code Here

      final InvocationContextContainer icc = getInvocationContextContainer();
      final OwnableReentrantLock lock = new OwnableReentrantLock(icc);
      lock.lock();
      assert lock.isLocked();
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
      oos.writeObject(lock);
      oos.close();
      baos.close();
      ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
      OwnableReentrantLock l2 = (OwnableReentrantLock) ois.readObject();

      assert !l2.isLocked();
View Full Code Here

   }

   private <T> T serializeAndDeserialize(T object) throws Exception
   {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
      oos.writeObject(object);
      oos.close();
      baos.close();

      ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
      Object retval = ois.readObject();
      ois.close();
View Full Code Here

    if (object == null) {
      body = null;
    } else {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
      oos.writeObject(object);
      oos.flush();
      body = baos.toByteArray();
      oos.close();
      baos.close();
    }
  }
View Full Code Here

      while (e.hasMoreElements()) {
        String aname = (String) e.nextElement();
        Object so = get(aname);
        if (so instanceof Serializable) {
          os.reset();
          ObjectOutputStream oos = new ObjectOutputStream(os);
          try {
            oos.writeObject(so);
            w.write(aname);
            w.write(":");
            w.write(Utils.base64Encode(os.toByteArray()));
            w.write("\r\n");
          } catch (IOException ioe) {
View Full Code Here

    String alertAppletRequest = request.getParameter("alertapplet");
   
    try
    {
      Vector alertsList = this.getAlertList(individualID, dataSource);
      ObjectOutputStream outputToApplet = new ObjectOutputStream(response.getOutputStream());
      outputToApplet.writeObject(alertsList);
      outputToApplet.flush();
      outputToApplet.close();
    }catch(Exception e){
      logger.error("[AlertServlet] Exception thrown in service(): ", e);
    }
   
    if (alertAppletRequest.equals("dismissalert"))
View Full Code Here

    ContentData content = null;
    Object contentObject = workItem.getParameter("Content");
    if (contentObject != null) {
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      ObjectOutputStream out;
      try {
        out = new ObjectOutputStream(bos);
        out.writeObject(contentObject);
        out.close();
        content = new ContentData();
        content.setContent(bos.toByteArray());
        content.setAccessType(AccessType.Inline);
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
                // If the content is not set we will automatically copy all the input objects into
                // the task content
                else {
                    contentObject = workItem.getParameters();
                    ByteArrayOutputStream bos = new ByteArrayOutputStream();
      ObjectOutputStream out;
      try {
        out = new ObjectOutputStream(bos);
        out.writeObject(contentObject);
        out.close();
        content = new ContentData();
        content.setContent(bos.toByteArray());
        content.setAccessType(AccessType.Inline);
                                content.setType("java.util.map");
      } catch (IOException e) {
View Full Code Here

TOP

Related Classes of java.io.ObjectOutputStream

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.