Package org.jboss.jdeparser
Class JFiler
- java.lang.Object
-
- org.jboss.jdeparser.JFiler
-
public abstract class JFiler extends java.lang.ObjectA file manager for writing out source files.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringencoding
-
Constructor Summary
Constructors Modifier Constructor Description protectedJFiler()Construct a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetEncoding()Get the file encoding to use.static JFilernewInstance(java.io.File target)Get an instance which writes to the filesystem.static JFilernewInstance(javax.annotation.processing.Filer filer)Get an instance which uses an underlyingFiler.abstract java.io.OutputStreamopenStream(java.lang.String packageName, java.lang.String fileName)Open an output stream for writing the given file.java.io.WriteropenWriter(java.lang.String packageName, java.lang.String fileName)Open a writer for the given file.voidsetEncoding(java.lang.String encoding)Set the file encoding to use.
-
-
-
Method Detail
-
newInstance
public static JFiler newInstance(javax.annotation.processing.Filer filer)
Get an instance which uses an underlyingFiler.- Parameters:
filer- the annotation processing filer- Returns:
- the JDeparser filer
-
newInstance
public static JFiler newInstance(java.io.File target)
Get an instance which writes to the filesystem.- Parameters:
target- the target source path- Returns:
- the JDeparser filer
-
getEncoding
public java.lang.String getEncoding()
Get the file encoding to use.- Returns:
- the file encoding
-
setEncoding
public void setEncoding(java.lang.String encoding)
Set the file encoding to use.- Parameters:
encoding- the file encoding
-
openStream
public abstract java.io.OutputStream openStream(java.lang.String packageName, java.lang.String fileName) throws java.io.IOExceptionOpen an output stream for writing the given file.- Parameters:
packageName- the package namefileName- the file name- Returns:
- the output stream
- Throws:
java.io.IOException- if an error occurs during write
-
openWriter
public java.io.Writer openWriter(java.lang.String packageName, java.lang.String fileName) throws java.io.IOExceptionOpen a writer for the given file. The default implementation callsopenStream(String, String)and wraps the result with anOutputStreamWriterusing the configured file encoding.- Parameters:
packageName- the package namefileName- the file name- Returns:
- the writer
- Throws:
java.io.IOException- if an error occurs during write
-
-