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

public Class SingleStreamCodeWriter

extends CodeWriter
Class Inheritance
Imports
java.io.FilterOutputStream, .IOException, .OutputStream, .PrintStream, com.sun.codemodel.CodeWriter, .JPackage

Output all source files into a single stream with a little formatting header in front of each file. This is primarily for human consumption of the generated source code, such as to debug/test CodeModel or to quickly inspect the result.
Author
Kohsuke Kawaguchi ([email protected])

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
SingleStreamCodeWriter(OutputStream
This stream will be closed at the end of the code generation.
os
)

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.

Inherited from com.sun.codemodel.CodeWriter:
openSource

Field Detail

outback to summary
private final PrintStream out

Constructor Detail

SingleStreamCodeWriterback to summary
public SingleStreamCodeWriter(OutputStream os)
Parameters
os:OutputStream

This stream will be closed at the end of the code generation.

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