Groovy JDK methods
New methods added to the JDK to make it more groovy.
byte[]groovy.lang.Writable | encodeBase64() |
java.lang.Object | getAt(int idx) |
java.lang.Object | getAt(groovy.lang.Range range) |
java.lang.Object | getAt(java.util.Collection indices) |
void | putAt(int idx, java.lang.Object newValue) |
int | size() |
java.util.List | toList() |
char[]java.lang.Object | getAt(int idx) |
java.lang.Object | getAt(groovy.lang.Range range) |
java.lang.Object | getAt(java.util.Collection indices) |
void | putAt(int idx, java.lang.Object newValue) |
int | size() |
java.util.List | toList() |
double[]java.lang.Object | getAt(int idx) |
java.lang.Object | getAt(groovy.lang.Range range) |
java.lang.Object | getAt(java.util.Collection indices) |
void | putAt(int idx, java.lang.Object newValue) |
int | size() |
java.util.List | toList() |
float[]java.lang.Object | getAt(int idx) |
java.lang.Object | getAt(groovy.lang.Range range) |
java.lang.Object | getAt(java.util.Collection indices) |
void | putAt(int idx, java.lang.Object newValue) |
int | size() |
java.util.List | toList() |
int[]java.lang.Object | getAt(int idx) |
java.lang.Object | getAt(groovy.lang.Range range) |
java.lang.Object | getAt(java.util.Collection indices) |
void | putAt(int idx, java.lang.Object newValue) |
int | size() |
java.util.List | toList() |
java.io.BufferedReaderjava.lang.String | getText() |
java.io.BufferedWritervoid | writeLine(java.lang.String line) |
java.io.Filevoid | append(java.lang.String text) |
void | append(java.lang.String text, java.lang.String charset) |
java.io.File | asWritable() |
java.io.File | asWritable(java.lang.String encoding) |
void | eachByte(groovy.lang.Closure closure) |
void | eachFile(groovy.lang.Closure closure) |
void | eachFileRecurse(groovy.lang.Closure closure) |
void | eachLine(groovy.lang.Closure closure) |
groovy.lang.Writable | filterLine(groovy.lang.Closure closure) |
void | filterLine(java.io.Writer writer, groovy.lang.Closure closure) |
java.lang.String | getText(java.lang.String charset) |
java.lang.String | getText() |
java.io.BufferedInputStream | newInputStream() |
java.io.BufferedOutputStream | newOutputStream() |
java.io.PrintWriter | newPrintWriter() |
java.io.PrintWriter | newPrintWriter(java.lang.String charset) |
java.io.BufferedReader | newReader() |
java.io.BufferedReader | newReader(java.lang.String charset) |
java.io.BufferedWriter | newWriter() |
java.io.BufferedWriter | newWriter(boolean append) |
java.io.BufferedWriter | newWriter(java.lang.String charset, boolean append) |
java.io.BufferedWriter | newWriter(java.lang.String charset) |
byte[] | readBytes() |
java.util.List | readLines() |
void | splitEachLine(java.lang.String sep, groovy.lang.Closure closure) |
void | withInputStream(groovy.lang.Closure closure) |
void | withOutputStream(groovy.lang.Closure closure) |
void | withPrintWriter(groovy.lang.Closure closure) |
void | withReader(groovy.lang.Closure closure) |
void | withWriter(groovy.lang.Closure closure) |
void | withWriter(java.lang.String charset, groovy.lang.Closure closure) |
void | withWriterAppend(java.lang.String charset, groovy.lang.Closure closure) |
void | write(java.lang.String text) |
void | write(java.lang.String text, java.lang.String charset) |
java.io.InputStreamvoid | eachByte(groovy.lang.Closure closure) |
void | eachLine(groovy.lang.Closure closure) |
groovy.lang.Writable | filterLine(groovy.lang.Closure predicate) |
void | filterLine(java.io.Writer writer, groovy.lang.Closure predicate) |
java.lang.String | getText() |
java.lang.String | getText(java.lang.String charset) |
java.io.BufferedReader | newReader() |
java.lang.String | readLine() |
java.util.List | readLines() |
void | withReader(groovy.lang.Closure closure) |
void | withStream(groovy.lang.Closure closure) |
java.io.OutputStreamjava.io.Writer | leftShift(java.lang.Object value) |
java.io.OutputStream | leftShift(byte[] value) |
void | withStream(groovy.lang.Closure closure) |
void | withWriter(groovy.lang.Closure closure) |
void | withWriter(java.lang.String charset, groovy.lang.Closure closure) |
java.io.Readervoid | eachLine(groovy.lang.Closure closure) |
void | filterLine(java.io.Writer writer, groovy.lang.Closure closure) |
groovy.lang.Writable | filterLine(groovy.lang.Closure closure) |
java.lang.String | getText() |
java.lang.String | readLine() |
java.util.List | readLines() |
void | splitEachLine(java.lang.String sep, groovy.lang.Closure closure) |
void | transformChar(java.io.Writer writer, groovy.lang.Closure closure) |
void | transformLine(java.io.Writer writer, groovy.lang.Closure closure) |
void | withReader(groovy.lang.Closure closure) |
java.io.Writerjava.io.Writer | leftShift(java.lang.Object value) |
void | withWriter(groovy.lang.Closure closure) |
void | write(groovy.lang.Writable writable) |
java.lang.Byte[]groovy.lang.Writable | encodeBase64() |
java.lang.CharSequencejava.lang.CharSequence | getAt(int index) |
java.lang.CharSequence | getAt(groovy.lang.Range range) |
java.lang.CharSequence | getAt(java.util.Collection indices) |
java.lang.Characterint | compareTo(java.lang.Number right) |
int | compareTo(java.lang.Character right) |
java.lang.Number | div(java.lang.Number right) |
java.lang.Number | div(java.lang.Character right) |
java.lang.Number | intdiv(java.lang.Number right) |
java.lang.Number | intdiv(java.lang.Character right) |
java.lang.Number | minus(java.lang.Number right) |
java.lang.Number | minus(java.lang.Character right) |
java.lang.Number | multiply(java.lang.Number right) |
java.lang.Number | multiply(java.lang.Character right) |
java.lang.Number | next() |
java.lang.Number | plus(java.lang.Number right) |
java.lang.Number | plus(java.lang.Character right) |
java.lang.Number | previous() |
java.lang.Classboolean | isCase(java.lang.Object switchValue) |
java.lang.Doublejava.lang.Floatjava.lang.Longjava.lang.Numberint | abs() |
java.lang.Number | and(java.lang.Number right) |
int | compareTo(java.lang.Character right) |
int | compareTo(java.lang.Number right) |
java.lang.Number | div(java.lang.Character right) |
java.lang.Number | div(java.lang.Number right) |
java.lang.Number | intdiv(java.lang.Character right) |
java.lang.Number | intdiv(java.lang.Number right) |
java.lang.Number | leftShift(java.lang.Number right) |
java.lang.Number | minus(java.lang.Character right) |
java.lang.Number | minus(java.lang.Number right) |
java.lang.Number | mod(java.lang.Number right) |
java.lang.Number | multiply(java.lang.Character right) |
java.lang.Number | multiply(java.lang.Number right) |
java.lang.Number | negate() |
java.lang.Number | next() |
java.lang.Number | or(java.lang.Number right) |
java.lang.String | plus(java.lang.String right) |
java.lang.Number | plus(java.lang.Character right) |
java.lang.Number | plus(java.lang.Number right) |
java.lang.Number | power(java.lang.Number exponent) |
java.lang.Number | previous() |
java.lang.Number | rightShift(java.lang.Number right) |
java.lang.Number | rightShiftUnsigned(java.lang.Number right) |
void | step(java.lang.Number to, java.lang.Number stepNumber, groovy.lang.Closure closure) |
void | times(groovy.lang.Closure closure) |
java.lang.Integer | toInteger() |
void | upto(java.lang.Number to, groovy.lang.Closure closure) |
java.lang.Objectjava.util.List | allProperties() |
boolean | any(groovy.lang.Closure closure) |
java.util.List | collect(groovy.lang.Closure closure) |
java.util.Collection | collect(java.util.Collection collection, groovy.lang.Closure closure) |
java.lang.String | dump() |
void | each(groovy.lang.Closure closure) |
void | eachProperty(groovy.lang.Closure closure) |
void | eachPropertyName(groovy.lang.Closure closure) |
void | eachWithIndex(groovy.lang.Closure closure) |
boolean | every(groovy.lang.Closure closure) |
java.lang.Object | find(groovy.lang.Closure closure) |
java.util.List | findAll(groovy.lang.Closure closure) |
int | findIndexOf(groovy.lang.Closure closure) |
java.lang.Object | getAt(java.lang.String property) |
java.util.List | grep(java.lang.Object filter) |
java.lang.String | inspect() |
java.lang.Object | invokeMethod(java.lang.String method, java.lang.Object arguments) |
boolean | isCase(java.lang.Object switchValue) |
void | print(java.lang.Object value) |
void | print(java.io.PrintWriter out) |
void | println(java.lang.Object value) |
void | println(java.io.PrintWriter out) |
void | putAt(java.lang.String property, java.lang.Object newValue) |
void | use(java.lang.Class categoryClass, groovy.lang.Closure closure) |
void | use(java.util.List categoryClassList, groovy.lang.Closure closure) |
java.lang.Object[]java.util.List | getAt(java.util.Collection indices) |
java.util.List | getAt(groovy.lang.Range range) |
java.lang.Object | getAt(int idx) |
java.lang.String | join(java.lang.String separator) |
void | putAt(int idx, java.lang.Object value) |
int | size() |
java.util.List | toList() |
java.lang.Processjava.io.InputStream | getErr() |
java.io.InputStream | getIn() |
java.io.OutputStream | getOut() |
java.lang.String | getText() |
java.io.Writer | leftShift(java.lang.Object value) |
java.io.OutputStream | leftShift(byte[] value) |
void | waitForOrKill(long numberOfMillis) |
java.lang.Stringjava.lang.String | center(java.lang.Number numberOfChars, java.lang.String padding) |
java.lang.String | center(java.lang.Number numberOfChars) |
boolean | contains(java.lang.String text) |
int | count(java.lang.String text) |
byte[] | decodeBase64() |
void | eachMatch(java.lang.String regex, groovy.lang.Closure closure) |
java.lang.Process | execute() |
java.lang.String | getAt(int index) |
java.lang.String | getAt(groovy.lang.Range range) |
java.lang.String | getAt(java.util.Collection indices) |
boolean | isCase(java.lang.Object switchValue) |
java.io.StringWriter | leftShift(java.lang.Object value) |
java.lang.String | minus(java.lang.Object value) |
java.lang.String | multiply(java.lang.Number factor) |
java.lang.String | next() |
java.lang.String | padLeft(java.lang.Number numberOfChars, java.lang.String padding) |
java.lang.String | padLeft(java.lang.Number numberOfChars) |
java.lang.String | padRight(java.lang.Number numberOfChars, java.lang.String padding) |
java.lang.String | padRight(java.lang.Number numberOfChars) |
java.lang.String | plus(java.lang.Object value) |
java.lang.String | previous() |
java.lang.String | reverse() |
int | size() |
java.lang.Character | toCharacter() |
java.lang.Double | toDouble() |
java.lang.Float | toFloat() |
java.lang.Integer | toInteger() |
java.util.List | toList() |
java.lang.Long | toLong() |
java.net.URL | toURL() |
java.util.List | tokenize(java.lang.String token) |
java.util.List | tokenize() |
java.lang.StringBufferjava.io.Writer | leftShift(java.lang.Object value) |
java.lang.String | plus(java.lang.String value) |
java.net.ServerSocketjava.net.Socket | accept(groovy.lang.Closure closure) |
java.net.Socketjava.io.Writer | leftShift(java.lang.Object value) |
java.io.OutputStream | leftShift(byte[] value) |
void | withStreams(groovy.lang.Closure closure) |
java.net.URLvoid | eachByte(groovy.lang.Closure closure) |
void | eachLine(groovy.lang.Closure closure) |
java.lang.String | getText() |
java.lang.String | getText(java.lang.String charset) |
void | withReader(groovy.lang.Closure closure) |
java.util.Collectionjava.util.Collection | asImmutable() |
java.util.List | asList() |
java.util.Collection | asSynchronized() |
java.util.List | collect(groovy.lang.Closure closure) |
java.util.Collection | collect(java.util.Collection collection, groovy.lang.Closure closure) |
int | count(java.lang.Object value) |
void | each(groovy.lang.Closure closure) |
java.lang.Object | find(groovy.lang.Closure closure) |
java.util.List | findAll(groovy.lang.Closure closure) |
java.util.List | getAt(java.lang.String property) |
java.lang.Object | inject(java.lang.Object value, groovy.lang.Closure closure) |
boolean | isCase(java.lang.Object switchValue) |
java.lang.String | join(java.lang.String separator) |
java.util.Collection | leftShift(java.lang.Object value) |
java.lang.Object | max() |
java.lang.Object | max(java.util.Comparator comparator) |
java.lang.Object | max(groovy.lang.Closure closure) |
java.lang.Object | min() |
java.lang.Object | min(java.util.Comparator comparator) |
java.lang.Object | min(groovy.lang.Closure closure) |
java.util.List | multiply(java.lang.Number factor) |
java.util.List | plus(java.util.Collection right) |
java.util.List | plus(java.lang.Object right) |
java.util.List | sort() |
java.util.List | sort(java.util.Comparator comparator) |
java.util.List | sort(groovy.lang.Closure closure) |
java.util.List | toList() |
java.util.Datejava.util.Date | minus(int days) |
java.util.Date | next() |
java.util.Date | plus(int days) |
java.util.Date | previous() |
java.util.Listjava.util.List | asImmutable() |
java.util.List | asSynchronized() |
java.util.List | flatten() |
java.util.List | getAt(groovy.lang.Range range) |
java.util.List | getAt(java.util.Collection indices) |
java.lang.Object | getAt(int idx) |
java.util.List | intersect(java.util.Collection right) |
java.util.List | minus(java.util.Collection removeMe) |
java.lang.Object | pop() |
void | putAt(int idx, java.lang.Object value) |
java.util.List | reverse() |
void | reverseEach(groovy.lang.Closure closure) |
java.util.List | sort() |
java.util.List | sort(java.util.Comparator comparator) |
java.util.List | sort(groovy.lang.Closure closure) |
java.util.Mapjava.util.Map | asImmutable() |
java.util.Map | asSynchronized() |
java.util.Collection | collect(java.util.Collection collection, groovy.lang.Closure closure) |
java.util.List | collect(groovy.lang.Closure closure) |
void | each(groovy.lang.Closure closure) |
java.lang.Object | find(groovy.lang.Closure closure) |
java.util.List | findAll(groovy.lang.Closure closure) |
java.lang.Object | get(java.lang.Object key, java.lang.Object defaultValue) |
java.lang.Object | getAt(java.lang.Object key) |
java.lang.Object | putAt(java.lang.Object key, java.lang.Object value) |
java.util.Map | subMap(java.util.Collection keys) |
java.util.Setjava.util.Set | asImmutable() |
java.util.Set | asSynchronized() |
java.util.SortedMapjava.util.SortedMap | asImmutable() |
java.util.SortedMap | asSynchronized() |
java.util.SortedSetjava.util.SortedSet | asImmutable() |
java.util.SortedSet | asSynchronized() |
java.util.SortedSet | sort() |
java.util.regex.Matchervoid | each(groovy.lang.Closure closure) |
java.lang.String | getAt(int idx) |
java.lang.String | getAt(java.util.Collection indices) |
java.util.regex.Patternboolean | isCase(java.lang.Object switchValue) |
long[]java.lang.Object | getAt(int idx) |
java.lang.Object | getAt(groovy.lang.Range range) |
java.lang.Object | getAt(java.util.Collection indices) |
void | putAt(int idx, java.lang.Object newValue) |
int | size() |
java.util.List | toList() |
short[]java.lang.Object | getAt(int idx) |
java.lang.Object | getAt(groovy.lang.Range range) |
java.lang.Object | getAt(java.util.Collection indices) |
void | putAt(int idx, java.lang.Object newValue) |
int | size() |
java.util.List | toList() |
byte[]
groovy.lang.Writable encodeBase64()
Produce a Writable object which writes the base64 encoding of the byte array Calling toString() on the result rerurns the encoding as a String - returns: groovy.lang.Writable - object which will write the base64 encoding of the byte array
java.lang.Object getAt(int idx)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.Range range)
- returns: java.lang.Object
java.lang.Object getAt(java.util.Collection indices)
- returns: java.lang.Object
void putAt(int idx, java.lang.Object newValue)
int size()
java.util.List toList()
char[]
java.lang.Object getAt(int idx)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.Range range)
- returns: java.lang.Object
java.lang.Object getAt(java.util.Collection indices)
- returns: java.lang.Object
void putAt(int idx, java.lang.Object newValue)
int size()
java.util.List toList()
double[]
java.lang.Object getAt(int idx)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.Range range)
- returns: java.lang.Object
java.lang.Object getAt(java.util.Collection indices)
- returns: java.lang.Object
void putAt(int idx, java.lang.Object newValue)
int size()
java.util.List toList()
float[]
java.lang.Object getAt(int idx)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.Range range)
- returns: java.lang.Object
java.lang.Object getAt(java.util.Collection indices)
- returns: java.lang.Object
void putAt(int idx, java.lang.Object newValue)
int size()
java.util.List toList()
int[]
java.lang.Object getAt(int idx)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.Range range)
- returns: java.lang.Object
java.lang.Object getAt(java.util.Collection indices)
- returns: java.lang.Object
void putAt(int idx, java.lang.Object newValue)
int size()
java.util.List toList()
java.io.BufferedReader
java.lang.String getText()
Reads the content of the BufferedReader and returns it as a String - returns: java.lang.String - a String containing the content of the buffered reader
- throws: java.io.IOException - IOException
java.io.BufferedWriter
void writeLine(java.lang.String line)
Write the text and append a new line (depending on the platform line-ending) - param line the line to write
- throws: java.io.IOException - IOException
java.io.File
void append(java.lang.String text)
Append the text at the end of the File - param text the text to append at the end of the File
- throws: java.io.IOException - IOException
void append(java.lang.String text, java.lang.String charset)
Append the text at the end of the File with a specified encoding - param text the text to append at the end of the File
- param charset the charset used
- throws: java.io.IOException - IOException
java.io.File asWritable()
- returns: java.io.File - a File which wraps the input file and which implements Writable
java.io.File asWritable(java.lang.String encoding)
- param encoding the encoding to be used when reading the file's contents
- returns: java.io.File - File which wraps the input file and which implements Writable
void eachByte(groovy.lang.Closure closure)
Traverse through each byte of the specified File - param closure a closure
- throws: java.io.IOException
void eachFile(groovy.lang.Closure closure)
Invokes the closure for each file in the given directory
void eachFileRecurse(groovy.lang.Closure closure)
Invokes the closure for each file in the given directory and recursively. It is a depth-first exploration, directories are included in the search.
void eachLine(groovy.lang.Closure closure)
Iterates through the given file line by line - param closure a closure
- throws: java.io.IOException - IOException
groovy.lang.Writable filterLine(groovy.lang.Closure closure)
Filters the lines of a File and creates a Writeable in return to stream the filtered lines - param closure a closure which returns a boolean indicating to filter the line or not
- returns: groovy.lang.Writable - a Writable closure
- throws: java.io.IOException - IOException if <code>self</code> is not readable
void filterLine(java.io.Writer writer, groovy.lang.Closure closure)
Filter the lines from a File and write them on a writer, according to a closure which returns true or false - param writer a writer
- param closure a closure which returns a boolean value and takes a line as input
- throws: java.io.IOException - IOException if <code>self</code> is not readable
java.lang.String getText(java.lang.String charset)
Reads the content of the File opened with the specified encoding and returns it as a String - param charset the charset used to read the content of the file
- returns: java.lang.String - a String containing the content of the file
- throws: java.io.IOException - IOException
java.lang.String getText()
Reads the content of the File and returns it as a String - returns: java.lang.String - a String containing the content of the file
- throws: java.io.IOException - IOException
java.io.BufferedInputStream newInputStream()
Helper method to create a buffered input stream for a file - returns: java.io.BufferedInputStream - a BufferedInputStream of the file
- throws: java.io.FileNotFoundException - FileNotFoundException
java.io.BufferedOutputStream newOutputStream()
Helper method to create a buffered output stream for a file - returns: java.io.BufferedOutputStream -
- throws: java.io.IOException - FileNotFoundException
java.io.PrintWriter newPrintWriter()
Helper method to create a new PrintWriter for a file - returns: java.io.PrintWriter
- throws: java.io.IOException - FileNotFoundException
java.io.PrintWriter newPrintWriter(java.lang.String charset)
Helper method to create a new PrintWriter for a file with a specified charset - param charset the charset
- returns: java.io.PrintWriter - a PrintWriter
- throws: java.io.IOException - FileNotFoundException
java.io.BufferedReader newReader()
Helper method to create a buffered reader for a file - returns: java.io.BufferedReader - a BufferedReader
- throws: java.io.IOException - IOException
java.io.BufferedReader newReader(java.lang.String charset)
Helper method to create a buffered reader for a file, with a specified charset - param charset the charset with which we want to write in the File
- returns: java.io.BufferedReader - a BufferedReader
- throws: java.io.FileNotFoundException - FileNotFoundException if the File was not found
- throws: java.io.UnsupportedEncodingException - FileNotFoundException if the File was not found
java.io.BufferedWriter newWriter()
Helper method to create a buffered writer for a file - returns: java.io.BufferedWriter - a BufferedWriter
- throws: java.io.IOException - FileNotFoundException
java.io.BufferedWriter newWriter(boolean append)
Helper method to create a buffered writer for a file in append mode - param append true if in append mode
- returns: java.io.BufferedWriter - a BufferedWriter
- throws: java.io.IOException - FileNotFoundException
java.io.BufferedWriter newWriter(java.lang.String charset, boolean append)
Helper method to create a buffered writer for a file - param charset the name of the encoding used to write in this file
- param append true if in append mode
- returns: java.io.BufferedWriter - a BufferedWriter
- throws: java.io.IOException - FileNotFoundException
java.io.BufferedWriter newWriter(java.lang.String charset)
Helper method to create a buffered writer for a file - param charset the name of the encoding used to write in this file
- returns: java.io.BufferedWriter - a BufferedWriter
- throws: java.io.IOException - FileNotFoundException
byte[] readBytes()
Reads the content of the file into an array of byte - returns: byte[] - a List of Bytes
- throws: java.io.IOException
java.util.List readLines()
Reads the file into a list of Strings for each line - returns: java.util.List - a List of lines
- throws: java.io.IOException - IOException
void splitEachLine(java.lang.String sep, groovy.lang.Closure closure)
Iterates through the given file line by line, splitting on the seperator - param sep a String separator
- param closure a closure
- throws: java.io.IOException - IOException
void withInputStream(groovy.lang.Closure closure)
Helper method to create a new InputStream for a file and then passes it into the closure and ensures its closed again afterwords - throws: java.io.IOException - FileNotFoundException
void withOutputStream(groovy.lang.Closure closure)
Helper method to create a new OutputStream for a file and then passes it into the closure and ensures its closed again afterwords - throws: java.io.IOException - FileNotFoundException
void withPrintWriter(groovy.lang.Closure closure)
Helper method to create a new PrintWriter for a file and then passes it into the closure and ensures its closed again afterwords - throws: java.io.IOException - FileNotFoundException
void withReader(groovy.lang.Closure closure)
Helper method to create a new BufferedReader for a file and then passes it into the closure and ensures its closed again afterwords - throws: java.io.IOException - FileNotFoundException
void withWriter(groovy.lang.Closure closure)
Helper method to create a new BufferedWriter for a file and then passes it into the closure and ensures it is closed again afterwords - param closure a closure
- throws: java.io.IOException - FileNotFoundException
void withWriter(java.lang.String charset, groovy.lang.Closure closure)
Helper method to create a new BufferedWriter for a file in a specified encoding and then passes it into the closure and ensures it is closed again afterwords - param charset the charset used
- param closure a closure
- throws: java.io.IOException - FileNotFoundException
void withWriterAppend(java.lang.String charset, groovy.lang.Closure closure)
Helper method to create a new BufferedWriter for a file in a specified encoding in append mode and then passes it into the closure and ensures it is closed again afterwords - param charset the charset used
- param closure a closure
- throws: java.io.IOException - FileNotFoundException
void write(java.lang.String text)
Write the text to the File. - param text the text to write to the File
- throws: java.io.IOException - IOException
void write(java.lang.String text, java.lang.String charset)
Write the text to the File with a specified encoding. - param text the text to write to the File
- param charset the charset used
- throws: java.io.IOException - IOException
java.io.InputStream
void eachByte(groovy.lang.Closure closure)
Traverse through each byte of the specified stream - param closure closure to apply to each byte
- throws: java.io.IOException - IOException
void eachLine(groovy.lang.Closure closure)
Iterates through the given stream line by line - param closure a closure
- throws: java.io.IOException - IOException
groovy.lang.Writable filterLine(groovy.lang.Closure predicate)
Filter lines from an input stream using a closure predicate - param predicate a closure which returns boolean and takes a line
- returns: groovy.lang.Writable - a filtered writer
void filterLine(java.io.Writer writer, groovy.lang.Closure predicate)
Filters lines from an input stream, writing to a writer, using a closure which returns boolean and takes a line. - param writer a writer to write output to
- param predicate a closure which returns a boolean and takes a line as input
- throws: java.io.IOException
java.lang.String getText()
Reads the content of this InputStream and returns it as a String - returns: java.lang.String - the text from that URL
- throws: java.io.IOException - IOException
java.lang.String getText(java.lang.String charset)
Reads the content of this InputStream with a specified charset and returns it as a String - param charset opens the stream with a specified charset
- returns: java.lang.String - the text from that URL
- throws: java.io.IOException - IOException
java.io.BufferedReader newReader()
Provides a reader for an arbitrary input stream - returns: java.io.BufferedReader - a reader
java.lang.String readLine()
Read a single, whole line from the given InputStream - returns: java.lang.String - a line
- throws: java.io.IOException - IOException
java.util.List readLines()
Reads the stream into a list of Strings for each line - returns: java.util.List - a List of lines
- throws: java.io.IOException - IOException
void withReader(groovy.lang.Closure closure)
Helper method to create a new BufferedReader for a stream and then passes it into the closure and ensures its closed again afterwords - throws: java.io.IOException - FileNotFoundException
void withStream(groovy.lang.Closure closure)
Allows a InputStream to be used, calling the closure with the stream and then ensuring that the stream is closed down again irrespective of whether exceptions occur or the - param closure the closure that the stream is passed into
- throws: java.io.IOException - IOException
java.io.OutputStream
java.io.Writer leftShift(java.lang.Object value)
Overloads the left shift operator to provide an append mechanism to add things to a stream - param value a value to append
- returns: java.io.Writer - a Writer
- throws: java.io.IOException
java.io.OutputStream leftShift(byte[] value)
Overloads the left shift operator to provide an append mechanism to add bytes to a stream - param value a value to append
- returns: java.io.OutputStream - an OutputStream
- throws: java.io.IOException
void withStream(groovy.lang.Closure closure)
Allows a OutputStream to be used, calling the closure with the stream and then ensuring that the stream is closed down again irrespective of whether exceptions occur. - param closure the closure that the stream is passed into
- throws: java.io.IOException - IOException
void withWriter(groovy.lang.Closure closure)
Allows an output stream to be used, calling the closure with the output stream and then ensuring that the output stream is closed down again irrespective of whether exceptions occur - param closure the closure that the writer is passed into
- throws: java.io.IOException - IOException
void withWriter(java.lang.String charset, groovy.lang.Closure closure)
Allows an output stream to be used, calling the closure with the output stream and then ensuring that the output stream is closed down again irrespective of whether exceptions occur. - param charset the charset used
- param closure the closure that the writer is passed into
- throws: java.io.IOException - IOException
java.io.Reader
void eachLine(groovy.lang.Closure closure)
Iterates through the given reader line by line - param closure a closure
- throws: java.io.IOException - IOException
void filterLine(java.io.Writer writer, groovy.lang.Closure closure)
Filter the lines from a reader and write them on the writer, according to a closure which returns true or false. - param writer a writer
- param closure the closure which returns booleans
- throws: java.io.IOException - IOException
groovy.lang.Writable filterLine(groovy.lang.Closure closure)
Filter the lines of a Reader and create a Writable in return to stream the filtered lines - param closure a closure returning a boolean indicating to filter or not a line
- returns: groovy.lang.Writable - a Writable closure
java.lang.String getText()
Reads the content of the Reader and returns it as a String - returns: java.lang.String - a String containing the content of the buffered reader
- throws: java.io.IOException - IOException
java.lang.String readLine()
Read a single, whole line from the given Reader - returns: java.lang.String - a line
- throws: java.io.IOException - IOException
java.util.List readLines()
Reads the reader into a list of Strings for each line - returns: java.util.List - a List of lines
- throws: java.io.IOException - IOException
void splitEachLine(java.lang.String sep, groovy.lang.Closure closure)
Iterates through the given reader line by line, splitting on the seperator - param sep a String separator
- param closure a closure
- throws: java.io.IOException - IOException
void transformChar(java.io.Writer writer, groovy.lang.Closure closure)
Transforms the characters from a reader with a Closure and write them to a writer - param writer
- param closure
void transformLine(java.io.Writer writer, groovy.lang.Closure closure)
Transforms the lines from a reader with a Closure and write them to a writer - param writer
- param closure
- throws: java.io.IOException
void withReader(groovy.lang.Closure closure)
Allows a Reader to be used, calling the closure with the writer and then ensuring that the writer is closed down again irrespective of whether exceptions occur or the - param closure the closure that the writer is passed into
- throws: java.io.IOException - IOException
java.io.Writer
java.io.Writer leftShift(java.lang.Object value)
Overloads the left shift operator to provide an append mechanism to add things to a writer - param value a value to append
- returns: java.io.Writer - a StringWriter
- throws: java.io.IOException
void withWriter(groovy.lang.Closure closure)
Allows a writer to be used, calling the closure with the writer and then ensuring that the writer is closed down again irrespective of whether exceptions occur or the - param closure the closure that the writer is passed into
- throws: java.io.IOException - IOException
void write(groovy.lang.Writable writable)
A helper method so that dynamic dispatch of the writer.write(object) method will always use the more efficient Writable.writeTo(writer) mechanism if the object implements the Writable interface. - param writable an object implementing the Writable interface
- throws: java.io.IOException
java.lang.Byte[]
groovy.lang.Writable encodeBase64()
- returns: groovy.lang.Writable
java.lang.CharSequence
java.lang.CharSequence getAt(int index)
Support the subscript operator for String. - param index the index of the Character to get
- returns: java.lang.CharSequence - the Character at the given index
java.lang.CharSequence getAt(groovy.lang.Range range)
Support the range subscript operator for CharSequence - param range a Range
- returns: java.lang.CharSequence - the subsequence CharSequence
java.lang.CharSequence getAt(java.util.Collection indices)
Allows a List to be used as the indices to be used on a CharSequence - param indices a Collection of indices
- returns: java.lang.CharSequence - a String of the values at the given indices
java.lang.Character
int compareTo(java.lang.Number right)
Compare a Character and a Number - param right a Number
- returns: int - the result of the comparison
int compareTo(java.lang.Character right)
Compare two Characters - param right a Character
- returns: int - the result of the comparison
java.lang.Number div(java.lang.Number right)
Divide a Character by a Number - param right a Number
- returns: java.lang.Number - the multiplication of both
java.lang.Number div(java.lang.Character right)
Divide two Characters - param right another Character
- returns: java.lang.Number - the multiplication of both
java.lang.Number intdiv(java.lang.Number right)
Integer Divide a Character by a Number - param right a Number
- returns: java.lang.Number - the integer division of both
java.lang.Number intdiv(java.lang.Character right)
Integer Divide two Characters - param right another Character
- returns: java.lang.Number - the integer division of both
java.lang.Number minus(java.lang.Number right)
Subtract a Number from a Character - param right a Number
- returns: java.lang.Number - the addition of the Character and the Number
java.lang.Number minus(java.lang.Character right)
Subtraction two Characters - param right a Character
- returns: java.lang.Number - the addition of both Characters
java.lang.Number multiply(java.lang.Number right)
Multiply a Character by a Number - param right a Number
- returns: java.lang.Number - the multiplication of both
java.lang.Number multiply(java.lang.Character right)
Multiply two Characters - param right another Character
- returns: java.lang.Number - the multiplication of both
java.lang.Number next()
Increment a Character by one - returns: java.lang.Number - an incremented Number
java.lang.Number plus(java.lang.Number right)
Add a Character and a Number - param right a Number
- returns: java.lang.Number - the addition of the Character and the Number
java.lang.Number plus(java.lang.Character right)
Add two Characters - param right a Character
- returns: java.lang.Number - the addition of both Characters
java.lang.Number previous()
Decrement a Character by one - returns: java.lang.Number - a decremented Number
java.lang.Class
boolean isCase(java.lang.Object switchValue)
java.lang.Double
double abs()
Get the absolute value - returns: double - the absolute value of that Double
long round()
Round the value - returns: long - the absolute value of that Double
java.lang.Float
float abs()
Get the absolute value - returns: float - the absolute value of that Float
int round()
Get the absolute value - returns: int - the absolute value of that Float
java.lang.Long
long abs()
Get the absolute value - returns: long - the absolute value of that Long
java.lang.Number
int abs()
Get the absolute value - returns: int - the absolute value of that Number
java.lang.Number and(java.lang.Number right)
Bitwise AND together two Numbers - param right another Number to bitwse AND
- returns: java.lang.Number - the bitwise AND of both Numbers
int compareTo(java.lang.Character right)
Compare a Number and a Character - param right a Character
- returns: int - the result of the comparison
int compareTo(java.lang.Number right)
Compare two Numbers - param right another Number to compare to
- returns: int - the comparision of both numbers
java.lang.Number div(java.lang.Character right)
Divide a Number by a Character - param right a Character
- returns: java.lang.Number - the multiplication of both
java.lang.Number div(java.lang.Number right)
Divide two Numbers - param right another Number
- returns: java.lang.Number - a Number resulting of the divide operation
java.lang.Number intdiv(java.lang.Character right)
Integer Divide a Number by a Character - param right a Character
- returns: java.lang.Number - the integer division of both
java.lang.Number intdiv(java.lang.Number right)
Integer Divide two Numbers - param right another Number
- returns: java.lang.Number - a Number (an Integer) resulting of the integer division operation
java.lang.Number leftShift(java.lang.Number right)
Implementation of the left shift operator for integral types. Non integral Number types throw UnsupportedOperationException. - returns: java.lang.Number
java.lang.Number minus(java.lang.Character right)
Subtract a Character from a Number - param right a Character
- returns: java.lang.Number - the addition of the Character and the Number
java.lang.Number minus(java.lang.Number right)
Substraction of two Numbers - param right another Number to substract to the first one
- returns: java.lang.Number - the substraction
java.lang.Number mod(java.lang.Number right)
Performs a division modulus operation - param right another Number to mod
- returns: java.lang.Number - the modulus result
java.lang.Number multiply(java.lang.Character right)
Multiply a Number by a Character - param right a Character
- returns: java.lang.Number - the multiplication of both
java.lang.Number multiply(java.lang.Number right)
Multiply two Numbers - param right another Number
- returns: java.lang.Number - the multiplication of both
java.lang.Number negate()
Negates the number - returns: java.lang.Number - the negation of the number
java.lang.Number next()
Increment a Number by one - returns: java.lang.Number - an incremented Number
java.lang.Number or(java.lang.Number right)
Bitwise OR together two numbers - param right another Number to bitwise OR
- returns: java.lang.Number - the bitwise OR of both Numbers
java.lang.String plus(java.lang.String right)
Appends a String - param right a String
- returns: java.lang.String - a String
java.lang.Number plus(java.lang.Character right)
Add a Number and a Character - param right a Character
- returns: java.lang.Number - the addition of the Character and the Number
java.lang.Number plus(java.lang.Number right)
Add two Numbers - param right another Number to add
- returns: java.lang.Number - the addition of both Numbers
java.lang.Number power(java.lang.Number exponent)
Power of a Number to a certain exponent - param exponent a Number exponent
- returns: java.lang.Number - a Number to the power of a certain exponent
java.lang.Number previous()
Decrement a Number by one - returns: java.lang.Number - a decremented Number
java.lang.Number rightShift(java.lang.Number right)
Implementation of the right shift operator for integral types. Non integral Number types throw UnsupportedOperationException. - returns: java.lang.Number
java.lang.Number rightShiftUnsigned(java.lang.Number right)
Implementation of the right shift (unsigned) operator for integral types. Non integral Number types throw UnsupportedOperationException. - returns: java.lang.Number
void step(java.lang.Number to, java.lang.Number stepNumber, groovy.lang.Closure closure)
Iterates from this number up to the given number using a step increment - param to a Number to go up to
- param stepNumber a Number representing the step increment
- param closure the closure to call
void times(groovy.lang.Closure closure)
Iterates a number of times - param closure the closure to call a number of times
java.lang.Integer toInteger()
Transform a Number into an Integer - returns: java.lang.Integer - an Integer
void upto(java.lang.Number to, groovy.lang.Closure closure)
Iterates from this number up to the given number - param to another Number to go up to
- param closure the closure to call
java.lang.Object
java.util.List allProperties()
boolean any(groovy.lang.Closure closure)
Iterates over every element of a collection, and check whether a predicate is valid for at least one element - param closure the closure predicate used for matching
- returns: boolean - true if any item in the collection matches the closure predicate
java.util.List collect(groovy.lang.Closure closure)
Iterates through this object transforming each object into a new value using the closure as a transformer, returning a list of transformed values. - param closure the closure used to map each element of the collection
- returns: java.util.List - a List of the mapped values
java.util.Collection collect(java.util.Collection collection, groovy.lang.Closure closure)
Iterates through this object transforming each object into a new value using the closure as a transformer and adding it to the collection, returning the resulting collection. - param collection the Collection to which the mapped values are added
- param closure the closure used to map each element of the collection
- returns: java.util.Collection - the resultant collection
java.lang.String dump()
Generates a detailed dump string of an object showing its class, hashCode and fields - returns: java.lang.String
void each(groovy.lang.Closure closure)
Allows objects to be iterated through using a closure - param closure the closure applied on each element found
void eachProperty(groovy.lang.Closure closure)
void eachPropertyName(groovy.lang.Closure closure)
void eachWithIndex(groovy.lang.Closure closure)
Allows object to be iterated through a closure with a counter
boolean every(groovy.lang.Closure closure)
Iterates over every element of a collection, and check whether a predicate is valid for all elements. - param closure the closure predicate used for matching
- returns: boolean - true if every item in the collection matches the closure predicate
java.lang.Object find(groovy.lang.Closure closure)
Finds the first value matching the closure condition - param closure a closure condition
- returns: java.lang.Object - the first Object found
java.util.List findAll(groovy.lang.Closure closure)
Finds all values matching the closure condition - param closure a closure condition
- returns: java.util.List - a List of the values found
int findIndexOf(groovy.lang.Closure closure)
Iterates over every element of the collection and return the index of the first object that matches the condition specified in the closure - param closure the filter to perform a match on the collection
- returns: int - an integer that is the index of the first macthed object.
java.lang.Object getAt(java.lang.String property)
Allows the subscript operator to be used to lookup dynamic property values. bean[somePropertyNameExpression]
. The normal property notation of groovy is neater and more concise but only works with compile time known property names. - returns: java.lang.Object -
java.util.List grep(java.lang.Object filter)
Iterates over every element of the collection and return each object that matches the given filter - calling the isCase() method used by switch statements. This method can be used with different kinds of filters like regular expresions, classes, ranges etc. - param filter the filter to perform on the collection (using the isCase(object) method)
- returns: java.util.List - a list of objects which match the filter
java.lang.String inspect()
- returns: java.lang.String - a String that matches what would be typed into a terminal to create this object. e.g. [1, 'hello'].inspect() -> [1, "hello"]
java.lang.Object invokeMethod(java.lang.String method, java.lang.Object arguments)
Provide a dynamic method invocation method which can be overloaded in classes to implement dynamic proxies easily. - returns: java.lang.Object
boolean isCase(java.lang.Object switchValue)
void print(java.lang.Object value)
Print to a console in interactive format
void print(java.io.PrintWriter out)
Print to a console in interactive format
void println(java.lang.Object value)
Print to a console in interactive format along with a newline
void println(java.io.PrintWriter out)
Print to a console in interactive format
void putAt(java.lang.String property, java.lang.Object newValue)
Allows the subscript operator to be used to set dynamically named property values. bean[somePropertyNameExpression] = foo
. The normal property notation of groovy is neater and more concise but only works with compile time known property names.
void use(java.lang.Class categoryClass, groovy.lang.Closure closure)
void use(java.util.List categoryClassList, groovy.lang.Closure closure)
Scoped use method with list of categories
java.lang.Object[]
java.util.List getAt(java.util.Collection indices)
Allows a List to be used as the indices to be used on a List - param indices a Collection of indices
- returns: java.util.List - a new list of the values at the given indices
java.util.List getAt(groovy.lang.Range range)
Support the range subscript operator for an Array - param range a Range
- returns: java.util.List - a range of a list from the range's from index up to but not including the ranges's to value
java.lang.Object getAt(int idx)
Support the subscript operator for an Array - param idx an index
- returns: java.lang.Object - the value at the given index
java.lang.String join(java.lang.String separator)
Concatenates all of the elements of the array together with the given String as a separator - param separator a String separator
- returns: java.lang.String - the joined String
void putAt(int idx, java.lang.Object value)
Support the subscript operator for an Array - param idx an index
- param value an Object to put at the given index
int size()
Makes an Array look like a Collection by adding support for the size() method - returns: int - the size of the Array
java.util.List toList()
Allows conversion of arrays into a mutable List - returns: java.util.List - the array as a List
java.lang.Process
java.io.InputStream getErr()
An alias method so that a process appears similar to System.out, System.in, System.err; you can use process.in, process.out, process.err in a similar way - returns: java.io.InputStream - an InputStream
java.io.InputStream getIn()
An alias method so that a process appears similar to System.out, System.in, System.err; you can use process.in, process.out, process.err in a similar way - returns: java.io.InputStream - an InputStream
java.io.OutputStream getOut()
An alias method so that a process appears similar to System.out, System.in, System.err; you can use process.in, process.out, process.err in a similar way - returns: java.io.OutputStream - an OutputStream
java.lang.String getText()
Read the text of the output stream of the Process. - returns: java.lang.String - the text of the output
- throws: java.io.IOException - IOException
java.io.Writer leftShift(java.lang.Object value)
Overloads the left shift operator to provide an append mechanism to pipe into a Process - param value a value to append
- returns: java.io.Writer - a Writer
- throws: java.io.IOException
java.io.OutputStream leftShift(byte[] value)
Overloads the left shift operator to provide an append mechanism to pipe into a Process - param value a value to append
- returns: java.io.OutputStream - an OutputStream
- throws: java.io.IOException
void waitForOrKill(long numberOfMillis)
Wait for the process to finish during a certain amount of time, otherwise stops the process. - param numberOfMillis the number of milliseconds to wait before stopping the process
java.lang.String
java.lang.String center(java.lang.Number numberOfChars, java.lang.String padding)
Center a String and padd it with the characters appended around it - param padding the charaters used for padding
- returns: java.lang.String - the String centered with padded character around
java.lang.String center(java.lang.Number numberOfChars)
Center a String and padd it with spaces appended around it - returns: java.lang.String - the String centered with padded character around
boolean contains(java.lang.String text)
Provide an implementation of contains() like Collection to make Strings more polymorphic This method is not required on JDK 1.5 onwards - param text a String to look for
- returns: boolean - true if this string contains the given text
int count(java.lang.String text)
Count the number of occurencies of a substring - param text a substring
- returns: int - the number of occurrencies of the given string inside this String
byte[] decodeBase64()
Decode the Sting from base64 into a byte array - returns: byte[] - the decoded bytes as an array
void eachMatch(java.lang.String regex, groovy.lang.Closure closure)
process each regex matched substring of a string object. The object passed to the closure is a matcher with rich information of the last successful match - param str the target string
- param regex a Regex string
- param closure a closure
java.lang.Process execute()
Executes the given string as a command line process. For more control over the process mechanism in JDK 1.5 you can use java.lang.ProcessBuilder. - returns: java.lang.Process - the Process which has just started for this command line string
- throws: java.io.IOException
java.lang.String getAt(int index)
Support the subscript operator for String - returns: java.lang.String - the Character object at the given index
java.lang.String getAt(groovy.lang.Range range)
Support the range subscript operator for String - param range a Range
- returns: java.lang.String - a substring corresponding to the Range
java.lang.String getAt(java.util.Collection indices)
Allows a List to be used as the indices to be used on a String - param indices a Collection of indices
- returns: java.lang.String - a String of the values at the given indices
boolean isCase(java.lang.Object switchValue)
java.io.StringWriter leftShift(java.lang.Object value)
Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a String - param value an Obect
- returns: java.io.StringWriter - a StringWriter
java.lang.String minus(java.lang.Object value)
Remove a part of a String - param value a String part to remove
- returns: java.lang.String - a String minus the part to be removed
java.lang.String multiply(java.lang.Number factor)
Repeat a String a certain number of times - param factor the number of times the String should be repeated
- returns: java.lang.String - a String composed of a repeatition
java.lang.String next()
Increments the last digit in the given string, resetting it and moving onto the next digit if increasing the digit no longer becomes a letter or digit. - returns: java.lang.String - a String with an incremented digit at the end
java.lang.String padLeft(java.lang.Number numberOfChars, java.lang.String padding)
Pad a String with the characters appended to the left - param padding the charaters used for padding
- returns: java.lang.String - the String padded to the left
java.lang.String padLeft(java.lang.Number numberOfChars)
Pad a String with the spaces appended to the left - returns: java.lang.String - the String padded to the left
java.lang.String padRight(java.lang.Number numberOfChars, java.lang.String padding)
Pad a String with the characters appended to the right - param padding the charaters used for padding
- returns: java.lang.String - the String padded to the right
java.lang.String padRight(java.lang.Number numberOfChars)
Pad a String with the spaces appended to the right - returns: java.lang.String - the String padded to the right
java.lang.String plus(java.lang.Object value)
Appends a String - param value a String
- returns: java.lang.String - a String
java.lang.String previous()
Decrements the last digit in the given string, resetting it and moving onto the next digit if increasing the digit no longer becomes a letter or digit. - returns: java.lang.String - a String with a decremented digit at the end
java.lang.String reverse()
Creates a new string which is the reverse (backwards) of this string - returns: java.lang.String - a new string with all the characters reversed.
int size()
Makes a String look like a Collection by adding support for the size() method - returns: int - the length of the String
java.lang.Character toCharacter()
Converts the given string into a Character object using the first character in the string - returns: java.lang.Character - the first Character
java.lang.Double toDouble()
Parse a String into a Double - returns: java.lang.Double - a Double
java.lang.Float toFloat()
Parse a String into a Float - returns: java.lang.Float - a Float
java.lang.Integer toInteger()
Parse a String into an Integer - returns: java.lang.Integer - an Integer
java.util.List toList()
Converts the given String into a List of strings of one character - returns: java.util.List - a List of characters (a 1-character String)
java.lang.Long toLong()
Parse a String into a Long - returns: java.lang.Long - a Long
java.net.URL toURL()
Transforms a String representing a URL into a URL object. - returns: java.net.URL - a URL
- throws: java.net.MalformedURLException - MalformedURLException is thrown if the URL is not well formed.
java.util.List tokenize(java.lang.String token)
Tokenize a String - param token the delimiter
- returns: java.util.List - a List of tokens
java.util.List tokenize()
Tokenize a String (with a whitespace as delimiter) - returns: java.util.List - a List of tokens
java.lang.StringBuffer
java.io.Writer leftShift(java.lang.Object value)
Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a StringBuffer - param value a value to append
- returns: java.io.Writer - a StringWriter
java.lang.String plus(java.lang.String value)
Appends a String - param value a String
- returns: java.lang.String - a String
java.net.ServerSocket
java.net.Socket accept(groovy.lang.Closure closure)
Allow to pass a Closure to the accept methods of ServerSocket - param closure a Closure
- returns: java.net.Socket - a Socket
- throws: java.io.IOException - IOException
java.net.Socket
java.io.Writer leftShift(java.lang.Object value)
Overloads the left shift operator to provide an append mechanism to add things to the output stream of a socket - param value a value to append
- returns: java.io.Writer - a Writer
- throws: java.io.IOException
java.io.OutputStream leftShift(byte[] value)
Overloads the left shift operator to provide an append mechanism to add bytes to the output stream of a socket - param value a value to append
- returns: java.io.OutputStream - an OutputStream
- throws: java.io.IOException
void withStreams(groovy.lang.Closure closure)
Allows an InputStream and an OutputStream from a Socket to be used, calling the closure with the streams and then ensuring that the streams are closed down again irrespective of whether exceptions occur. - param closure a Closure
- throws: java.io.IOException - IOException
java.net.URL
void eachByte(groovy.lang.Closure closure)
Traverse through each byte of the specified URL - param closure closure to apply to each byte
- throws: java.io.IOException - IOException
void eachLine(groovy.lang.Closure closure)
Iterates through the lines read from the URL's associated input stream - param closure a closure to apply on each line
- throws: java.io.IOException - IOException
java.lang.String getText()
Reads the content of this URL and returns it as a String - returns: java.lang.String - the text from that URL
- throws: java.io.IOException - IOException
java.lang.String getText(java.lang.String charset)
Reads the content of this URL and returns it as a String - param charset opens the stream with a specified charset
- returns: java.lang.String - the text from that URL
- throws: java.io.IOException - IOException
void withReader(groovy.lang.Closure closure)
Helper method to create a new BufferedReader for a URL and then passes it into the closure and ensures its closed again afterwords - throws: java.io.IOException - FileNotFoundException
java.util.Collection
java.util.Collection asImmutable()
A convenience method for creating an immutable Collection - returns: java.util.Collection - an immutable Collection
java.util.List asList()
Converts the given collection into a List - returns: java.util.List - a newly created List if this collection is not already a List
java.util.Collection asSynchronized()
A convenience method for creating a synchronized Collection - returns: java.util.Collection - a synchronized Collection
java.util.List collect(groovy.lang.Closure closure)
Iterates through this collection transforming each entry into a new value using the closure as a transformer, returning a list of transformed values. - param closure the closure used for mapping
- returns: java.util.List - a List of the mapped values
java.util.Collection collect(java.util.Collection collection, groovy.lang.Closure closure)
Iterates through this collection transforming each entry into a new value using the closure as a transformer, returning a list of transformed values. - param collection the Collection to which the mapped values are added
- param closure the closure used to map each element of the collection
- returns: java.util.Collection - the resultant collection
int count(java.lang.Object value)
Counts the number of occurencies of the given value inside this collection - param value the value
- returns: int - the number of occurrencies
void each(groovy.lang.Closure closure)
Allows objects to be iterated through using a closure - param closure the closure applied on each element of the collection
java.lang.Object find(groovy.lang.Closure closure)
Finds the first value matching the closure condition - param closure a closure condition
- returns: java.lang.Object - the first Object found
java.util.List findAll(groovy.lang.Closure closure)
Finds all values matching the closure condition - param closure a closure condition
- returns: java.util.List - a List of the values found
java.util.List getAt(java.lang.String property)
Support the subscript operator for List - param property a String
- returns: java.util.List - a List
java.lang.Object inject(java.lang.Object value, groovy.lang.Closure closure)
Iterates through the given collection, passing in the initial value to the closure along with the current iterated item then passing into the next iteration the value of the previous closure. - param value a value
- param closure a closure
- returns: java.lang.Object - the last value of the last iteration
boolean isCase(java.lang.Object switchValue)
java.lang.String join(java.lang.String separator)
Concatenates all of the items of the collection together with the given String as a separator - param separator a String separator
- returns: java.lang.String - the joined String
java.util.Collection leftShift(java.lang.Object value)
Overloads the left shift operator to provide an easy way to append objects to a list - param value an Object to be added to the collection.
- returns: java.util.Collection - a Collection with an Object added to it.
java.lang.Object max()
Selects the maximum value found in the collection - returns: java.lang.Object - the maximum value
java.lang.Object max(java.util.Comparator comparator)
Selects the maximum value found in the collection using the given comparator - param comparator a Comparator
- returns: java.lang.Object - the maximum value
java.lang.Object max(groovy.lang.Closure closure)
Selects the maximum value found in the collection using the given closure as a comparator - param closure a closure used as a comparator
- returns: java.lang.Object - the maximum value
java.lang.Object min()
Selects the minimum value found in the collection - returns: java.lang.Object - the minimum value
java.lang.Object min(java.util.Comparator comparator)
Selects the minimum value found in the collection using the given comparator - param comparator a Comparator
- returns: java.lang.Object - the minimum value
java.lang.Object min(groovy.lang.Closure closure)
Selects the minimum value found in the collection using the given closure as a comparator - param closure a closure used as a comparator
- returns: java.lang.Object - the minimum value
java.util.List multiply(java.lang.Number factor)
Create a List composed of the same elements repeated a certain number of times. - param factor the number of times to append
- returns: java.util.List - a List
java.util.List plus(java.util.Collection right)
Create a List as a union of both Collections - param right the right Collection
- returns: java.util.List - a List
java.util.List plus(java.lang.Object right)
Create a List as a union of a Collection and an Object - param right an object to append
- returns: java.util.List - a List
java.util.List sort()
Sorts the given collection into a sorted list - returns: java.util.List - the sorted collection as a List
java.util.List sort(java.util.Comparator comparator)
A convenience method for sorting a Collection with a specific comparator - param comparator a Comparator used for the comparison
- returns: java.util.List - a newly created sorted List
java.util.List sort(groovy.lang.Closure closure)
A convenience method for sorting a Collection using a closure as a comparator - param closure a Closure used as a comparator
- returns: java.util.List - a newly created sorted List
java.util.List toList()
Convert a collection to a List. - returns: java.util.List - a List
java.util.Date
java.util.Date minus(int days)
Subtracts a number of days from this date and returns the new date - returns: java.util.Date - the new date
java.util.Date next()
Increments a Date by a day - returns: java.util.Date - the next days date
java.util.Date plus(int days)
Adds a number of days to this date and returns the new date - param days the number of days to increase
- returns: java.util.Date - the new date
java.util.Date previous()
Decrement a Date by a day - returns: java.util.Date - the previous days date
java.util.List
java.util.List asImmutable()
A convenience method for creating an immutable list - returns: java.util.List - an immutable List
java.util.List asSynchronized()
A convenience method for creating a synchronized List - returns: java.util.List - a synchronized List
java.util.List flatten()
Flatten a list - returns: java.util.List - a flattened List
java.util.List getAt(groovy.lang.Range range)
Support the range subscript operator for a List - param range a Range
- returns: java.util.List - a range of a list from the range's from index up to but not including the ranges's to value
java.util.List getAt(java.util.Collection indices)
Allows a List to be used as the indices to be used on a List - param indices a Collection of indices
- returns: java.util.List - a new list of the values at the given indices
java.lang.Object getAt(int idx)
Support the subscript operator for a List - param idx an index
- returns: java.lang.Object - the value at the given index
java.util.List intersect(java.util.Collection right)
Create a List composed of the intersection of both collections - param right a Collection
- returns: java.util.List - a List as an intersection of both collections
java.util.List minus(java.util.Collection removeMe)
Create a List composed of the elements of the first list minus the elements of the collection - param removeMe a Collection of elements to remove
- returns: java.util.List - a List with the common elements removed
java.lang.Object pop()
Removes the last item from the List. Using add() and pop() is similar to push and pop on a Stack. - returns: java.lang.Object - the item removed from the List
void putAt(int idx, java.lang.Object value)
A helper method to allow lists to work with subscript operators - param idx an index
- param value the value to put at the given index
java.util.List reverse()
Reverses the list - returns: java.util.List - a reversed List
void reverseEach(groovy.lang.Closure closure)
Iterate over each element of the list in the reverse order.
java.util.List sort()
A convenience method for sorting a List - returns: java.util.List - the sorted List
java.util.List sort(java.util.Comparator comparator)
A convenience method for sorting a List with a specific comparator - param comparator a Comparator used for the comparison
- returns: java.util.List - a sorted List
java.util.List sort(groovy.lang.Closure closure)
A convenience method for sorting a List using a closure as a comparator - param closure a Closure used as a comparator
- returns: java.util.List - a sorted List
java.util.Map
java.util.Map asImmutable()
A convenience method for creating an immutable map - returns: java.util.Map - an immutable Map
java.util.Map asSynchronized()
A convenience method for creating a synchronized Map - returns: java.util.Map - a synchronized Map
java.util.Collection collect(java.util.Collection collection, groovy.lang.Closure closure)
Iterates through this Map transforming each entry into a new value using the closure as a transformer, returning a list of transformed values. - param closure the closure used for mapping
- returns: java.util.Collection - a List of the mapped values
java.util.List collect(groovy.lang.Closure closure)
Iterates through this Map transforming each entry into a new value using the closure as a transformer, returning a list of transformed values. - param collection the Collection to which the mapped values are added
- param closure the closure used to map each element of the collection
- returns: java.util.List - the resultant collection
void each(groovy.lang.Closure closure)
Allows a Map to be iterated through using a closure. If the closure takes one parameter then it will be passed the Map.Entry otherwise if the closure takes two parameters then it will be passed the key and the value. - param closure the closure applied on each entry of the map
java.lang.Object find(groovy.lang.Closure closure)
Finds the first value matching the closure condition - param closure a closure condition
- returns: java.lang.Object - the first Object found
java.util.List findAll(groovy.lang.Closure closure)
Finds all values matching the closure condition - param closure a closure condition applying on the keys
- returns: java.util.List - a List of keys
java.lang.Object get(java.lang.Object key, java.lang.Object defaultValue)
Looks up an item in a Map for the given key and returns the value - unless there is no entry for the given key in which case add the default value to the map and return that. - param key the key to lookup the value of
- param defaultValue the value to return and add to the map for this key if there is no entry for the given key
- returns: java.lang.Object - the value of the given key or the default value, added to the map if the key did not exist
java.lang.Object getAt(java.lang.Object key)
Support the subscript operator for a List - param key an Object as a key for the map
- returns: java.lang.Object - the value corresponding to the given key
java.lang.Object putAt(java.lang.Object key, java.lang.Object value)
A helper method to allow lists to work with subscript operators - param key an Object as a key for the map
- returns: java.lang.Object - the value corresponding to the given key
java.util.Map subMap(java.util.Collection keys)
Creates a sub-Map containing the given keys. This method is similar to List.subList() but uses keys rather than index ranges. - param keys a Collection of keys
- returns: java.util.Map - a new Map containing the given keys
java.util.Set
java.util.Set asImmutable()
A convenience method for creating an immutable list - returns: java.util.Set - an immutable Set
java.util.Set asSynchronized()
A convenience method for creating a synchronized Set - returns: java.util.Set - a synchronized Set
java.util.SortedMap
java.util.SortedMap asImmutable()
A convenience method for creating an immutable sorted map - returns: java.util.SortedMap - an immutable SortedMap
java.util.SortedMap asSynchronized()
A convenience method for creating a synchronized SortedMap - returns: java.util.SortedMap - a synchronized SortedMap
java.util.SortedSet
java.util.SortedSet asImmutable()
A convenience method for creating an immutable sorted set - returns: java.util.SortedSet - an immutable SortedSet
java.util.SortedSet asSynchronized()
A convenience method for creating a synchronized SortedSet - returns: java.util.SortedSet - a synchronized SortedSet
java.util.SortedSet sort()
Avoids doing unnecessary work when sorting an already sorted set - returns: java.util.SortedSet - the sorted set
java.util.regex.Matcher
void each(groovy.lang.Closure closure)
java.lang.String getAt(int idx)
Support the subscript operator for a regex Matcher - param idx an index
- returns: java.lang.String - the group at the given index
java.lang.String getAt(java.util.Collection indices)
Allows a List to be used as the indices to be used on a Matcher - param indices a Collection of indices
- returns: java.lang.String - a String of the values at the given indices
java.util.regex.Pattern
boolean isCase(java.lang.Object switchValue)
long[]
java.lang.Object getAt(int idx)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.Range range)
- returns: java.lang.Object
java.lang.Object getAt(java.util.Collection indices)
- returns: java.lang.Object
void putAt(int idx, java.lang.Object newValue)
int size()
java.util.List toList()
short[]
java.lang.Object getAt(int idx)
- returns: java.lang.Object
java.lang.Object getAt(groovy.lang.Range range)
- returns: java.lang.Object
java.lang.Object getAt(java.util.Collection indices)
- returns: java.lang.Object
void putAt(int idx, java.lang.Object newValue)
int size()
java.util.List toList()