Groovy 1.7.0

org.codehaus.groovy.control.io
Interface ReaderSource

org.codehaus.groovy.control.io.ReaderSource
  org.codehaus.groovy.control.HasCleanup
All Superinterfaces:
HasCleanup

interface ReaderSource
extends HasCleanup

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

author:
Chris Poirier
version:
$Id: ReaderSource.java 6778 2007-07-02 10:40:33Z glaforge $


Method Summary
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.

 
Methods inherited from interface HasCleanup
cleanup
 

Method Detail

canReopenSource

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


cleanup

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


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.
param:
lineNumber the number of the line of interest
param:
janitor helper to clean up afterwards
return:
the line of interest


getReader

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
return:
the reader to the resource


 

Copyright © 2003-2009 The Codehaus. All rights reserved.