uvascript.tools
Class JarfileOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FilterOutputStream
          extended byuvascript.tools.JarfileOutputStream

public class JarfileOutputStream
extends java.io.FilterOutputStream

JarfileOutputStream is used for saving a mobile agent. It produces a jar file, which includes a serialized object and the classes needed for restoring that object.

To resume the saved agent, do:

where foo.jar is a produced jar file. The object is restored and a specified method is invoked.


Method Summary
 void closeEntry()
          Finishes writing a file entry.
 void finish()
          Finishes writing a jar file without closing the underlying stream.
 void putNextEntry(java.lang.String filename)
          Starts writing a new file entry in a jar file.
 void writeClassFile(java.lang.String className, java.lang.String fileName)
          Saves class files.
 void writeFiles(java.lang.String[] fnames)
          Saves files.
 
Methods inherited from class java.io.FilterOutputStream
close, flush, write, write, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

finish

public void finish()
            throws java.io.IOException
Finishes writing a jar file without closing the underlying stream.

Throws:
java.io.IOException

putNextEntry

public void putNextEntry(java.lang.String filename)
                  throws java.io.IOException
Starts writing a new file entry in a jar file.

For example, the following program:

stores a file "foo.txt" in the jar file. The contents of that file is "hello world".

Returns:
the output stream for writing.
Throws:
java.io.IOException

closeEntry

public void closeEntry()
                throws java.io.IOException
Finishes writing a file entry. It must be called after putNextEntry().

Throws:
java.io.IOException

writeFiles

public void writeFiles(java.lang.String[] fnames)
                throws java.io.IOException
Saves files.

Throws:
java.io.IOException

writeClassFile

public void writeClassFile(java.lang.String className,
                           java.lang.String fileName)
                    throws java.io.IOException
Saves class files. It saves not only the class file for the class specified by classname but also ones for the classes referenced by that class.

Throws:
java.io.IOException


UvaScript. Copyright (C) 2004 Shigeru Chiba. All Rights Reserved.