Package org.jboss.jdeparser
Class JFiler
java.lang.Object
org.jboss.jdeparser.JFiler
A file manager for writing out source files.
- Author:
- David M. Lloyd
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the file encoding to use.static JFiler
newInstance
(File target) Get an instance which writes to the filesystem.static JFiler
newInstance
(Filer filer) Get an instance which uses an underlyingFiler
.abstract OutputStream
openStream
(String packageName, String fileName) Open an output stream for writing the given file.openWriter
(String packageName, String fileName) Open a writer for the given file.void
setEncoding
(String encoding) Set the file encoding to use.
-
Constructor Details
-
JFiler
protected JFiler()Construct a new instance.
-
-
Method Details
-
newInstance
Get an instance which uses an underlyingFiler
.- Parameters:
filer
- the annotation processing filer- Returns:
- the JDeparser filer
-
newInstance
Get an instance which writes to the filesystem.- Parameters:
target
- the target source path- Returns:
- the JDeparser filer
-
getEncoding
Get the file encoding to use.- Returns:
- the file encoding
-
setEncoding
Set the file encoding to use.- Parameters:
encoding
- the file encoding
-
openStream
Open an output stream for writing the given file.- Parameters:
packageName
- the package namefileName
- the file name- Returns:
- the output stream
- Throws:
IOException
- if an error occurs during write
-
openWriter
Open a writer for the given file. The default implementation callsopenStream(String, String)
and wraps the result with anOutputStreamWriter
using the configured file encoding.- Parameters:
packageName
- the package namefileName
- the file name- Returns:
- the writer
- Throws:
IOException
- if an error occurs during write
-