/** @param file */
 public void export(File file) {
   LOG.debug("Writing index file for directory...");
   ObjectOutputStream out = null;
   try {
     out = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
     out.writeObject(qtree);
     out.writeObject(createEnvelope(envelope));
     out.writeObject(rasterDataInfo);
     out.writeObject(rasterGeoReference.getOriginLocation());
     out.writeDouble(rasterGeoReference.getResolutionX());
     out.writeDouble(rasterGeoReference.getResolutionY());
     out.writeDouble(rasterGeoReference.getRotationX());
     out.writeDouble(rasterGeoReference.getRotationY());
     out.writeDouble(rasterGeoReference.getOriginEasting());
     out.writeDouble(rasterGeoReference.getOriginNorthing());
     out.writeObject(rasterGeoReference.getCrs());
     out.writeObject(resolutionInfo);
     out.writeObject(options);
     LOG.debug("Done.");
   } catch (IOException e) {
     LOG.debug(
         "Raster pyramid file '{}' could not be written: '{}'.", file, e.getLocalizedMessage());
     LOG.trace("Stack trace:", e);
   } finally {
     if (out != null) {
       try {
         out.close();
       } catch (IOException e) {
         LOG.debug(
             "Raster pyramid file '{}' could not be closed: '{}'.", file, e.getLocalizedMessage());
         LOG.trace("Stack trace:", e);
       }
     }
   }
 }
 private void writeObject(ObjectOutputStream out) throws IOException {
   out.writeInt(version);
   out.writeObject(textRenderer);
   out.writeObject(chartRenderer);
   out.writeObject(pointLocator);
   out.writeDouble(discardLowLimit);
   out.writeDouble(discardHighLimit);
   SerializationHelper.writeSafeUTF(out, chartColour);
   out.writeInt(plotType);
 }
 private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
   final double key[] = this.key;
   final double value[] = this.value;
   final MapIterator i = new MapIterator();
   s.defaultWriteObject();
   for (int j = size, e; j-- != 0; ) {
     e = i.nextEntry();
     s.writeDouble(key[e]);
     s.writeDouble(value[e]);
   }
 }
  public static synchronized int generateMD5Id(Object... object) {
    try {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos;
      oos = new ObjectOutputStream(baos);

      for (Object x : object) {
        if (x == null) oos.writeChars("null");
        else if (x instanceof Integer) oos.writeInt((Integer) x);
        else if (x instanceof String) oos.writeChars((String) x);
        else if (x instanceof Double) oos.writeDouble((Double) x);
        else if (x instanceof Class) oos.writeChars(((Class<?>) x).getName());
      }

      oos.close();
      MessageDigest m = MessageDigest.getInstance("MD5");
      m.update(baos.toByteArray());
      BigInteger testObjectHash = new BigInteger(m.digest());
      return testObjectHash.intValue();
    } catch (IOException e) {
      e.printStackTrace();
    } catch (NoSuchAlgorithmException e) {
      e.printStackTrace();
    }
    return 0;
  }
