Examples of MarshalOutputStream


Examples of net.jini.io.MarshalOutputStream

    public void setup(QAConfig sysConfig) throws Exception {
        original = System.getSecurityManager();
    }

    public void run() throws Exception {
        MarshalOutputStream stream;
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ArrayList al = new ArrayList();
        PipedOutputStream pos = new PipedOutputStream();

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case 1: "
            + "MarshalOutputStream(null,null)");
        logger.log(Level.FINE,"");

        try {
            stream = new MarshalOutputStream(null,null);
            assertion(false);
        } catch (NullPointerException ignore) {
        }

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case 2: "
            + "MarshalOutputStream(OutputStream,null)");
        logger.log(Level.FINE,"");

        try {
            stream = new MarshalOutputStream(baos,null);
            assertion(false);
        } catch (NullPointerException ignore) {
        }

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case 3: "
            + "MarshalOutputStream(null,Collection)");
        logger.log(Level.FINE,"");

        try {
            stream = new MarshalOutputStream(null,al);
            assertion(false);
        } catch (NullPointerException ignore) {
        }

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case 4: "
            + "getObjectStreamContext method returns constructor arg");
        logger.log(Level.FINE,"");

        stream = new MarshalOutputStream(baos,al);
        assertion(stream.getObjectStreamContext() == al);

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case 5: "
            + "constructor throws IOException");
        logger.log(Level.FINE,"");

        try {
            stream = new MarshalOutputStream(pos,al);
            assertion(false);
        } catch (IOException ignore) {
        }

        logger.log(Level.FINE,"=================================");
View Full Code Here

Examples of net.jini.io.MarshalOutputStream

            // Write transferObject to MarshalOutputStream

            ArrayList context = new ArrayList();
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            MarshalOutputStream output = new FakeMarshalOutputStream(
                baos,context,writeAnnotationReturnVal);
            output.writeObject(transferObject);
            output.close();

            // Read transferObject from MarshalInputStream

            // Verifier shouldn't be called (so throw an exception if
            // it is) under the following conditions:
View Full Code Here

Examples of net.jini.io.MarshalOutputStream

    }

    // inherit javadoc
    public void run() throws Exception {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        MarshalOutputStream output =
            new MarshalOutputStream(baos,new ArrayList());
        FakeMarshalInputStream input = new FakeMarshalInputStream(
            new ByteArrayInputStream(baos.toByteArray()),null,null);

        logger.log(Level.FINE,"=================================");
        logger.log(Level.FINE,"test case 1: resolveClass(null)");
View Full Code Here

Examples of net.jini.io.MarshalOutputStream

            logger.log(Level.FINE,"");

            // Write transferObject to MarshalOutputStream
            ArrayList context = new ArrayList();
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            MarshalOutputStream output =
                new MarshalOutputStream(baos,context);
            output.writeObject(transferObject);
            output.close();

            // Read transferObject from MarshalInputStream
            ByteArrayInputStream bios =
                new ByteArrayInputStream(baos.toByteArray());
            MarshalInputStream input = new FakeMarshalInputStream(
View Full Code Here

Examples of net.jini.io.MarshalOutputStream

            logger.log(Level.FINE,"");

            // Write transferObject to MarshalOutputStream
            ArrayList context = new ArrayList();
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            MarshalOutputStream output =
                new MarshalOutputStream(baos,context);
            output.writeObject(transferObject);
            output.close();

            // Read transferObject from MarshalInputStream
            ByteArrayInputStream bios =
                new ByteArrayInputStream(baos.toByteArray());
            MarshalInputStream input = new FakeMarshalInputStream(
View Full Code Here

Examples of net.jini.io.MarshalOutputStream

 
  /*
   * Serialize handler.
   */
  ByteArrayOutputStream bout = new ByteArrayOutputStream();
  MarshalOutputStream out =
      new MarshalOutputStream(bout, new HashSet());
  out.writeObject(aih);
  out.flush();
  byte[] bytes = bout.toByteArray();

  /*
   * Read in handler (should succeed).
   */
  MarshalInputStream in =
      new MarshalInputStream(new ByteArrayInputStream(bytes),
           ClassLoader.getSystemClassLoader(),
           false, null, new HashSet());
  ActivatableInvocationHandler aihRead =
      (ActivatableInvocationHandler) in.readObject();
  System.err.println("Test 1 passed: handler read successfully");

  /*
   * Set constraints on underlying proxy to make
   * them inconsistent with handler's constraints, then
   * serialize handler.
   */
  uproxy.setConstraints(new Constraints());
  bout.reset();
  out = new MarshalOutputStream(bout, new HashSet());
  out.writeObject(aih);
  out.flush();
  bytes = bout.toByteArray();

  /*
   * Read in handler (should fail with InvalidObjectException);
   */
 
View Full Code Here

Examples of net.jini.io.MarshalOutputStream

       
        outputHandler.handleOutput(id, desc, incarnation,
                 groupName,
                 child.getInputStream(),
                 child.getErrorStream());
        MarshalOutputStream out =
      new MarshalOutputStream(child.getOutputStream(),
            Collections.EMPTY_LIST);
        out.writeObject(id);
        ActivationGroupDesc gd = desc;
        if (gd.getClassName() == null) {
      MarshalledObject data = gd.getData();
      if (data == null) {
          data = groupData;
      }
      String loc = gd.getLocation();
      if (loc == null) {
          loc = groupLocation;
      }
      gd = new ActivationGroupDesc(
        "com.sun.jini.phoenix.ActivationGroupImpl",
        loc,
        data,
        gd.getPropertyOverrides(),
        gd.getCommandEnvironment());
        }
        out.writeObject(gd);
        out.writeLong(incarnation);
        out.flush();
        out.close();
       
    } catch (Exception e) {
        terminate();
        if (e instanceof ActivationException) {
      throw (ActivationException) e;
View Full Code Here

Examples of net.jini.io.MarshalOutputStream

 
  public void snapshot(OutputStream out) throws Exception {
      if (state == null) {
    state = new Activation();
      }
      MarshalOutputStream s =
    new MarshalOutputStream(out, Collections.EMPTY_LIST);
      s.writeObject(state);
      s.flush();
  }
View Full Code Here

Examples of net.jini.io.MarshalOutputStream

  }

  public void writeUpdate(OutputStream out, Object value)
      throws Exception
  {
      MarshalOutputStream s =
    new MarshalOutputStream(out, Collections.EMPTY_LIST);
      s.writeObject(value);
      s.flush();
  }
View Full Code Here

Examples of net.jini.io.MarshalOutputStream

  Class fooClass = RMIClassLoader.loadClass(codebase, className);
  Object toWrite = fooClass.newInstance();

  ByteArrayOutputStream bout = new ByteArrayOutputStream();
  MarshalOutputStream mout =
       new MarshalOutputStream(bout, Collections.EMPTY_LIST);
  mout.writeObject(toWrite);
  mout.flush();

  ByteArrayInputStream bin =
      new ByteArrayInputStream(bout.toByteArray());
  MarshalInputStream min =
      new MarshalInputStream(bin, defaultLoader, true, defaultLoader,
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.