Package: org.codehaus.groovy.control.io

## [Java] Interface ReaderSource

- org.codehaus.groovy.control.HasCleanup

- All Superinterfaces:
    HasCleanup

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

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `boolean` | `canReopenSource()` Returns true if the source can be restarted (ie. if getReader() will return non-null on subsequent calls.
    `` | `void` | `cleanup()` Cleans up any cached resources used by getLine().
    `` | `String` | `getLine(int lineNumber, Janitor janitor)` Returns a line from the source, or null, if unavailable.
    `` | `Reader` | `getReader()` Returns a new Reader on the underlying source object.
    `` | `URI` | `getURI()` Returns a URI for this source.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `interface HasCleanup` | `cleanup`

- - ### Method Detail

    - #### public 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

    - #### public void cleanup()

      Cleans up any cached resources used by getLine().

    - #### public 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

    - #### public Reader getReader()

      Returns a new Reader on the underlying source object. Returns null if the source can't be reopened.

      throws:
        java.io.IOException if there was an error opening for stream
      Returns:
        the reader to the resource

    - #### public URI getURI()

      Returns a URI for this source.

      Since:
        2.3.0