Package net.jini.io

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


 
  /*
   * 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

       
        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

 
  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

  }

  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

  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

  if (impl == null) {
      throw new NullPointerException();
  }
  OutputStream out = request.getResponseOutputStream();
  Collection unmodContext = Collections.unmodifiableCollection(context);
  return new MarshalOutputStream(out, unmodContext);
    }
View Full Code Here

        // write integrity yes/no
        requestOutput.write(secondRequestByte);

        // wrap requestOutput stream in a MarshalOutputStream
        MarshalOutputStream marshalledRequest = new MarshalOutputStream(
            requestOutput, new ArrayList());

        // write method hash
        marshalledRequest.writeLong(methodHash);

        // write method args
        if (methodArgs != null) {
            for (int i = 0; i < methodArgs.length; i++) {
                Util.marshalValue(methodArgs[i],marshalledRequest);
            }
        }
        marshalledRequest.close();

        requestInput = new ByteArrayInputStream(requestOutput.toByteArray());
    }
View Full Code Here

        // write status byte
        responseOutput.write(firstResponseByte);
        // wrap responseOutput stream in a MarshalOutputStream
        MarshalOutputStream marshalledResponse = new MarshalOutputStream(
            responseOutput, new ArrayList());
        // write returnValue to response stream
        Util.marshalValue(returnValue, marshalledResponse);

        marshalledResponse.close();
        responseInput = new ByteArrayInputStream(responseOutput.toByteArray());
    }
View Full Code Here

TOP

Related Classes of net.jini.io.MarshalOutputStream

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.