Exemple #5
0
 private void writeObject(ObjectOutputStream out) throws IOException {
   out.writeInt(CURRENT_SERIAL_VERSION);
   out.writeObject(ilist);
   out.writeInt(numTopics);
   out.writeDouble(alpha);
   out.writeDouble(beta);
   out.writeDouble(tAlpha);
   out.writeDouble(vBeta);
   for (int di = 0; di < topics.length; di++)
     for (int si = 0; si < topics[di].length; si++) out.writeInt(topics[di][si]);
   for (int di = 0; di < topics.length; di++)
     for (int ti = 0; ti < numTopics; ti++) out.writeInt(docTopicCounts[di][ti]);
   for (int fi = 0; fi < numTypes; fi++)
     for (int ti = 0; ti < numTopics; ti++) out.writeInt(typeTopicCounts[fi][ti]);
   for (int ti = 0; ti < numTopics; ti++) out.writeInt(tokensPerTopic[ti]);
 }
 /*     */ private void writeObject(ObjectOutputStream s) throws IOException {
   /* 279 */ s.defaultWriteObject();
   /* 280 */ for (int i = 0; i < this.size; i++) {
     /* 281 */ s.writeByte(this.key[i]);
     /* 282 */ s.writeDouble(this.value[i]);
     /*     */ }
   /*     */ }
 private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
   s.defaultWriteObject();
   for (int i = 0; i < size; i++) {
     s.writeObject(key[i]);
     s.writeDouble(value[i]);
   }
 }
 /** java.io.ObjectOutputStream#writeDouble(double) */
 public void test_writeDoubleD() throws Exception {
   // Test for method void java.io.ObjectOutputStream.writeDouble(double)
   oos.writeDouble(Double.MAX_VALUE);
   oos.close();
   ois = new ObjectInputStream(new ByteArrayInputStream(bao.toByteArray()));
   assertTrue("Wrote incorrect double value", ois.readDouble() == Double.MAX_VALUE);
 }
 /**
  * Serialize a {@link RealVector}.
  *
  * <p>This method is intended to be called from within a private <code>writeObject</code> method
  * (after a call to <code>oos.defaultWriteObject()</code>) in a class that has a {@link
  * RealVector} field, which should be declared <code>transient</code>. This way, the default
  * handling does not serialize the vector (the {@link RealVector} interface is not serializable by
  * default) but this method does serialize it specifically.
  *
  * <p>The following example shows how a simple class with a name and a real vector should be
  * written:
  *
  * <pre><code>
  * public class NamedVector implements Serializable {
  *
  *     private final String name;
  *     private final transient RealVector coefficients;
  *
  *     // omitted constructors, getters ...
  *
  *     private void writeObject(ObjectOutputStream oos) throws IOException {
  *         oos.defaultWriteObject();  // takes care of name field
  *         MatrixUtils.serializeRealVector(coefficients, oos);
  *     }
  *
  *     private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
  *         ois.defaultReadObject();  // takes care of name field
  *         MatrixUtils.deserializeRealVector(this, "coefficients", ois);
  *     }
  *
  * }
  * </code></pre>
  *
  * @param vector real vector to serialize
  * @param oos stream where the real vector should be written
  * @exception IOException if object cannot be written to stream
  * @see #deserializeRealVector(Object, String, ObjectInputStream)
  */
 public static void serializeRealVector(final RealVector vector, final ObjectOutputStream oos)
     throws IOException {
   final int n = vector.getDimension();
   oos.writeInt(n);
   for (int i = 0; i < n; ++i) {
     oos.writeDouble(vector.getEntry(i));
   }
 }
Exemple #10
0
  private void writeObject(final ObjectOutputStream out) throws IOException {
    out.defaultWriteObject();

    out.writeInt(_length);
    out.writeDouble(_p);
    out.writeInt(_genes.length);
    out.write(_genes);
  }
 /** Format: mapType, num, (key, value) pairs */
 private void writeObject(ObjectOutputStream out) throws IOException {
   out.writeObject(mapType);
   out.writeInt(num);
   for (Entry e : this) {
     out.writeObject(e.getKey());
     out.writeDouble(e.getValue());
   }
 }
 public boolean execute(double val) {
   try {
     stream.writeDouble(val);
   } catch (IOException e) {
     this.exception = e;
     return false;
   }
   return true;
 }
Exemple #13
0
 private void writeObject(ObjectOutputStream out) throws IOException {
   out.writeInt(CURRENT_SERIAL_VERSION);
   int size = data.length;
   out.writeInt(size);
   for (int i = 1; i < size; i++) {
     out.writeDouble(data[i]);
   }
   out.writeInt(this.size);
 }
