Package com.storedobject.core
Class JavaSourceWriter
java.lang.Object
java.io.Writer
java.io.FilterWriter
com.storedobject.core.JavaSourceWriter
- All Implemented Interfaces:
Closeable
,Flushable
,Appendable
,AutoCloseable
This class is a filtered writer to format Java source code. In order to get your Java source code formatted, just pass it through this filter while writing it out.
(Uses Google's formatter and Google's Java coding styles .).
- Author:
- Syam
-
Field Summary
Fields inherited from class java.io.FilterWriter
out
-
Constructor Summary
ConstructorsConstructorDescriptionJavaSourceWriter
(Writer out) Create a new filtered writer.JavaSourceWriter
(Writer out, String className) Create a new filtered writer. -
Method Summary
Methods inherited from class java.io.FilterWriter
write, write, write
-
Constructor Details
-
JavaSourceWriter
Create a new filtered writer.- Parameters:
out
- a Writer object to provide the underlying stream.- Throws:
NullPointerException
- ifout
isnull
.
-
JavaSourceWriter
Create a new filtered writer.- Parameters:
out
- a Writer object to provide the underlying stream.className
- Java class name of the source (optional).- Throws:
NullPointerException
- ifout
isnull
-
-
Method Details
-
flush
public void flush()- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classFilterWriter
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterWriter
- Throws:
IOException
-
format
Format the content that was already written to this.- Throws:
IOException
- If any IO error occurs while writing.
-