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

public Class OutputStreamCodeWriter

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

Output all source files into a single stream. This is primarily for test purposes.
Author
Aleksei Valikov ([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
OutputStreamCodeWriter(OutputStream
This stream will be closed at the end of the code generation.
os
,
String encoding)

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

OutputStreamCodeWriterback to summary
public OutputStreamCodeWriter(OutputStream os, String encoding)
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