/*     */   private void writeObject(ObjectOutputStream s) throws IOException {
/* 809 */     Object[] key = this.key;
/* 810 */     double[] value = this.value;
/* 811 */     MapIterator i = new MapIterator(null);
/* 812 */     s.defaultWriteObject();
/* 813 */     for (int j = this.size; j-- != 0; ) {
/* 814 */       int e = i.nextEntry();
/* 815 */       s.writeObject(key[e]);
/* 816 */       s.writeDouble(value[e]);
/*     */     }
/*     */   }
 // Explicit implementation of writeObject, but called implicitly as a result of recursive calls to
 // writeObject() based on Serializable interface
 private void writeObject(ObjectOutputStream out) throws IOException {
   out.writeObject(
       getName()); // SimpleDoubleProperty name is NOT serializable, so I do it manually
   out.writeDouble(
       getStrength()); // SimpleDoubleProperty strength is NOT serializable, so I do it manually
   out.writeDouble(
       getHealth()); // SimpleDoubleProperty health is NOT serializable, so I do it manually
   out.writeDouble(
       getSpeed()); // SimpleDoubleProperty speed is NOT serializable, so I do it manually
   out.writeDouble(
       getAvatar()
           .getTranslateX()); // Node battlefieldAvatar is NOT serializable. It's TOO BIG anyway,
                              // so I extract the elements that I need (here, translateX property)
                              // to retain manually.
   out.writeDouble(
       getAvatar()
           .getTranslateY()); // Node battlefieldAvatar is NOT serializable. It's TOO BIG anyway,
                              // so I extract the elements that I need (here, translateY property)
                              // to retain manually.
 } // end writeObject() to support serialization
 /**
  * Serialize a {@link RealMatrix}.
  *
  * <p>This method is intended to be called from within a private <code>writeObject</code> method
  * (after a call to <code>oos.defaultWriteObject()</code>) in a class that has a {@link
  * RealMatrix} field, which should be declared <code>transient</code>. This way, the default
  * handling does not serialize the matrix (the {@link RealMatrix} interface is not serializable by
  * default) but this method does serialize it specifically.
  *
  * <p>The following example shows how a simple class with a name and a real matrix should be
  * written:
  *
  * <pre><code>
  * public class NamedMatrix implements Serializable {
  *
  *     private final String name;
  *     private final transient RealMatrix coefficients;
  *
  *     // omitted constructors, getters ...
  *
  *     private void writeObject(ObjectOutputStream oos) throws IOException {
  *         oos.defaultWriteObject();  // takes care of name field
  *         MatrixUtils.serializeRealMatrix(coefficients, oos);
  *     }
  *
  *     private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
  *         ois.defaultReadObject();  // takes care of name field
  *         MatrixUtils.deserializeRealMatrix(this, "coefficients", ois);
  *     }
  *
  * }
  * </code></pre>
  *
  * @param matrix real matrix to serialize
  * @param oos stream where the real matrix should be written
  * @exception IOException if object cannot be written to stream
  * @see #deserializeRealMatrix(Object, String, ObjectInputStream)
  */
 public static void serializeRealMatrix(final RealMatrix matrix, final ObjectOutputStream oos)
     throws IOException {
   final int n = matrix.getRowDimension();
   final int m = matrix.getColumnDimension();
   oos.writeInt(n);
   oos.writeInt(m);
   for (int i = 0; i < n; ++i) {
     for (int j = 0; j < m; ++j) {
       oos.writeDouble(matrix.getEntry(i, j));
     }
   }
 }
 private void writeObject(ObjectOutputStream out) throws IOException {
   out.writeInt(CURRENT_SERIAL_VERSION);
   out.writeObject(ilist);
   out.writeInt(numTopics);
   out.writeDouble(alpha);
   out.writeDouble(beta);
   out.writeDouble(gamma);
   out.writeDouble(delta);
   out.writeDouble(tAlpha);
   out.writeDouble(vBeta);
   out.writeDouble(vGamma);
   out.writeInt(numTypes);
   out.writeInt(numBitypes);
   out.writeInt(numTokens);
   out.writeInt(biTokens);
   for (int di = 0; di < topics.length; di++)
     for (int si = 0; si < topics[di].length; si++) out.writeInt(topics[di][si]);
   for (int di = 0; di < topics.length; di++)
     for (int si = 0; si < topics[di].length; si++) out.writeInt(grams[di][si]);
   writeIntArray2(docTopicCounts, out);
   for (int fi = 0; fi < numTypes; fi++)
     for (int n = 0; n < 2; n++)
       for (int ti = 0; ti < numTopics; ti++) out.writeInt(typeNgramTopicCounts[fi][n][ti]);
   writeIntArray2(unitypeTopicCounts, out);
   writeIntArray2(bitypeTopicCounts, out);
   for (int ti = 0; ti < numTopics; ti++) out.writeInt(tokensPerTopic[ti]);
   writeIntArray2(bitokensPerTopic, out);
 }
 /** Writes the example set into the given output stream. */
 public void writeSupportVectors(ObjectOutputStream out) throws IOException {
   out.writeInt(getNumberOfSupportVectors());
   out.writeDouble(b);
   out.writeInt(dim);
   if ((meanVarianceMap == null) || (meanVarianceMap.size() == 0)) {
     out.writeUTF("noscale");
   } else {
     out.writeUTF("scale");
     out.writeInt(meanVarianceMap.size());
     Iterator i = meanVarianceMap.keySet().iterator();
     while (i.hasNext()) {
       Integer index = (Integer) i.next();
       MeanVariance meanVariance = meanVarianceMap.get(index);
       out.writeInt(index.intValue());
       out.writeDouble(meanVariance.getMean());
       out.writeDouble(meanVariance.getVariance());
     }
   }
   for (int e = 0; e < train_size; e++) {
     if (alphas[e] != 0.0d) {
       out.writeInt(atts[e].length);
       for (int a = 0; a < atts[e].length; a++) {
         out.writeInt(index[e][a]);
         out.writeDouble(atts[e][a]);
       }
       out.writeDouble(alphas[e]);
       out.writeDouble(ys[e]);
     }
   }
 }
