org.codehaus.groovy.control.io

## Interface ReaderSource

- All Superinterfaces:
    HasCleanup
  All Known Implementing Classes:
    AbstractReaderSource, FileReaderSource, InputStreamReaderSource, StringReaderSource, URLReaderSource

      public interface ReaderSource
      extends HasCleanup

  An interface for things that can supply (and potentially resupply) a Reader on a source stream.
  Author:
    Chris Poirier

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `canReopenSource()` Returns true if the source can be restarted (ie.
    `void` | `cleanup()` Cleans up any cached resources used by getLine().
    `java.lang.String` | `getLine(int lineNumber, Janitor janitor)` Returns a line from the source, or null, if unavailable.
    `java.io.Reader` | `getReader()` Returns a new Reader on the underlying source object.
    `java.net.URI` | `getURI()` Returns a URI for this source.

- - ### Method Detail

    - #### getReader

          java.io.Reader getReader()
                            throws java.io.IOException

      Returns a new Reader on the underlying source object. Returns null if the source can't be reopened.
      Returns:
        the reader to the resource
      Throws:
        `java.io.IOException` - if there was an error opening for stream

    - #### canReopenSource

          boolean canReopenSource()

      Returns true if the source can be restarted (ie. if getReader() will return non-null on subsequent calls.
      Returns:
        true if the resource can be reopened for reading

    - #### getLine

          java.lang.String getLine(int lineNumber,
                                   Janitor janitor)

      Returns a line from the source, or null, if unavailable. If you supply a Janitor, resources will be cached.
      Parameters:
        `lineNumber` - the number of the line of interest
        `janitor` - helper to clean up afterwards
      Returns:
        the line of interest

    - #### cleanup

          void cleanup()

      Cleans up any cached resources used by getLine().
      Specified by:
        `cleanup` in interface `HasCleanup`

    - #### getURI

          java.net.URI getURI()

      Returns a URI for this source.
      Since:
        2.3.0