Return type | Name and parameters |
---|---|
void
|
eachByte(Closure closure)
Reads the InputStream from this URL, passing each byte to the given closure. |
void
|
eachByte(int bufferLen, Closure closure)
Reads the InputStream from this URL, passing a byte[] and a number of bytes 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. |
Writable
|
filterLine(Closure predicate)
Filter lines from a URL using a closure predicate. |
void
|
filterLine(Writer writer, Closure predicate)
Uses a closure to filter lines from this URL and pass them to the given writer. |
void
|
filterLine(Writer writer, String charset, Closure predicate)
Uses a closure to filter lines from this URL and pass them to the given writer. |
Writable
|
filterLine(String charset, Closure predicate)
Filter lines from a URL using a closure predicate. |
byte[]
|
getBytes()
Read the content of this URL and returns it as a byte[]. |
byte[]
|
getBytes(Map parameters)
Read the content of this URL and returns it as a byte[]. |
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. |
String
|
getText(Map parameters)
Read the content of this URL and returns it as a String. |
String
|
getText(Map parameters, String charset)
Read the data from this URL and return it as a String. |
BufferedInputStream
|
newInputStream()
Creates a buffered input stream for this URL. |
BufferedInputStream
|
newInputStream(Map parameters)
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. |
BufferedReader
|
newReader(Map parameters)
Creates a buffered reader for this URL. |
BufferedReader
|
newReader(Map parameters, String charset)
Creates a buffered reader for this URL using the given encoding. |
List
|
readLines()
Reads the URL contents into a list, with one element for each line. |
List
|
readLines(String charset)
Reads the URL contents into a list, with one element for each line. |
Object
|
splitEachLine(String regex, Closure closure)
Iterates through the input stream associated with this URL line by line, splitting each line using the given regex separator. |
Object
|
splitEachLine(String regex, String charset, Closure closure)
Iterates through the input stream associated with this URL line by line, splitting each line using the given regex separator. |
Object
|
splitEachLine(Pattern pattern, Closure closure)
Iterates through the input stream associated with this URL line by line, splitting each line using the given regex separator Pattern. |
Object
|
splitEachLine(Pattern pattern, String charset, Closure closure)
Iterates through the input stream associated with this URL line by line, splitting each line using the given regex separator Pattern. |
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. |
addShutdownHook
, any
, any
, asBoolean
, asType
, collect
, collect
, collect
, dump
, each
, eachMatch
, eachMatch
, eachWithIndex
, every
, every
, find
, find
, findAll
, findAll
, findIndexOf
, findIndexOf
, findIndexValues
, findIndexValues
, findLastIndexOf
, findLastIndexOf
, findResult
, findResult
, findResult
, findResult
, getAt
, getMetaClass
, getMetaPropertyValues
, getProperties
, grep
, grep
, hasProperty
, identity
, inject
, inject
, inspect
, invokeMethod
, is
, isCase
, isNotCase
, iterator
, metaClass
, print
, print
, printf
, printf
, println
, println
, println
, putAt
, respondsTo
, respondsTo
, setMetaClass
, split
, sprintf
, sprintf
, stream
, tap
, toString
, use
, use
, use
, with
, with
, withCloseable
, withMethodClosure
, withStream
, withTraits
Reads the InputStream from this URL, passing each byte to the given closure. The URL stream will be closed before this method returns.
closure
- closure to apply to each byteReads the InputStream from this URL, passing a byte[] and a number of bytes to the given closure. The URL stream will be closed before this method returns.
bufferLen
- the length of the buffer to use.closure
- a 2 parameter closure which is passed the byte[] and a number of bytes successfully read.Iterates through the lines read from the URL's associated input stream passing each line to the given 1 or 2 arg closure. The stream is closed before this method returns.
closure
- a closure to apply on each line (arg 1 is line, optional arg 2 is line number starting at line 1)Iterates through the lines read from the URL's associated input stream passing each line to the given 1 or 2 arg closure. The stream is closed before this method returns.
firstLine
- the line number value used for the first line (default is 1, set to 0 to start counting from 0)closure
- a closure to apply on each line (arg 1 is line, optional arg 2 is line number)Iterates through the lines read from the URL's associated input stream passing each line to the given 1 or 2 arg closure. The stream is closed before this method returns.
charset
- opens the stream with a specified charsetclosure
- a closure to apply on each line (arg 1 is line, optional arg 2 is line number starting at line 1)Iterates through the lines read from the URL's associated input stream passing each line to the given 1 or 2 arg closure. The stream is closed before this method returns.
charset
- opens the stream with a specified charsetfirstLine
- the line number value used for the first line (default is 1, set to 0 to start counting from 0)closure
- a closure to apply on each line (arg 1 is line, optional arg 2 is line number)Filter lines from a URL using a closure predicate. The closure
will be passed each line as a String, and it should return
true
if the line should be passed to the writer.
predicate
- a closure which returns boolean and takes a lineUses a closure to filter lines from this URL and pass them to
the given writer. The closure will be passed each line as a String, and
it should return true
if the line should be passed to the
writer.
writer
- a writer to write output topredicate
- a closure which returns true if a line should be acceptedUses a closure to filter lines from this URL and pass them to
the given writer. The closure will be passed each line as a String, and
it should return true
if the line should be passed to the
writer.
writer
- a writer to write output tocharset
- opens the URL with a specified charsetpredicate
- a closure which returns true if a line should be acceptedFilter lines from a URL using a closure predicate. The closure
will be passed each line as a String, and it should return
true
if the line should be passed to the writer.
charset
- opens the URL with a specified charsetpredicate
- a closure which returns boolean and takes a lineRead the content of this URL and returns it as a byte[].
Read the content of this URL and returns it as a byte[]. The default connection parameters can be modified by adding keys to the parameters map:
parameters
- connection parametersRead the content of this URL and returns it as a String.
Read the data from this URL and return it as a String. The connection stream is closed before this method returns.
charset
- opens the stream with a specified charsetRead the content of this URL and returns it as a String. The default connection parameters can be modified by adding keys to the parameters map:
parameters
- connection parametersRead the data from this URL and return it as a String. The connection stream is closed before this method returns.
parameters
- connection parameterscharset
- opens the stream with a specified charsetCreates a buffered input stream for this URL.
Creates a buffered input stream for this URL. The default connection parameters can be modified by adding keys to the parameters map:
parameters
- connection parametersCreates a buffered reader for this URL.
Creates a buffered reader for this URL using the given encoding.
charset
- opens the stream with a specified charsetCreates a buffered reader for this URL. The default connection parameters can be modified by adding keys to the parameters map:
parameters
- connection parametersCreates a buffered reader for this URL using the given encoding.
parameters
- connection parameterscharset
- opens the stream with a specified charsetReads the URL contents into a list, with one element for each line.
Reads the URL contents into a list, with one element for each line.
charset
- opens the URL with a specified charsetIterates through the input stream associated with this URL line by line, splitting each line using the given regex separator. For each line, the given closure is called with a single parameter being the list of strings computed by splitting the line around matches of the given regular expression. Finally the resources used for processing the URL are closed.
regex
- the delimiting regular expressionclosure
- a closureIterates through the input stream associated with this URL line by line, splitting each line using the given regex separator. For each line, the given closure is called with a single parameter being the list of strings computed by splitting the line around matches of the given regular expression. Finally the resources used for processing the URL are closed.
regex
- the delimiting regular expressioncharset
- opens the file with a specified charsetclosure
- a closureIterates through the input stream associated with this URL line by line, splitting each line using the given regex separator Pattern. For each line, the given closure is called with a single parameter being the list of strings computed by splitting the line around matches of the given regular expression. Finally the resources used for processing the URL are closed.
pattern
- the regular expression Pattern for the delimiterclosure
- a closureIterates through the input stream associated with this URL line by line, splitting each line using the given regex separator Pattern. For each line, the given closure is called with a single parameter being the list of strings computed by splitting the line around matches of the given regular expression. Finally the resources used for processing the URL are closed.
pattern
- the regular expression Pattern for the delimitercharset
- opens the file with a specified charsetclosure
- a closureCreates a new InputStream for this URL and passes it into the closure. This method ensures the stream is closed after the closure returns.
closure
- a closureHelper method to create a new BufferedReader for a URL and then passes it to the closure. The reader is closed after the closure returns.
closure
- the closure to invoke with the readerHelper method to create a new Reader for a URL and then passes it to the closure. The reader is closed after the closure returns.
charset
- the charset usedclosure
- the closure to invoke with the reader