public abstract class JFiler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
encoding |
Modifier | Constructor and Description |
---|---|
protected |
JFiler()
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getEncoding()
Get the file encoding to use.
|
static JFiler |
newInstance(java.io.File target)
Get an instance which writes to the filesystem.
|
static JFiler |
newInstance(javax.annotation.processing.Filer filer)
Get an instance which uses an underlying
Filer . |
abstract java.io.OutputStream |
openStream(java.lang.String packageName,
java.lang.String fileName)
Open an output stream for writing the given file.
|
java.io.Writer |
openWriter(java.lang.String packageName,
java.lang.String fileName)
Open a writer for the given file.
|
void |
setEncoding(java.lang.String encoding)
Set the file encoding to use.
|
public static JFiler newInstance(javax.annotation.processing.Filer filer)
Filer
.filer
- the annotation processing filerpublic static JFiler newInstance(java.io.File target)
target
- the target source pathpublic java.lang.String getEncoding()
public void setEncoding(java.lang.String encoding)
encoding
- the file encodingpublic abstract java.io.OutputStream openStream(java.lang.String packageName, java.lang.String fileName) throws java.io.IOException
packageName
- the package namefileName
- the file namejava.io.IOException
- if an error occurs during writepublic java.io.Writer openWriter(java.lang.String packageName, java.lang.String fileName) throws java.io.IOException
openStream(String, String)
and wraps
the result with an OutputStreamWriter
using the configured file encoding.packageName
- the package namefileName
- the file namejava.io.IOException
- if an error occurs during write