public class FileCodeWriter extends CodeWriter
| Modifier and Type | Field and Description |
|---|---|
private boolean |
readOnly
specify whether or not to mark the generated files read-only
|
private java.util.Set<java.io.File> |
readonlyFiles
Files that shall be marked as read only.
|
private java.io.File |
target
The target directory to put source code.
|
encoding| Constructor and Description |
|---|
FileCodeWriter(java.io.File target) |
FileCodeWriter(java.io.File target,
boolean readOnly) |
FileCodeWriter(java.io.File target,
boolean readOnly,
java.lang.String encoding) |
FileCodeWriter(java.io.File target,
java.lang.String encoding) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Called by CodeModel at the end of the process.
|
protected java.io.File |
getFile(JPackage pkg,
java.lang.String fileName) |
java.io.OutputStream |
openBinary(JPackage pkg,
java.lang.String fileName)
Called by CodeModel to store the specified file.
|
private static java.lang.String |
toDirName(JPackage pkg)
Converts a package name to the directory name.
|
openSourceprivate final java.io.File target
private final boolean readOnly
private final java.util.Set<java.io.File> readonlyFiles
public FileCodeWriter(java.io.File target)
throws java.io.IOException
java.io.IOExceptionpublic FileCodeWriter(java.io.File target,
java.lang.String encoding)
throws java.io.IOException
java.io.IOExceptionpublic FileCodeWriter(java.io.File target,
boolean readOnly)
throws java.io.IOException
java.io.IOExceptionpublic FileCodeWriter(java.io.File target,
boolean readOnly,
java.lang.String encoding)
throws java.io.IOException
java.io.IOExceptionpublic java.io.OutputStream openBinary(JPackage pkg, java.lang.String fileName) throws java.io.IOException
CodeWriterThe 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.
openBinary in class CodeWriterpkg - The package of the file to be written.fileName - File name without the path. Something like
"Foo.java" or "Bar.properties"java.io.IOExceptionprotected java.io.File getFile(JPackage pkg, java.lang.String fileName) throws java.io.IOException
java.io.IOExceptionpublic void close()
throws java.io.IOException
CodeWriterclose in class CodeWriterjava.io.IOExceptionprivate static java.lang.String toDirName(JPackage pkg)