|
Groovy JDK |
Method Summary | |
---|---|
void
|
eachByte(Closure closure)
Reads the InputStream from this URL, passing each byte to the given closure. |
Object
|
eachLine(Closure closure)
Iterates through the lines read from the URL's associated input stream passing each line to the given 1 or 2 arg closure. |
Object
|
eachLine(int firstLine, Closure closure)
Iterates through the lines read from the URL's associated input stream passing each line to the given 1 or 2 arg closure. |
Object
|
eachLine(String charset, Closure closure)
Iterates through the lines read from the URL's associated input stream passing each line to the given 1 or 2 arg closure. |
Object
|
eachLine(String charset, int firstLine, Closure closure)
Iterates through the lines read from the URL's associated input stream passing each line to the given 1 or 2 arg closure. |
String
|
getText()
Read the content of this URL and returns it as a String. |
String
|
getText(String charset)
Read the data from this URL and return it as a String. |
BufferedInputStream
|
newInputStream()
Creates a buffered input stream for this URL. |
BufferedReader
|
newReader()
Creates a buffered reader for this URL. |
BufferedReader
|
newReader(String charset)
Creates a buffered reader for this URL using the given encoding. |
Object
|
withInputStream(Closure closure)
Creates a new InputStream for this URL and passes it into the closure. |
Object
|
withReader(Closure closure)
Helper method to create a new BufferedReader for a URL and then passes it to the closure. |
Object
|
withReader(String charset, Closure closure)
Helper method to create a new Reader for a URL and then passes it to the closure. |
Method Detail |
---|
public void eachByte(Closure closure)
closure
- closure to apply to each byte.public Object eachLine(Closure closure)
closure
- a closure to apply on each line.public Object eachLine(int firstLine, Closure closure)
firstLine
- the count of the first line.closure
- a closure to apply on each line.public Object eachLine(String charset, Closure closure)
charset
- opens the stream with a specified charset.closure
- a closure to apply on each line.public Object eachLine(String charset, int firstLine, Closure closure)
charset
- opens the stream with a specified charset.firstLine
- the count of the first line.closure
- a closure to apply on each line.public String getText()
public String getText(String charset)
charset
- opens the stream with a specified charset.public BufferedInputStream newInputStream()
public BufferedReader newReader()
public BufferedReader newReader(String charset)
charset
- opens the stream with a specified charset.public Object withInputStream(Closure closure)
closure
- a closure.public Object withReader(Closure closure)
closure
- the closure to invoke with the reader.public Object withReader(String charset, Closure closure)
charset
- the charset used.closure
- the closure to invoke with the reader.
|
Groovy JDK |