Package io.micronaut.inject.writer
Interface GeneratedFile
public interface GeneratedFile
A common interface to allow referencing a generated file in either Groovy or Java.
- Since:
- 1.0
- Author:
- graemerocher
-
Method Summary
-
Method Details
-
toURI
URI toURI()The URI to write to.- Returns:
- The URI
-
getName
String getName()- Returns:
- The name of the file
-
openInputStream
Gets an InputStream for this file object.- Returns:
- an InputStream
- Throws:
IllegalStateException
- if this file object was opened for writing and does not support readingUnsupportedOperationException
- if this kind of file object does not support byte accessIOException
- if an I/O error occurred
-
openOutputStream
Gets an OutputStream for this file object.- Returns:
- an OutputStream
- Throws:
IllegalStateException
- if this file object was opened for reading and does not support writingUnsupportedOperationException
- if this kind of file object does not support byte accessIOException
- if an I/O error occurred
-
openReader
Gets 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 unlessignoreEncodingErrors
is true.- Returns:
- a Reader
- Throws:
IllegalStateException
- if this file object was opened for writing and does not support readingUnsupportedOperationException
- if this kind of file object does not support character accessIOException
- if an I/O error occurred
-
getTextContent
Gets 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 unlessignoreEncodingErrors
is true.- Returns:
- a CharSequence if available;
null
otherwise - Throws:
IllegalStateException
- if this file object was opened for writing and does not support readingUnsupportedOperationException
- if this kind of file object does not support character accessIOException
- if an I/O error occurred
-
openWriter
Gets a Writer for this file object.- Returns:
- a Writer
- Throws:
IllegalStateException
- if this file object was opened for reading and does not support writingUnsupportedOperationException
- if this kind of file object does not support character accessIOException
- if an I/O error occurred
-