Exemple #19
0
 /** Run benchmark for given number of batches, with given number of cycles for each batch. */
 void doReps(
     ObjectOutputStream oout, ObjectInputStream oin, StreamBuffer sbuf, int nbatches, int ncycles)
     throws Exception {
   for (int i = 0; i < nbatches; i++) {
     sbuf.reset();
     for (int j = 0; j < ncycles; j++) {
       oout.writeDouble(0.0);
     }
     oout.flush();
     for (int j = 0; j < ncycles; j++) {
       oin.readDouble();
     }
   }
 }
  private void writeObject(java.io.ObjectOutputStream stream) throws java.io.IOException {
    stream.defaultWriteObject();

    if (getHostPointer() == null) {
      stream.writeInt(0);
    } else {
      double[] arr = this.asDouble();

      stream.writeInt(arr.length);
      for (int i = 0; i < arr.length; i++) {
        stream.writeDouble(arr[i]);
      }
    }
  }
Exemple #21
0
 private void writeObject(ObjectOutputStream out) throws IOException {
   out.writeInt(CURRENT_SERIAL_VERSION);
   out.writeObject(source);
   out.writeInt(index);
   out.writeInt(nextIndex);
   out.writeInt(inputPos);
   if (weights != null) {
     out.writeInt(weights.length);
     for (int i = 0; i < weights.length; i++) {
       out.writeDouble(weights[i]);
     }
   } else {
     out.writeInt(NULL_INTEGER);
   }
   out.writeObject(inputSequence);
   out.writeObject(inputFeature);
   out.writeObject(hmm);
 }
    /**
     * Get the signature data generated
     *
     * @return Signature data
     * @throws OpenStegoException
     */
    public byte[] getSigData() throws OpenStegoException {
      ByteArrayOutputStream baos = null;
      ObjectOutputStream oos = null;

      try {
        baos = new ByteArrayOutputStream();
        oos = new ObjectOutputStream(baos);
        oos.write(this.sig);
        oos.writeInt(this.watermarkLength);
        oos.writeDouble(this.embeddingStrength);
        oos.writeInt(this.waveletFilterMethod);
        oos.writeInt(this.filterID);
        oos.writeInt(this.embeddingLevel);
        oos.write(this.watermark);
        oos.flush();
        oos.close();

        return baos.toByteArray();
      } catch (IOException ioEx) {
        throw new OpenStegoException(ioEx);
      }
    }
