Package io.micronaut.inject.writer
Interface GeneratedFile
-
public interface GeneratedFileA common interface to allow referencing a generated file in either Groovy or Java.- Since:
- 1.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.StringgetName()java.lang.CharSequencegetTextContent()Gets the character content of this file object, if available.java.io.InputStreamopenInputStream()Gets an InputStream for this file object.java.io.OutputStreamopenOutputStream()Gets an OutputStream for this file object.java.io.ReaderopenReader()Gets a reader for this object.java.io.WriteropenWriter()Gets a Writer for this file object.java.net.URItoURI()The URI to write to.
-
-
-
Method Detail
-
toURI
java.net.URI toURI()
The URI to write to.- Returns:
- The URI
-
getName
java.lang.String getName()
- Returns:
- The name of the file
-
openInputStream
java.io.InputStream openInputStream() throws java.io.IOExceptionGets an InputStream for this file object.- Returns:
- an InputStream
- Throws:
java.lang.IllegalStateException- if this file object was opened for writing and does not support readingjava.lang.UnsupportedOperationException- if this kind of file object does not support byte accessjava.io.IOException- if an I/O error occurred
-
openOutputStream
java.io.OutputStream openOutputStream() throws java.io.IOExceptionGets an OutputStream for this file object.- Returns:
- an OutputStream
- Throws:
java.lang.IllegalStateException- if this file object was opened for reading and does not support writingjava.lang.UnsupportedOperationException- if this kind of file object does not support byte accessjava.io.IOException- if an I/O error occurred
-
openReader
java.io.Reader openReader() throws java.io.IOExceptionGets a reader for this object. The returned reader will replace bytes that cannot be decoded with the default translation character. In addition, the reader may report a diagnostic unlessignoreEncodingErrorsis true.- Returns:
- a Reader
- Throws:
java.lang.IllegalStateException- if this file object was opened for writing and does not support readingjava.lang.UnsupportedOperationException- if this kind of file object does not support character accessjava.io.IOException- if an I/O error occurred
-
getTextContent
java.lang.CharSequence getTextContent() throws java.io.IOExceptionGets the character content of this file object, if available. Any byte that cannot be decoded will be replaced by the default translation character. In addition, a diagnostic may be reported unlessignoreEncodingErrorsis true.- Returns:
- a CharSequence if available;
nullotherwise - Throws:
java.lang.IllegalStateException- if this file object was opened for writing and does not support readingjava.lang.UnsupportedOperationException- if this kind of file object does not support character accessjava.io.IOException- if an I/O error occurred
-
openWriter
java.io.Writer openWriter() throws java.io.IOExceptionGets a Writer for this file object.- Returns:
- a Writer
- Throws:
java.lang.IllegalStateException- if this file object was opened for reading and does not support writingjava.lang.UnsupportedOperationException- if this kind of file object does not support character accessjava.io.IOException- if an I/O error occurred
-
-