Top Description Fields Constructors Methods
com.sun.codemodel.writer

public Class ZipCodeWriter

extends CodeWriter
Class Inheritance
Imports
java.io.FilterOutputStream, .IOException, .OutputStream, java.util.zip.ZipEntry, .ZipOutputStream, com.sun.codemodel.CodeWriter, .JPackage

Writes all the files into a zip file.
Author
Kohsuke Kawaguchi ([email protected])

Field Summary

Modifier and TypeField and Description
private final OutputStream
private final ZipOutputStream
Inherited from com.sun.codemodel.CodeWriter:
encoding

Constructor Summary

AccessConstructor and Description
public
ZipCodeWriter(OutputStream
Zip file will be written to this stream.
target
)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements abstract com.sun.codemodel.CodeWriter.close.

Called by CodeModel at the end of the process.

public OutputStream
openBinary(JPackage pkg, String fileName)

Implements abstract com.sun.codemodel.CodeWriter.openBinary.

Called by CodeModel to store the specified file.

private static String
toDirName(JPackage pkg)

Converts a package name to the directory name.

Inherited from com.sun.codemodel.CodeWriter:
openSource

Field Detail

filterback to summary
private final OutputStream filter
zipback to summary
private final ZipOutputStream zip

Constructor Detail

ZipCodeWriterback to summary
public ZipCodeWriter(OutputStream target)
Parameters
target:OutputStream

Zip file will be written to this stream.

Method Detail

closeback to summary
public void close() throws IOException

Implements abstract com.sun.codemodel.CodeWriter.close.

Doc from com.sun.codemodel.CodeWriter.close.

Called by CodeModel at the end of the process.

Annotations
@Override
openBinaryback to summary
public OutputStream openBinary(JPackage pkg, String fileName) throws IOException

Implements abstract com.sun.codemodel.CodeWriter.openBinary.

Doc from com.sun.codemodel.CodeWriter.openBinary.

Called by CodeModel to store the specified file. The callee must allocate a storage to store the specified file.

The returned stream will be closed before the next file is stored. So the callee can assume that only one OutputStream is active at any given time.

Annotations
@Override
toDirNameback to summary
private static String toDirName(JPackage pkg)

Converts a package name to the directory name.