Top Description Methods
org.codehaus.groovy.control.io

public Interface ReaderSource

extends HasCleanup
Known Direct Implementers
org.codehaus.groovy.control.io.AbstractReaderSource
Imports
org.codehaus.groovy.control.HasCleanup, .Janitor, java.io.IOException, .Reader, java.net.URI

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

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the resource can be reopened for reading
canReopenSource
()

Returns true if the source can be restarted (ie.

public void
cleanup()

Redeclares org.codehaus.groovy.control.HasCleanup.cleanup.

Cleans up any cached resources used by getLine().
public String

Returns:

the line of interest
getLine
(int
the number of the line of interest
lineNumber
,
Janitor
helper to clean up afterwards
janitor
)

Returns a line from the source, or null, if unavailable.

public Reader

Returns:

the reader to the resource
getReader
()

Returns a new Reader on the underlying source object.

public URI
getURI()

Returns a URI for this source.

Method Detail

canReopenSourceback to summary
public boolean canReopenSource()

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

Returns:boolean

true if the resource can be reopened for reading

cleanupback to summary
public void cleanup()

Redeclares org.codehaus.groovy.control.HasCleanup.cleanup.

Cleans up any cached resources used by getLine().

getLineback to summary
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:int

the number of the line of interest

janitor:Janitor

helper to clean up afterwards

Returns:String

the line of interest

getReaderback to summary
public Reader getReader() throws IOException

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

Returns:Reader

the reader to the resource

Exceptions
IOException:
if there was an error opening for stream
getURIback to summary
public URI getURI()

Returns a URI for this source.

Since
2.3.0