Interface GeneratedFile


  • public interface GeneratedFile
    A 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.String getName()  
      java.lang.CharSequence getTextContent()
      Gets the character content of this file object, if available.
      java.io.InputStream openInputStream()
      Gets an InputStream for this file object.
      java.io.OutputStream openOutputStream()
      Gets an OutputStream for this file object.
      java.io.Reader openReader()
      Gets a reader for this object.
      java.io.Writer openWriter()
      Gets a Writer for this file object.
      java.net.URI toURI()
      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.IOException
        Gets 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 reading
        java.lang.UnsupportedOperationException - if this kind of file object does not support byte access
        java.io.IOException - if an I/O error occurred
      • openOutputStream

        java.io.OutputStream openOutputStream()
                                       throws java.io.IOException
        Gets 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 writing
        java.lang.UnsupportedOperationException - if this kind of file object does not support byte access
        java.io.IOException - if an I/O error occurred
      • openReader

        java.io.Reader openReader()
                           throws java.io.IOException
        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 unless ignoreEncodingErrors is true.
        Returns:
        a Reader
        Throws:
        java.lang.IllegalStateException - if this file object was opened for writing and does not support reading
        java.lang.UnsupportedOperationException - if this kind of file object does not support character access
        java.io.IOException - if an I/O error occurred
      • getTextContent

        java.lang.CharSequence getTextContent()
                                       throws java.io.IOException
        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 unless ignoreEncodingErrors is true.
        Returns:
        a CharSequence if available; null otherwise
        Throws:
        java.lang.IllegalStateException - if this file object was opened for writing and does not support reading
        java.lang.UnsupportedOperationException - if this kind of file object does not support character access
        java.io.IOException - if an I/O error occurred
      • openWriter

        java.io.Writer openWriter()
                           throws java.io.IOException
        Gets 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 writing
        java.lang.UnsupportedOperationException - if this kind of file object does not support character access
        java.io.IOException - if an I/O error occurred