Examples of ObjectOutputStream


Examples of java.io.ObjectOutputStream

   }

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

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

Examples of java.io.ObjectOutputStream

{
   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

Examples of java.io.ObjectOutputStream

   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

Examples of java.io.ObjectOutputStream

   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

Examples of java.io.ObjectOutputStream

      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

Examples of java.io.ObjectOutputStream

   }

   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

Examples of java.io.ObjectOutputStream

    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

Examples of java.io.ObjectOutputStream

      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

Examples of java.io.ObjectOutputStream

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