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

public Class LicenseCodeWriter

extends FilterCodeWriter
Class Inheritance
Imports
com.sun.codemodel.CodeWriter, .JPackage, java.io.BufferedReader, .File, .IOException, .PrintWriter, .Writer, java.nio.charset.Charset, java.nio.file.Files, .Path, java.util.Calendar, java.util.regex.Matcher, .Pattern

Writes all the source files under the specified file folder and inserts a license file each java source file.
Since
4.0.3

Field Summary

Modifier and TypeField and Description
private static final String
private final Path
private static final Pattern
Inherited from com.sun.codemodel.writer.FilterCodeWriter:
core

Constructor Summary

AccessConstructor and Description
public
LicenseCodeWriter(CodeWriter
This CodeWriter will be used to actually create a storage for files. LicenseCodeWriter simply decorates this underlying CodeWriter by adding prolog comments.
core
,
File
license File
license
,
String
encoding
encoding
)

Method Summary

Modifier and TypeMethod and Description
public Writer
openSource(JPackage pkg, String fileName)

Overrides com.sun.codemodel.writer.FilterCodeWriter.openSource.

Called by CodeModel to store the specified file.

Inherited from com.sun.codemodel.writer.FilterCodeWriter:
closeopenBinary

Field Detail

CURRENT_YEARback to summary
private static final String CURRENT_YEAR
licenseback to summary
private final Path license
PATTERNback to summary
private static final Pattern PATTERN

Constructor Detail

LicenseCodeWriterback to summary
public LicenseCodeWriter(CodeWriter core, File license, String encoding)
Parameters
core:CodeWriter

This CodeWriter will be used to actually create a storage for files. LicenseCodeWriter simply decorates this underlying CodeWriter by adding prolog comments.

license:File

license File

encoding:String

encoding

Method Detail

openSourceback to summary
public Writer openSource(JPackage pkg, String fileName) throws IOException

Overrides com.sun.codemodel.writer.FilterCodeWriter.openSource.

Doc from com.sun.codemodel.CodeWriter.openSource.

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