Exemple #23
0
  /** @param args */
  public static void main(String[] args) {
    // TODO Auto-generated method stub
    String fileName = "binaryfile.bin";
    try {
      FileOutputStream fileOs = new FileOutputStream(fileName);
      ObjectOutputStream os = new ObjectOutputStream(fileOs);

      os.writeInt(2048);
      os.writeDouble(3.1415);
      os.close();
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    System.out.println("Done Writting:now reading");

    try {
      FileInputStream fileIs = new FileInputStream(fileName);
      ObjectInputStream is = new ObjectInputStream(fileIs);
      int x = is.readInt();
      System.out.println(x);
      double y = is.readDouble();

      System.out.println(y);

      is.close();
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
  /** save To save members' information into a binary file */
  public void save() {
    ObjectOutputStream oout = null;
    Member tm;
    ArrayList<String> booksBorrowed = new ArrayList<String>();
    try {
      oout = new ObjectOutputStream(new FileOutputStream("members1.dat"));
      // Loop through memberMap and process each entry
      // Structure for writing
      // __________________________________________________________
      // |String|String|String|Boolean or Double|ArrayList<String>|
      // ----------------------------------------------------------

      for (Map.Entry<String, Member> entry : memberMap.entrySet()) {
        tm = entry.getValue();
        oout.writeUTF(tm.getMemberID());
        oout.writeUTF(tm.getName());
        oout.writeUTF(tm.getPhoneNumber());
        if (tm instanceof Staff) {
          oout.writeBoolean(((Staff) tm).isBookOverdue());
        } else {
          oout.writeDouble(((Student) tm).getFinesOwing());
        }
        for (LibraryBook b : tm.getBooklist()) {
          booksBorrowed.add(b.getBookNumber());
        }
        oout.writeObject(booksBorrowed);
      }
    } catch (Exception e) {
      Log.e(e.getMessage());
    } finally {
      try {
        oout.close();
      } catch (IOException e) {
        Log.e(e.getMessage());
      }
    }
  }
 @Override
 public void writeDouble(double val) throws IOException {
   out.writeDouble(val);
 }
Exemple #26
0
 public void writeDouble(double d) throws IOException {
   output.writeDouble(d);
 }
 private void writeObject(ObjectOutputStream out) throws IOException {
   out.defaultWriteObject();
   out.writeDouble(point.getX());
   out.writeDouble(point.getY());
 }
Exemple #28
0
 private void writeEntry(DataEntry entry) throws IOException {
   writeDate(entry.getAccidentDate());
   writeDate(entry.getDevelopmentDate());
   writer.writeDouble(entry.getValue());
 }
Exemple #29
0
  public static void main(String[] args) {
    try {
      M2MI.initialize();
      M2MIClassLoader classloader = M2MI.getClassLoader();

      ByteArrayInputStream bais;
      ObjectInputStream ois;
      ByteArrayOutputStream baos;
      ObjectOutputStream oos;
      FileOutputStream fos;
      Object obj;

      BarImpl2 targetA = new BarImpl2("Target object A");
      BarImpl2 targetB = new BarImpl2("Target object B");
      M2MI.export(targetA, Bar.class);
      M2MI.export(targetB, Bar.class);

      System.out.println("******** doSomething() ********");
      MethodDescriptor desc1 =
          new MethodDescriptor("edu.rit.m2mi.test.Bar", "doSomething", "(ILjava/lang/String;)V");
      String name1 = classloader.getMethodInvokerClassName(desc1);
      System.out.println("Class name = \"" + name1 + "\"");
      System.out.println("Writing argument values");
      baos = new ByteArrayOutputStream();
      oos = new ObjectOutputStream(baos);
      oos.writeInt(42);
      oos.writeObject("Forty-two");
      oos.close();
      baos.close();
      dump(baos);
      System.out.println("Creating method invoker");
      Class class1 = classloader.loadClass(name1);
      MethodInvoker mi1 = (MethodInvoker) class1.newInstance();
      System.out.println("Reading method invoker state");
      bais = new ByteArrayInputStream(baos.toByteArray());
      ois = new ObjectInputStream(bais);
      mi1.read(ois);
      ois.close();
      bais.close();
      System.out.println("Creating invocation object");
      OmniInvocation invocation1 = new OmniInvocation(Eoid.WILDCARD, desc1, mi1);
      System.out.println("Invoking target method");
      invocation1.processFromMessage();
      System.out.println("Writing invocation object");
      baos = new ByteArrayOutputStream();
      oos = new ObjectOutputStream(baos);
      oos.writeObject(invocation1);
      oos.close();
      baos.close();
      dump(baos);
      System.out.println("Reading invocation object");
      bais = new ByteArrayInputStream(baos.toByteArray());
      ois = new ObjectInputStream(bais);
      invocation1 = (OmniInvocation) ois.readObject();
      ois.close();
      bais.close();
      System.out.println("Invoking target method");
      invocation1.processFromMessage();
      System.out.println();

      System.out.println("******** doSomethingElse() ********");
      MethodDescriptor desc2 =
          new MethodDescriptor("edu.rit.m2mi.test.Bar", "doSomethingElse", "(D)V");
      String name2 = classloader.getMethodInvokerClassName(desc2);
      System.out.println("Class name = \"" + name2 + "\"");
      System.out.println("Writing argument values");
      baos = new ByteArrayOutputStream();
      oos = new ObjectOutputStream(baos);
      oos.writeDouble(3.14159);
      oos.close();
      baos.close();
      dump(baos);
      System.out.println("Creating method invoker");
      Class class2 = classloader.loadClass(name2);
      MethodInvoker mi2 = (MethodInvoker) class2.newInstance();
      System.out.println("Reading method invoker state");
      bais = new ByteArrayInputStream(baos.toByteArray());
      ois = new ObjectInputStream(bais);
      mi2.read(ois);
      ois.close();
      bais.close();
      System.out.println("Creating invocation object");
      OmniInvocation invocation2 = new OmniInvocation(Eoid.WILDCARD, desc2, mi2);
      System.out.println("Invoking target method");
      invocation2.processFromMessage();
      System.out.println("Writing invocation object");
      baos = new ByteArrayOutputStream();
      oos = new ObjectOutputStream(baos);
      oos.writeObject(invocation2);
      oos.close();
      baos.close();
      dump(baos);
      System.out.println("Reading invocation object");
      bais = new ByteArrayInputStream(baos.toByteArray());
      ois = new ObjectInputStream(bais);
      invocation2 = (OmniInvocation) ois.readObject();
      ois.close();
      bais.close();
      System.out.println("Invoking target method");
      invocation2.processFromMessage();
      System.out.println();

      System.out.println("******** doNothing() ********");
      MethodDescriptor desc3 = new MethodDescriptor("edu.rit.m2mi.test.Bar", "doNothing", "()V");
      String name3 = classloader.getMethodInvokerClassName(desc3);
      System.out.println("Class name = \"" + name3 + "\"");
      System.out.println("Writing argument values");
      baos = new ByteArrayOutputStream();
      oos = new ObjectOutputStream(baos);
      oos.close();
      baos.close();
      dump(baos);
      System.out.println("Creating method invoker");
      Class class3 = classloader.loadClass(name3);
      MethodInvoker mi3 = (MethodInvoker) class3.newInstance();
      System.out.println("Reading method invoker state");
      bais = new ByteArrayInputStream(baos.toByteArray());
      ois = new ObjectInputStream(bais);
      mi3.read(ois);
      ois.close();
      bais.close();
      System.out.println("Creating invocation object");
      OmniInvocation invocation3 = new OmniInvocation(Eoid.WILDCARD, desc3, mi3);
      System.out.println("Invoking target method");
      invocation3.processFromMessage();
      System.out.println("Writing invocation object");
      baos = new ByteArrayOutputStream();
      oos = new ObjectOutputStream(baos);
      oos.writeObject(invocation3);
      oos.close();
      baos.close();
      dump(baos);
      System.out.println("Reading invocation object");
      bais = new ByteArrayInputStream(baos.toByteArray());
      ois = new ObjectInputStream(bais);
      invocation3 = (OmniInvocation) ois.readObject();
      ois.close();
      bais.close();
      System.out.println("Invoking target method");
      invocation3.processFromMessage();
      System.out.println();

      System.out.println("******** doArrayStuff() ********");
      MethodDescriptor desc4 =
          new MethodDescriptor(
              "edu.rit.m2mi.test.Bar", "doArrayStuff", "([[F[Ljava/lang/String;)V");
      String name4 = classloader.getMethodInvokerClassName(desc4);
      System.out.println("Class name = \"" + name4 + "\"");
      System.out.println("Writing argument values");
      baos = new ByteArrayOutputStream();
      oos = new ObjectOutputStream(baos);
      oos.writeObject(new float[][] {{1.1f, 2.2f}, {3.3f, 4.4f}});
      oos.writeObject(new String[] {"Hickory", "dickory", "dock"});
      oos.close();
      baos.close();
      dump(baos);
      System.out.println("Creating method invoker");
      Class class4 = classloader.loadClass(name4);
      MethodInvoker mi4 = (MethodInvoker) class4.newInstance();
      System.out.println("Reading method invoker state");
      bais = new ByteArrayInputStream(baos.toByteArray());
      ois = new ObjectInputStream(bais);
      mi4.read(ois);
      ois.close();
      bais.close();
      System.out.println("Creating invocation object");
      OmniInvocation invocation4 = new OmniInvocation(Eoid.WILDCARD, desc4, mi4);
      System.out.println("Invoking target method");
      invocation4.processFromMessage();
      System.out.println("Writing invocation object");
      baos = new ByteArrayOutputStream();
      oos = new ObjectOutputStream(baos);
      oos.writeObject(invocation4);
      oos.close();
      baos.close();
      dump(baos);
      System.out.println("Reading invocation object");
      bais = new ByteArrayInputStream(baos.toByteArray());
      ois = new ObjectInputStream(bais);
      invocation4 = (OmniInvocation) ois.readObject();
      ois.close();
      bais.close();
      System.out.println("Invoking target method");
      invocation4.processFromMessage();
      System.out.println();

      System.out.println("******** Main program waits 40 seconds ********");
      System.out.println();
      Thread.sleep(40000L);

      System.out.println("******** Unexporting target object B ********");
      M2MI.unexport(targetB);
      invocation1 = new OmniInvocation(Eoid.WILDCARD, desc1, mi1);
      invocation1.processFromMessage();
      invocation2 = new OmniInvocation(Eoid.WILDCARD, desc2, mi2);
      invocation2.processFromMessage();
      invocation3 = new OmniInvocation(Eoid.WILDCARD, desc3, mi3);
      invocation3.processFromMessage();
      invocation4 = new OmniInvocation(Eoid.WILDCARD, desc4, mi4);
      invocation4.processFromMessage();
      System.out.println();

      System.out.println("******** Main program waits 10 seconds ********");
      System.out.println();
      Thread.sleep(10000L);
    } catch (Throwable exc) {
      System.err.println("Test04: Uncaught exception");
      exc.printStackTrace(System.err);
      System.exit(1);
    }
  }
 void writeParameters(ObjectOutputStream out) throws IOException {
   out.writeDouble(this.a);
   out.writeDouble(this.b);
 }