|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.codehaus.groovy.runtime.DefaultGroovyMethodsSupport
org.codehaus.groovy.runtime.DefaultGroovyMethods
public class DefaultGroovyMethods
This class defines all the new groovy methods which appear on normal JDK classes inside the Groovy environment. Static methods are used with the first parameter the destination class.
| Nested Class Summary | |
|---|---|
protected static class |
DefaultGroovyMethods.ProcessRunner
A Runnable which waits for a process to complete together with a notification scheme allowing another thread to wait a maximum number of seconds for the process to complete before killing it. |
| Nested classes/interfaces inherited from class org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport |
|---|
DefaultGroovyMethodsSupport.RangeInfo |
| Field Summary | |
|---|---|
static Class[] |
additionals
|
| Constructor Summary | |
|---|---|
DefaultGroovyMethods()
|
|
| Method Summary | ||
|---|---|---|
static double |
abs(Double number)
Get the absolute value |
|
static float |
abs(Float number)
Get the absolute value |
|
static long |
abs(Long number)
Get the absolute value |
|
static int |
abs(Number number)
Get the absolute value |
|
static Socket |
accept(ServerSocket serverSocket,
Closure closure)
Accepts a connection and passes the resulting Socket to the closure which runs in a new Thread. |
|
static void |
addShutdownHook(Object self,
Closure closure)
Allows the usage of addShutdownHook without getting the runtime first. |
|
static BitSet |
and(BitSet left,
BitSet right)
Bitwise AND together two BitSets. |
|
static Boolean |
and(Boolean left,
Boolean right)
Logical conjunction of two boolean operators. |
|
static Number |
and(Number left,
Number right)
Bitwise AND together two Numbers. |
|
static
|
any(Map<K,V> self,
Closure closure)
Iterates over the entries of a map, and checks whether a predicate is valid for at least one entry. |
|
static boolean |
any(Object self)
Iterates over the elements of a collection, and checks whether at least one element is true according to the Groovy Truth. |
|
static boolean |
any(Object self,
Closure closure)
Iterates over the contents of an object or collection, and checks whether a predicate is valid for at least one element. |
|
static void |
append(File file,
byte[] bytes)
Append bytes to the end of a File. |
|
static void |
append(File self,
InputStream stream)
Append binary data to the file. |
|
static void |
append(File file,
Object text)
Append the text at the end of the File. |
|
static void |
append(File file,
Object text,
String charset)
Append the text at the end of the File, using a specified encoding. |
|
static boolean |
asBoolean(Boolean bool)
Coerce an Boolean instance to a boolean value. |
|
static boolean |
asBoolean(Character character)
Coerce a character to a boolean value. |
|
static boolean |
asBoolean(CharSequence string)
Coerce a string (an instance of CharSequence) to a boolean value. |
|
static boolean |
asBoolean(Collection collection)
Coerce a collection instance to a boolean value. |
|
static boolean |
asBoolean(Enumeration enumeration)
Coerce an enumeration instance to a boolean value. |
|
static boolean |
asBoolean(GroovyResultSet grs)
Coerce a GroovyResultSet to a boolean value. |
|
static boolean |
asBoolean(Iterator iterator)
Coerce an iterator instance to a boolean value. |
|
static boolean |
asBoolean(Map map)
Coerce a map instance to a boolean value. |
|
static boolean |
asBoolean(Matcher matcher)
Coerce a Matcher instance to a boolean value. |
|
static boolean |
asBoolean(Number number)
Coerce a number to a boolean value. |
|
static boolean |
asBoolean(Object object)
Coerce an object instance to a boolean value. |
|
static boolean |
asBoolean(Object[] array)
Coerce an Object array to a boolean value. |
|
static
|
asImmutable(Collection<? extends T> self)
A convenience method for creating an immutable Collection. |
|
static
|
asImmutable(List<? extends T> self)
A convenience method for creating an immutable list |
|
static
|
asImmutable(Map<? extends K,? extends V> self)
A convenience method for creating an immutable map. |
|
static
|
asImmutable(Set<? extends T> self)
A convenience method for creating an immutable list. |
|
static
|
asImmutable(SortedMap<K,? extends V> self)
A convenience method for creating an immutable sorted map. |
|
static
|
asImmutable(SortedSet<T> self)
A convenience method for creating an immutable sorted set. |
|
static
|
asList(Collection<T> self)
Converts this collection to a List. |
|
static
|
asSynchronized(Collection<T> self)
A convenience method for creating a synchronized Collection. |
|
static
|
asSynchronized(List<T> self)
A convenience method for creating a synchronized List. |
|
static
|
asSynchronized(Map<K,V> self)
A convenience method for creating a synchronized Map. |
|
static
|
asSynchronized(Set<T> self)
A convenience method for creating a synchronized Set. |
|
static
|
asSynchronized(SortedMap<K,V> self)
A convenience method for creating a synchronized SortedMap. |
|
static
|
asSynchronized(SortedSet<T> self)
A convenience method for creating a synchronized SortedSet. |
|
static Object |
asType(Closure cl,
Class clazz)
Coerces the closure to an implementation of the given class. |
|
static Object |
asType(Collection col,
Class clazz)
Converts the given collection to another type. |
|
static Object |
asType(File f,
Class c)
Converts this File to a Writable or delegates to default
asType(Object,Class). |
|
static Object |
asType(GString self,
Class c)
Converts the GString to a File, or delegates to the default asType(Object,Class) |
|
static Object |
asType(Map map,
Class clazz)
Coerces this map to the given type, using the map's keys as the public method names, and values as the implementation. |
|
static Object |
asType(Number self,
Class c)
Transform this number to a the given type, using the 'as' operator. |
|
static Object |
asType(Object[] ary,
Class clazz)
Converts the given array to either a List, Set, or SortedSet. |
|
static Object |
asType(Object obj,
Class type)
Converts a given object to a type. |
|
static Object |
asType(String self,
Class c)
Provides a method to perform custom 'dynamic' type conversion to the given class using the as operator. |
|
static File |
asWritable(File file)
Converts this File to a Writable. |
|
static File |
asWritable(File file,
String encoding)
Allows a file to return a Writable implementation that can output itself to a Writer stream. |
|
static BitSet |
bitwiseNegate(BitSet self)
Bitwise NEGATE a BitSet. |
|
static Pattern |
bitwiseNegate(String self)
Turns a String into a regular expression Pattern |
|
protected static Object |
callClosureForLine(Closure closure,
String line,
int counter)
|
|
protected static Object |
callClosureForMapEntry(Closure closure,
Map.Entry entry)
|
|
protected static Object |
callClosureForMapEntryAndCounter(Closure closure,
Map.Entry entry,
int counter)
|
|
static String |
center(String self,
Number numberOfChars)
Center a String and pad it with spaces appended around it |
|
static String |
center(String self,
Number numberOfChars,
String padding)
Center a String and pad it with the characters appended around it |
|
static List |
collect(Collection self,
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. |
|
static Collection |
collect(Collection self,
Collection collection,
Closure closure)
Iterates through this collection transforming each value into a new value using the closure as a transformer, returning an initial collection plus the transformed values. |
|
static List |
collect(Map self,
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. |
|
static Collection |
collect(Map self,
Collection collection,
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. |
|
static List |
collect(Object self,
Closure closure)
Iterates through this object transforming each value into a new value using the closure as a transformer, returning a list of transformed values. |
|
static Collection |
collect(Object self,
Collection collection,
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. |
|
static List |
collectAll(Collection self,
Closure closure)
Recursively iterates through this collection transforming each non-Collection value into a new value using the closure as a transformer. |
|
static Collection |
collectAll(Collection self,
Collection collection,
Closure closure)
Recursively iterates through this collection transforming each non-Collection value into a new value using the closure as a transformer. |
|
static List |
combinations(Collection self)
Adds GroovyCollections#combinations(Collection) as a method on collections. |
|
static int |
compareTo(Character left,
Character right)
Compare two Characters. |
|
static int |
compareTo(Character left,
Number right)
Compare a Character and a Number. |
|
static int |
compareTo(Number left,
Character right)
Compare a Number and a Character. |
|
static int |
compareTo(Number left,
Number right)
Compare two Numbers. |
|
static Thread |
consumeProcessErrorStream(Process self,
OutputStream err)
Gets the error stream from a process and reads it to keep the process from blocking due to a full buffer. |
|
static Thread |
consumeProcessErrorStream(Process self,
StringBuffer error)
Gets the error stream from a process and reads it to keep the process from blocking due to a full buffer. |
|
static Thread |
consumeProcessErrorStream(Process self,
Writer err)
Gets the error stream from a process and reads it to keep the process from blocking due to a full buffer. |
|
static void |
consumeProcessOutput(Process self)
Gets the output and error streams from a process and reads them to keep the process from blocking due to a full output buffer. |
|
static void |
consumeProcessOutput(Process self,
OutputStream output,
OutputStream error)
Gets the output and error streams from a process and reads them to keep the process from blocking due to a full output buffer. |
|
static void |
consumeProcessOutput(Process self,
StringBuffer output,
StringBuffer error)
Gets the output and error streams from a process and reads them to keep the process from blocking due to a full output buffer. |
|
static Thread |
consumeProcessOutputStream(Process self,
OutputStream output)
Gets the output stream from a process and reads it to keep the process from blocking due to a full output buffer. |
|
static Thread |
consumeProcessOutputStream(Process self,
StringBuffer output)
Gets the output stream from a process and reads it to keep the process from blocking due to a full output buffer. |
|
static Thread |
consumeProcessOutputStream(Process self,
Writer output)
Gets the output stream from a process and reads it to keep the process from blocking due to a full output buffer. |
|
static boolean |
contains(String self,
String text)
Provide an implementation of contains() like Collection.contains(Object) to make Strings more polymorphic. |
|
static Number |
count(boolean[] self,
Object value)
Counts the number of occurrences of the given value inside this array. |
|
static Number |
count(byte[] self,
Object value)
Counts the number of occurrences of the given value inside this array. |
|
static Number |
count(char[] self,
Object value)
Counts the number of occurrences of the given value inside this array. |
|
static Number |
count(Collection self,
Object value)
Counts the number of occurrences of the given value inside this collection. |
|
static Number |
count(double[] self,
Object value)
Counts the number of occurrences of the given value inside this array. |
|
static Number |
count(float[] self,
Object value)
Counts the number of occurrences of the given value inside this array. |
|
static Number |
count(int[] self,
Object value)
Counts the number of occurrences of the given value inside this array. |
|
static Number |
count(Iterator self,
Object value)
Counts the number of occurrences of the given value from the items within this Iterator. |
|
static Number |
count(long[] self,
Object value)
Counts the number of occurrences of the given value inside this array. |
|
static Number |
count(Object[] self,
Object value)
Counts the number of occurrences of the given value inside this array. |
|
static Number |
count(short[] self,
Object value)
Counts the number of occurrences of the given value inside this array. |
|
static int |
count(String self,
String text)
Count the number of occurencies of a substring. |
|
protected static StringBufferWriter |
createStringBufferWriter(StringBuffer self)
|
|
protected static StringWriter |
createStringWriter(String self)
|
|
static byte[] |
decodeBase64(String value)
Decode the String from Base64 into a byte array. |
|
static boolean |
deleteDir(File self)
Deletes a directory with all contained files and subdirectories. |
|
static String |
denormalize(String self)
Return a String with lines (separated by LF, CR/LF, or CR) terminated by the platform specific line separator. |
|
static boolean |
disjoint(Collection left,
Collection right)
Returns true if the intersection of two collections is empty. |
|
static Number |
div(Character left,
Character right)
Divide one Character by another. |
|
static Number |
div(Character left,
Number right)
Divide a Character by a Number. |
|
static Number |
div(Number left,
Character right)
Divide a Number by a Character. |
|
static void |
downto(BigDecimal self,
Number to,
Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time. |
|
static void |
downto(BigInteger self,
Number to,
Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time. |
|
static void |
downto(double self,
Number to,
Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time. |
|
static void |
downto(Double self,
Number to,
Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time. |
|
static void |
downto(float self,
Number to,
Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time. |
|
static void |
downto(Float self,
Number to,
Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time. |
|
static void |
downto(long self,
Number to,
Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time. |
|
static void |
downto(Long self,
Number to,
Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time. |
|
static void |
downto(Number self,
Number to,
Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time. |
|
static String |
dump(Object self)
Generates a detailed dump string of an object showing its class, hashCode and fields. |
|
static
|
each(Map<K,V> self,
Closure closure)
Allows a Map to be iterated through using a closure. |
|
static
|
each(T self,
Closure closure)
Iterates through an aggregate type or data structure, passing each item to the given closure. |
|
static void |
eachByte(byte[] self,
Closure closure)
Traverse through each byte of this byte array. |
|
static void |
eachByte(Byte[] self,
Closure closure)
Traverse through each byte of this Byte array. |
|
static void |
eachByte(File self,
Closure closure)
Traverse through each byte of this File |
|
static void |
eachByte(InputStream is,
Closure closure)
Traverse through each byte of the specified stream. |
|
static void |
eachByte(URL url,
Closure closure)
Reads the InputStream from this URL, passing each byte to the given closure. |
|
static void |
eachDir(File self,
Closure closure)
Invokes the closure for each subdirectory in this directory, ignoring regular files. |
|
static void |
eachDirMatch(File self,
Object filter,
Closure closure)
Invokes the closure for each subdirectory whose name (dir.name) matches the given filter in the given directory - calling the isCase() method to determine if a match occurs. |
|
static void |
eachDirRecurse(File self,
Closure closure)
Invokes the closure for each descendant directory of this directory. |
|
static void |
eachFile(File self,
Closure closure)
Invokes the closure for each 'child' file in this 'parent' folder/directory. |
|
static void |
eachFileMatch(File self,
Object filter,
Closure closure)
Invokes the closure for each file whose name (file.name) matches the given filter in the given directory - calling the isCase() method to determine if a match occurs. |
|
static void |
eachFileRecurse(File self,
Closure closure)
Invokes the closure for each descendant file in this directory. |
|
static Object |
eachLine(File self,
Closure closure)
Iterates through this file line by line. |
|
static Object |
eachLine(File self,
int firstLine,
Closure closure)
Iterates through this file line by line. |
|
static Object |
eachLine(InputStream stream,
Closure closure)
Iterates through this stream, passing each line to the given 1 or 2 arg closure. |
|
static Object |
eachLine(InputStream stream,
int firstLine,
Closure closure)
Iterates through this stream, passing each line to the given 1 or 2 arg closure. |
|
static Object |
eachLine(InputStream stream,
String charset,
Closure closure)
Iterates through this stream reading with the provided charset, passing each line to the given 1 or 2 arg closure. |
|
static Object |
eachLine(InputStream stream,
String charset,
int firstLine,
Closure closure)
Iterates through this stream reading with the provided charset, passing each line to the given 1 or 2 arg closure. |
|
static Object |
eachLine(Reader self,
Closure closure)
Iterates through the given reader line by line. |
|
static Object |
eachLine(Reader self,
int firstLine,
Closure closure)
Iterates through the given reader line by line. |
|
static Object |
eachLine(String self,
Closure closure)
Iterates through this String line by line. |
|
static Object |
eachLine(String self,
int firstLine,
Closure closure)
Iterates through this String line by line. |
|
static Object |
eachLine(URL url,
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. |
|
static Object |
eachLine(URL url,
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. |
|
static Object |
eachLine(URL url,
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. |
|
static Object |
eachLine(URL url,
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. |
|
static String |
eachMatch(String self,
Pattern pattern,
Closure closure)
Process each regex group matched substring of the given pattern. |
|
static String |
eachMatch(String self,
String regex,
Closure closure)
Process each regex group matched substring of the given string. |
|
static void |
eachObject(File self,
Closure closure)
Iterates through the given file object by object. |
|
static void |
eachObject(ObjectInputStream ois,
Closure closure)
Iterates through the given object stream object by object. |
|
static
|
eachPermutation(Collection<T> self,
Closure closure)
Iterates over all permutations of a collection, running a closure for each iteration. |
|
static
|
eachWithIndex(Map<K,V> self,
Closure closure)
Allows a Map to be iterated through using a closure. |
|
static Object |
eachWithIndex(Object self,
Closure closure)
Iterates through an aggregate type or data structure, passing each item and the item's index (a counter starting at zero) to the given closure. |
|
static Writable |
encodeBase64(byte[] data)
Produce a Writable object which writes the Base64 encoding of the byte array. |
|
static Writable |
encodeBase64(Byte[] data)
Produce a Writable object which writes the Base64 encoding of the byte array. |
|
static Writable |
encodeBase64(byte[] data,
boolean chunked)
Produce a Writable object which writes the Base64 encoding of the byte array. |
|
static Writable |
encodeBase64(Byte[] data,
boolean chunked)
Produce a Writable object which writes the Base64 encoding of the byte array. |
|
static boolean |
equals(int[] left,
int[] right)
Compare the contents of this array to the contents of the given array. |
|
static boolean |
equals(List left,
List right)
Compare the contents of two Lists. |
|
static boolean |
equals(List left,
Object[] right)
Determines if the contents of this list are equal to the contents of the given array in the same order. |
|
static boolean |
equals(Object[] left,
List right)
Determines if the contents of this array are equal to the contents of the given list, in the same order. |
|
static
|
every(Map<K,V> self,
Closure closure)
Iterates over the entries of a map, and checks whether a predicate is valid for all entries. |
|
static boolean |
every(Object self)
Iterates over every element of a collection, and checks whether all elements are true according to the Groovy Truth. |
|
static boolean |
every(Object self,
Closure closure)
Used to determine if the given predicate closure is valid (i.e. |
|
static Process |
execute(List commandList)
Executes the command specified by the String list that is the parameter. |
|
static Process |
execute(String self)
Executes the given string as a command line process. |
|
static Process |
execute(String[] commandArray)
Executes the command specified by the String array that is the parameter. |
|
static Process |
execute(String self,
List envp,
File dir)
Executes the command specified by the self with environments envp
under the working directory dir. |
|
static Process |
execute(String self,
String[] envp,
File dir)
Executes the command specified by the self with environments envp
under the working directory dir. |
|
static Writable |
filterLine(File self,
Closure closure)
Filters the lines of a File and creates a Writeable in return to stream the filtered lines. |
|
static void |
filterLine(File self,
Writer writer,
Closure closure)
Filter the lines from this File, and write them to the given writer based on the given closure predicate. |
|
static Writable |
filterLine(InputStream self,
Closure predicate)
Filter lines from an input stream using a closure predicate. |
|
static void |
filterLine(InputStream self,
Writer writer,
Closure predicate)
Uses a closure to filter lines from this InputStream and pass them to the given writer. |
|
static Writable |
filterLine(Reader reader,
Closure closure)
Filter the lines from this Reader, and return a Writable which can be used to stream the filtered lines to a destination. |
|
static void |
filterLine(Reader reader,
Writer writer,
Closure closure)
Filter the lines from a reader and write them on the writer, according to a closure which returns true if the line should be included. |
|
static
|
find(Collection<T> self,
Closure closure)
Finds the first value matching the closure condition. |
|
static
|
find(Map<K,V> self,
Closure closure)
Finds the first entry matching the closure condition. |
|
static Object |
find(Object self,
Closure closure)
Finds the first value matching the closure condition |
|
static String |
find(String self,
Pattern pattern)
Finds the first occurrence of a compiled regular expression Pattern within a String. |
|
static String |
find(String self,
Pattern pattern,
Closure closure)
Finds the first occurrence of a compiled regular expression Pattern within a String. |
|
static String |
find(String self,
String regex)
Finds the first occurrence of a regular expression String within a String. |
|
static String |
find(String self,
String regex,
Closure closure)
Finds the first occurrence of a regular expression String within a String. |
|
static
|
findAll(Collection<T> self,
Closure closure)
Finds all values matching the closure condition. |
|
static
|
findAll(Map<K,V> self,
Closure closure)
Finds all entries matching the closure condition. |
|
static Collection |
findAll(Object self,
Closure closure)
Finds all items matching the closure condition. |
|
static List |
findAll(String self,
Pattern pattern)
Finds all occurrences of a regular expression Pattern within a String. |
|
static List |
findAll(String self,
Pattern pattern,
Closure closure)
Finds all occurrences of a compiled regular expression Pattern within a String. |
|
static List |
findAll(String self,
String regex)
Finds all occurrences of a regular expression string within a String. |
|
static List |
findAll(String self,
String regex,
Closure closure)
Finds all occurrences of a regular expression string within a String. |
|
static int |
findIndexOf(Object self,
Closure closure)
Iterates over the elements of an iterable collection of items and returns the index of the first item that matches the condition specified in the closure. |
|
static int |
findIndexOf(Object self,
int startIndex,
Closure closure)
Iterates over the elements of an iterable collection of items, starting from a specified startIndex, and returns the index of the first item that matches the condition specified in the closure. |
|
static List<Number> |
findIndexValues(Object self,
Closure closure)
Iterates over the elements of an iterable collection of items and returns the index values of the items that match the condition specified in the closure. |
|
static List<Number> |
findIndexValues(Object self,
Number startIndex,
Closure closure)
Iterates over the elements of an iterable collection of items, starting from a specified startIndex, and returns the index values of the items that match the condition specified in the closure. |
|
static int |
findLastIndexOf(Object self,
Closure closure)
Iterates over the elements of an iterable collection of items and returns the index of the last item that matches the condition specified in the closure. |
|
static int |
findLastIndexOf(Object self,
int startIndex,
Closure closure)
Iterates over the elements of an iterable collection of items, starting from a specified startIndex, and returns the index of the last item that matches the condition specified in the closure. |
|
static
|
first(List<T> self)
Returns the first item from the List. |
|
static Collection |
flatten(boolean[] self)
Flatten an array. |
|
static Collection |
flatten(byte[] self)
Flatten an array. |
|
static Collection |
flatten(char[] self)
Flatten an array. |
|
static Collection |
flatten(Collection self)
Flatten a collection. |
|
static Collection |
flatten(Collection self,
Closure flattenUsing)
Flatten a collection. |
|
static Collection |
flatten(double[] self)
Flatten an array. |
|
static Collection |
flatten(float[] self)
Flatten an array. |
|
static Collection |
flatten(int[] self)
Flatten an array. |
|
static Collection |
flatten(long[] self)
Flatten an array. |
|
static Collection |
flatten(Object[] self)
Flatten an array. |
|
static Collection |
flatten(short[] self)
Flatten an array. |
|
static String |
format(Calendar self,
String pattern)
Shortcut for SimpleDateFormat to output a String representation
of this calendar instance. |
|
static String |
format(Date self,
String format)
Create a String representation of this date according to the given format pattern. |
|
static
|
get(Map<K,V> map,
K key,
V 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. |
|
static boolean |
getAt(BitSet self,
int index)
Support the subscript operator for a Bitset |
|
static BitSet |
getAt(BitSet self,
IntRange range)
Support retrieving a subset of a BitSet using a Range |
|
static List<Boolean> |
getAt(boolean[] array,
Collection indices)
Support the subscript operator with a collection for a boolean array |
|
static List<Boolean> |
getAt(boolean[] array,
IntRange range)
Support the subscript operator with an IntRange for a boolean array |
|
static List<Boolean> |
getAt(boolean[] array,
ObjectRange range)
Support the subscript operator with an ObjectRange for a byte array |
|
static List<Boolean> |
getAt(boolean[] array,
Range range)
Support the subscript operator with a range for a boolean array |
|
static List<Byte> |
getAt(byte[] array,
Collection indices)
Support the subscript operator with a collection for a byte array |
|
static List<Byte> |
getAt(byte[] array,
IntRange range)
Support the subscript operator with an IntRange for a byte array |
|
static List<Byte> |
getAt(byte[] array,
ObjectRange range)
Support the subscript operator with an ObjectRange for a byte array |
|
static List<Byte> |
getAt(byte[] array,
Range range)
Support the subscript operator with a range for a byte array |
|
static List<Character> |
getAt(char[] array,
Collection indices)
Support the subscript operator with a collection for a char array |
|
static List<Character> |
getAt(char[] array,
IntRange range)
Support the subscript operator with an IntRange for a char array |
|
static List<Character> |
getAt(char[] array,
ObjectRange range)
Support the subscript operator with an ObjectRange for a char array |
|
static List<Character> |
getAt(char[] array,
Range range)
Support the subscript operator with a range for a char array |
|
static CharSequence |
getAt(CharSequence self,
Collection indices)
Select a List of characters from a CharSequence using a Collection to identify the indices to be selected. |
|
static CharSequence |
getAt(CharSequence text,
EmptyRange range)
Support the range subscript operator for CharSequence or StringBuffer with EmptyRange |
|
static CharSequence |
getAt(CharSequence text,
int index)
Support the subscript operator for CharSequence. |
|
static CharSequence |
getAt(CharSequence text,
IntRange range)
Support the range subscript operator for CharSequence or StringBuffer with IntRange |
|
static CharSequence |
getAt(CharSequence text,
Range range)
Support the range subscript operator for CharSequence |
|
static List |
getAt(Collection coll,
String property)
Support the subscript operator for List |
|
static int |
getAt(Date self,
int field)
Support the subscript operator for a Date. |
|
static List<Double> |
getAt(double[] array,
Collection indices)
Support the subscript operator with a collection for a double array |
|
static List<Double> |
getAt(double[] array,
IntRange range)
Support the subscript operator with an IntRange for a double array |
|
static List<Double> |
getAt(double[] array,
ObjectRange range)
Support the subscript operator with an ObjectRange for a double array |
|
static List<Double> |
getAt(double[] array,
Range range)
Support the subscript operator with a range for a double array |
|
static List<Float> |
getAt(float[] array,
Collection indices)
Support the subscript operator with a collection for a float array |
|
static List<Float> |
getAt(float[] array,
IntRange range)
Support the subscript operator with an IntRange for a float array |
|
static List<Float> |
getAt(float[] array,
ObjectRange range)
Support the subscript operator with an ObjectRange for a float array |
|
static List<Float> |
getAt(float[] array,
Range range)
Support the subscript operator with a range for a float array |
|
static List<Integer> |
getAt(int[] array,
Collection indices)
Support the subscript operator with a collection for an int array |
|
static List<Integer> |
getAt(int[] array,
IntRange range)
Support the subscript operator with an IntRange for an int array |
|
static List<Integer> |
getAt(int[] array,
ObjectRange range)
Support the subscript operator with an ObjectRange for an int array |
|
static List<Integer> |
getAt(int[] array,
Range range)
Support the subscript operator with a range for an int array |
|
static
|
getAt(List<T> self,
Collection indices)
Select a List of items from a List using a Collection to identify the indices to be selected. |
|
static
|
getAt(List<T> self,
EmptyRange range)
Support the range subscript operator for a List |
|
static
|
getAt(List<T> self,
int idx)
Support the subscript operator for a List. |
|
static
|
getAt(List<T> self,
Range range)
Support the range subscript operator for a List |
|
static List<Long> |
getAt(long[] array,
Collection indices)
Support the subscript operator with a collection for a long array |
|
static List<Long> |
getAt(long[] array,
IntRange range)
Support the subscript operator with an IntRange for a long array |
|
static List<Long> |
getAt(long[] array,
ObjectRange range)
Support the subscript operator with an ObjectRange for a long array |
|
static List<Long> |
getAt(long[] array,
Range range)
Support the subscript operator with a range for a long array |
|
static
|
getAt(Map<K,V> self,
K key)
Support the subscript operator for a Map. |
|
static List |
getAt(Matcher self,
Collection indices)
Select a List of values from a Matcher using a Collection to identify the indices to be selected. |
|
static Object |
getAt(Matcher matcher,
int idx)
Support the subscript operator, e.g. |
|
static Object |
getAt(Object self,
String property)
Allows the subscript operator to be used to lookup dynamic property values. |
|
static List<Short> |
getAt(short[] array,
Collection indices)
Support the subscript operator with a collection for a short array |
|
static List<Short> |
getAt(short[] array,
IntRange range)
Support the subscript operator with an IntRange for a short array |
|
static List<Short> |
getAt(short[] array,
ObjectRange range)
Support the subscript operator with an ObjectRange for a short array |
|
static List<Short> |
getAt(short[] array,
Range range)
Support the subscript operator with a range for a short array |
|
static String |
getAt(String self,
Collection indices)
Select a List of characters from a String using a Collection to identify the indices to be selected. |
|
static String |
getAt(String text,
EmptyRange range)
Support the range subscript operator for String with EmptyRange |
|
static String |
getAt(String text,
int index)
Support the subscript operator for String. |
|
static String |
getAt(String text,
IntRange range)
Support the range subscript operator for String with IntRange |
|
static String |
getAt(String text,
Range range)
Support the range subscript operator for String |
|
static
|
getAt(T[] self,
Collection indices)
Select a List of items from an Object array using a Collection to identify the indices to be selected. |
|
static
|
getAt(T[] array,
EmptyRange range)
|
|
static
|
getAt(T[] array,
IntRange range)
|
|
static
|
getAt(T[] array,
ObjectRange range)
|
|
static
|
getAt(T[] array,
Range range)
Support the range subscript operator for an Array |
|
static char[] |
getChars(String self)
Converts the given String into an array of characters. |
|
static int |
getCount(Matcher matcher)
Find the number of Strings matched to the given Matcher. |
|
static String |
getDateString(Date self)
Return a string representation of the 'day' portion of this date according to the locale-specific DateFormat.SHORT default format. |
|
static String |
getDateTimeString(Date self)
Return a string representation of the date and time time portion of this Date instance, according to the locale-specific format used by DateFormat. |
|
static InputStream |
getErr(Process self)
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 fashion. |
|
static InputStream |
getIn(Process self)
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 fashion. |
|
static MetaClass |
getMetaClass(Class c)
Adds a "metaClass" property to all class objects so you can use the syntax String.metaClass.myMethod = { println "foo" } |
|
static MetaClass |
getMetaClass(GroovyObject obj)
Obtains a MetaClass for an object either from the registry or in the case of a GroovyObject from the object itself. |
|
static MetaClass |
getMetaClass(Object obj)
Obtains a MetaClass for an object either from the registry or in the case of a GroovyObject from the object itself. |
|
static List<PropertyValue> |
getMetaPropertyValues(Object self)
Retrieves the list of MetaProperty objects for 'self' and wraps it
in a list of PropertyValue objects that additionally provide
the value for each property of 'self'. |
|
static OutputStream |
getOut(Process self)
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 fashion. |
|
static Map |
getProperties(Object self)
Convenience method that calls getMetaPropertyValues(Object)(self)
and provides the data in form of simple key/value pairs, i.e. |
|
static ClassLoader |
getRootLoader(ClassLoader self)
Iterates through the classloader parents until it finds a loader with a class named "org.codehaus.groovy.tools.RootLoader". |
|
protected static List |
getSubList(List self,
List splice)
|
|
static String |
getText(BufferedReader reader)
Read the content of the BufferedReader and return it as a String. |
|
static String |
getText(File file)
Read the content of the File and returns it as a String. |
|
static String |
getText(File file,
String charset)
Read the content of the File using the specified encoding and return it as a String. |
|
static String |
getText(InputStream is)
Read the content of this InputStream and return it as a String. |
|
static String |
getText(InputStream is,
String charset)
Read the content of this InputStream using specified charset and return it as a String. |
|
static String |
getText(Process self)
Read the text of the output stream of the Process. |
|
static String |
getText(Reader reader)
Read the content of the Reader and return it as a String. |
|
static String |
getText(URL url)
Read the content of this URL and returns it as a String. |
|
static String |
getText(URL url,
String charset)
Read the data from this URL and return it as a String. |
|
static String |
getTimeString(Date self)
Return a string representation of the time portion of this date according to the locale-specific DateFormat.MEDIUM default format. |
|
static Collection |
grep(Object self,
Object filter)
Iterates over every element of the collection and returns each item that matches the given filter - calling the
method used by switch statements. |
|
protected static
|
groupAnswer(Map<Object,List<T>> answer,
T element,
Object value)
Groups the current element according to the value |
|
static
|
groupBy(Collection<T> self,
Closure closure)
Sorts all collection members into groups determined by the supplied mapping closure. |
|
static
|
groupBy(Map<K,V> self,
Closure closure)
Groups the members of a map into sub maps determined by the supplied mapping closure. |
|
static
|
groupEntriesBy(Map<K,V> self,
Closure closure)
Groups all map entries into groups determined by the supplied mapping closure. |
|
static boolean |
hasGroup(Matcher matcher)
Check whether a Matcher contains a group or not. |
|
static MetaProperty |
hasProperty(Object self,
String name)
Returns true of the implementing MetaClass has a property of the given name Note that this method will only return true for realised properties and does not take into account implementation of getProperty or propertyMissing |
|
static
|
head(List<T> self)
Returns the first item from the List. |
|
static Object |
identity(Object self,
Closure closure)
Allows the closure to be called for the object reference self synonym for 'with()'. |
|
static Object |
inject(Collection self,
Object value,
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. |
|
static Object |
inject(Iterator self,
Object value,
Closure closure)
Iterates through the given iterator, 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. |
|
static Object |
inject(Object[] self,
Object initialValue,
Closure closure)
Iterates through the given array of objects, 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. |
|
static Object |
inject(Object self,
Object value,
Closure closure)
Iterates through the given object, 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. |
|
static String |
inspect(Object self)
Inspects returns the String that matches what would be typed into a terminal to create this object. |
|
static Number |
intdiv(Character left,
Character right)
Integer Divide two Characters. |
|
static Number |
intdiv(Character left,
Number right)
Integer Divide a Character by a Number. |
|
static Number |
intdiv(Number left,
Character right)
Integer Divide a Number by a Character. |
|
static Number |
intdiv(Number left,
Number right)
Integer Divide two Numbers. |
|
static
|
intersect(Collection<T> left,
Collection<T> right)
Create a Collection composed of the intersection of both collections. |
|
static Object |
invokeMethod(Object object,
String method,
Object arguments)
Provide a dynamic method invocation method which can be overloaded in classes to implement dynamic proxies easily. |
|
static boolean |
is(Object self,
Object other)
Identity check. |
|
static boolean |
isBigDecimal(String self)
Determine if a String can be parsed into a BigDecimal. |
|
static boolean |
isBigInteger(String self)
Determine if a String can be parsed into a BigInteger. |
|
static boolean |
isCase(Class caseValue,
Object switchValue)
Special 'Case' implementation for Class, which allows testing for a certain class in a switch statement. |
|
static boolean |
isCase(Collection caseValue,
Object switchValue)
'Case' implementation for collections which tests if the 'switch' operand is contained in any of the 'case' values. |
|
static boolean |
isCase(GString caseValue,
Object switchValue)
'Case' implementation for a GString, which simply calls the equivalet method for String. |
|
static boolean |
isCase(Number caseValue,
Number switchValue)
Special 'case' implementation for all numbers, which delegates to the compareTo() method for comparing numbers of different
types. |
|
static boolean |
isCase(Object caseValue,
Object switchValue)
Method for overloading the behavior of the 'case' method in switch statements. |
|
static boolean |
isCase(Pattern caseValue,
Object switchValue)
'Case' implementation for the Pattern class, which allows
testing a String against a number of regular expressions. |
|
static boolean |
isCase(String caseValue,
Object switchValue)
'Case' implementation for a String, which uses String#equals(Object) in order to allow Strings to be used in switch statements. |
|
static boolean |
isDigit(Character self)
Determines if a character is a digit. |
|
static boolean |
isDouble(String self)
Determine if a String can be parsed into a Double. |
|
static boolean |
isFloat(String self)
Determine if a String can be parsed into a Float. |
|
static boolean |
isInteger(String self)
Determine if a String can be parsed into an Integer. |
|
static boolean |
isLetter(Character self)
Determines if a character is a letter. |
|
static boolean |
isLetterOrDigit(Character self)
Determines if a character is a letter or digit. |
|
static boolean |
isLong(String self)
Determine if a String can be parsed into a Long. |
|
static boolean |
isLowerCase(Character self)
Determine if a Character is lowercase. |
|
static boolean |
isNumber(String self)
Determine if a String can be parsed into a Number. |
|
static boolean |
isUpperCase(Character self)
Determine if a Character is uppercase. |
|
static boolean |
isWhitespace(Character self)
Determines if a character is a whitespace character. |
|
static Iterator<Byte> |
iterator(DataInputStream self)
Standard iterator for a data input stream which iterates through the stream content a Byte at a time. |
|
static
|
iterator(Enumeration<T> enumeration)
Allows an Enumeration to behave like an Iterator. |
|
static Iterator |
iterator(File self)
Deprecated. use File#eachLine instead please |
|
static Iterator<Byte> |
iterator(InputStream self)
Standard iterator for a input stream which iterates through the stream content in a byte-based fashion. |
|
static
|
iterator(Iterator<T> self)
An identity function for iterators, supporting 'duck-typing' when trying to get an iterator for each object within a collection, some of which may already be iterators. |
|
static Iterator |
iterator(Matcher matcher)
Returns an Iterator which traverses each match. |
|
static Iterator<Node> |
iterator(NodeList nodeList)
Deprecated. moved to XmlGroovyMethods |
|
static Iterator |
iterator(Object o)
Attempts to create an Iterator for the given object by first converting it to a Collection. |
|
static Iterator<String> |
iterator(Reader self)
Creates an iterator which will traverse through the reader a line at a time. |
|
static
|
iterator(T[] a)
Attempts to create an Iterator for the given object by first converting it to a Collection. |
|
static String |
join(Collection self,
String separator)
Concatenates the toString() representation of each
item in this collection, with the given String as a separator between
each item. |
|
static String |
join(Iterator self,
String separator)
Concatenates the toString() representation of each
item from the iterator, with the given String as a separator between
each item. |
|
static String |
join(Object[] self,
String separator)
Concatenates the toString() representation of each
items in this array, with the given String as a separator between each
item. |
|
static
|
last(List<T> self)
Returns the last item from the List. |
|
static
|
leftShift(Collection<T> self,
T value)
Overloads the left shift operator to provide an easy way to append objects to a Collection. |
|
static File |
leftShift(File file,
byte[] bytes)
Write bytes to a File. |
|
static File |
leftShift(File file,
InputStream data)
Append binary data to the file. |
|
static File |
leftShift(File file,
Object text)
Write the text to the File. |
|
static
|
leftShift(Map<K,V> self,
Map.Entry<K,V> entry)
Overloads the left shift operator to provide an easy way to append Map.Entry values to a Map. |
|
static Number |
leftShift(Number self,
Number operand)
Implementation of the left shift operator for integral types. |
|
static void |
leftShift(ObjectOutputStream self,
Object value)
Overloads the leftShift operator to add objects to an ObjectOutputStream. |
|
static OutputStream |
leftShift(OutputStream self,
byte[] value)
Overloads the leftShift operator to provide an append mechanism to add bytes to a stream. |
|
static OutputStream |
leftShift(OutputStream self,
InputStream in)
Pipe an InputStream into an OutputStream for efficient stream copying. |
|
static Writer |
leftShift(OutputStream self,
Object value)
Overloads the leftShift operator to provide an append mechanism to add values to a stream. |
|
static OutputStream |
leftShift(Process self,
byte[] value)
Overloads the left shift operator to provide an append mechanism to pipe into a Process |
|
static Writer |
leftShift(Process self,
Object value)
Overloads the left shift operator (<<) to provide an append mechanism to pipe data to a Process. |
|
static OutputStream |
leftShift(Socket self,
byte[] value)
Overloads the left shift operator to provide an append mechanism to add bytes to the output stream of a socket |
|
static Writer |
leftShift(Socket self,
Object value)
Overloads the left shift operator to provide an append mechanism to add things to the output stream of a socket |
|
static StringBuffer |
leftShift(StringBuffer self,
Object value)
Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a StringBuffer. |
|
static StringBuffer |
leftShift(String self,
Object value)
Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a String. |
|
static Writer |
leftShift(Writer self,
Object value)
Overloads the left shift operator to provide a mechanism to append values to a writer. |
|
static boolean |
matches(String self,
Pattern pattern)
Tells whether or not self matches the given compiled regular expression Pattern. |
|
static
|
max(Collection<T> self)
Adds max() method to Collection objects. |
|
static
|
max(Collection<T> self,
Closure closure)
Selects the maximum value found in the collection using the closure to determine the correct ordering. |
|
static
|
max(Collection<T> self,
Comparator<T> comparator)
Selects the maximum value found in the collection using the given comparator. |
|
static
|
max(Iterator<T> self)
Adds max() method to Iterator objects. |
|
static
|
max(Iterator<T> self,
Closure closure)
Selects the maximum value found from the Iterator using the closure to determine the correct ordering. |
|
static
|
max(Iterator<T> self,
Comparator<T> comparator)
Selects the maximum value found from the Iterator using the given comparator. |
|
static
|
max(T[] self)
Adds max() method to Object arrays. |
|
static
|
max(T[] self,
Closure closure)
Selects the maximum value found from the Object array using the closure to determine the correct ordering. |
|
static
|
max(T[] self,
Comparator<T> comparator)
Selects the maximum value found from the Object array using the given comparator. |
|
static MetaClass |
metaClass(Class self,
Closure closure)
Sets/updates the metaclass for a given class to a closure. |
|
static MetaClass |
metaClass(Object self,
Closure closure)
Sets/updates the metaclass for a given object to a closure. |
|
static
|
min(Collection<T> self)
Adds min() method to Collection objects. |
|
static
|
min(Collection<T> self,
Closure closure)
Selects the minimum value found in the collection using the closure to determine the correct ordering. |
|
static
|
min(Collection<T> self,
Comparator<T> comparator)
Selects the minimum value found in the collection using the given comparator. |
|
static
|
min(Iterator<T> self)
Adds min() method to Iterator objects. |
|
static
|
min(Iterator<T> self,
Closure closure)
Selects the minimum value found from the Iterator using the closure to determine the correct ordering. |
|
static
|
min(Iterator<T> self,
Comparator<T> comparator)
Selects the minimum value found from the Iterator using the given comparator. |
|
static
|
min(T[] self)
Adds min() method to Object arrays. |
|
static
|
min(T[] self,
Closure closure)
Selects the minimum value found from the Object array using the closure to determine the correct ordering. |
|
static
|
min(T[] self,
Comparator<T> comparator)
Selects the minimum value found from the Object array using the given comparator. |
|
static int |
minus(Calendar self,
Calendar then)
Subtract another date from this one and return the number of days of the difference. |
|
static Number |
minus(Character left,
Character right)
Subtract one Character from another. |
|
static Number |
minus(Character left,
Number right)
Subtract a Number from a Character. |
|
static int |
minus(Date self,
Date then)
Subtract another Date from this one and return the number of days of the difference. |
|
static Date |
minus(Date self,
int days)
Subtract a number of days from this date and returns the new date. |
|
static Date |
minus(Date self,
int days)
Subtract a number of days from this date and returns the new date. |
|
static
|
minus(List<T> self,
Collection<T> removeMe)
Create a List composed of the elements of the first list minus the elements of the given collection. |
|
static
|
minus(List<T> self,
Object operand)
Create a new List composed of the elements of the first list minus the operand. |
|
static Number |
minus(Number left,
Character right)
Subtract a Character from a Number. |
|
static
|
minus(Set<T> self,
Collection operands)
Create a Set composed of the elements of the first set minus the elements of the given collection. |
|
static
|
minus(Set<T> self,
Object operand)
Create a Set composed of the elements of the first set minus the operand. |
|
static String |
minus(String self,
Object target)
Remove a part of a String. |
|
static
|
minus(T[] self,
Collection<T> removeMe)
Create an array composed of the elements of the first array minus the elements of the given collection. |
|
static
|
minus(T[] self,
Object operand)
Create a new object array composed of the elements of the first array minus the operand. |
|
static
|
minus(T[] self,
T[] removeMe)
Create an array composed of the elements of the first array minus the elements of the given array. |
|
static void |
mixin(Class self,
Class categoryClass)
Extend class globally with category methods. |
|
static void |
mixin(Class self,
Class[] categoryClass)
Extend class globally with category methods. |
|
static void |
mixin(Class self,
List<Class> categoryClasses)
Extend class globally with category methods. |
|
static void |
mixin(MetaClass self,
Class categoryClass)
Extend class globally with category methods. |
|
static void |
mixin(MetaClass self,
Class[] categoryClass)
Extend class globally with category methods. |
|
static void |
mixin(MetaClass self,
List<Class> categoryClasses)
Extend object with category methods. |
|
static Number |
mod(Number left,
Number right)
Performs a division modulus operation. |
|
static Number |
multiply(BigDecimal left,
BigInteger right)
Multiply a BigDecimal and a BigInteger. |
|
static Number |
multiply(BigDecimal left,
Double right)
Multiply a BigDecimal and a Double. |
|
static Number |
multiply(Character left,
Character right)
Multiply two Characters. |
|
static Number |
multiply(Character left,
Number right)
Multiply a Character by a Number. |
|
static
|
multiply(Collection<T> self,
Number factor)
Create a List composed of the elements of this list, repeated a certain number of times. |
|
static Number |
multiply(Number left,
Character right)
Multiply a Number by a Character. |
|
static String |
multiply(String self,
Number factor)
Repeat a String a certain number of times. |
|
static DataInputStream |
newDataInputStream(File file)
Create a data input stream for this file |
|
static DataOutputStream |
newDataOutputStream(File file)
Creates a new data output stream for this file. |
|
static BufferedInputStream |
newInputStream(File file)
Creates a buffered input stream for this file. |
|
static BufferedInputStream |
newInputStream(URL url)
Creates a buffered input stream for this URL. |
|
static Object |
newInstance(Class c)
Convenience method to dynamically create a new instance of this class. |
|
static Object |
newInstance(Class c,
Object[] args)
Helper to construct a new instance from the given arguments. |
|
static ObjectInputStream |
newObjectInputStream(File file)
Create an object input stream for this file. |
|
static ObjectInputStream |
newObjectInputStream(File file,
ClassLoader classLoader)
Create an object input stream for this file using the given class loader. |
|
static ObjectInputStream |
newObjectInputStream(InputStream inputStream)
Create an object input stream for this input stream. |
|
static ObjectInputStream |
newObjectInputStream(InputStream inputStream,
ClassLoader classLoader)
Create an object input stream for this input stream using the given class loader. |
|
static ObjectOutputStream |
newObjectOutputStream(File file)
Create an object output stream for this file. |
|
static ObjectOutputStream |
newObjectOutputStream(OutputStream outputStream)
Create an object output stream for this output stream. |
|
static BufferedOutputStream |
newOutputStream(File file)
Create a buffered output stream for this file. |
|
static PrintWriter |
newPrintWriter(File file)
Create a new PrintWriter for this file. |
|
static PrintWriter |
newPrintWriter(File file,
String charset)
Create a new PrintWriter for this file, using specified charset. |
|
static PrintWriter |
newPrintWriter(Writer writer)
Create a new PrintWriter for this file, using specified charset. |
|
static BufferedReader |
newReader(File file)
Create a buffered reader for this file. |
|
static BufferedReader |
newReader(File file,
String charset)
Create a buffered reader for this file, using the specified charset as the encoding. |
|
static BufferedReader |
newReader(InputStream self)
Creates a reader for this input stream. |
|
static BufferedReader |
newReader(InputStream self,
String charset)
Creates a reader for this input stream, using the specified charset as the encoding. |
|
static BufferedReader |
newReader(URL url)
Creates a buffered reader for this URL. |
|
static BufferedReader |
newReader(URL url,
String charset)
Creates a buffered reader for this URL using the given encoding. |
|
static BufferedWriter |
newWriter(File file)
Create a buffered writer for this file. |
|
static BufferedWriter |
newWriter(File file,
boolean append)
Creates a buffered writer for this file, optionally appending to the existing file content. |
|
static BufferedWriter |
newWriter(File file,
String charset)
Creates a buffered writer for this file, writing data using the given encoding. |
|
static BufferedWriter |
newWriter(File file,
String charset,
boolean append)
Helper method to create a buffered writer for a file. |
|
static Character |
next(Character self)
Increment a Character by one. |
|
static Date |
next(Date self)
Increment a Date by one day. |
|
static Date |
next(Date self)
Increment a java.sql.Date by one day. |
|
static Number |
next(Number self)
Increment a Number by one. |
|
static String |
next(String self)
This method is called by the ++ operator for the class String. |
|
static String |
normalize(String self)
Return a String with linefeeds and carriage returns normalized to linefeeds. |
|
static int |
numberAwareCompareTo(Comparable self,
Comparable other)
Provides a method that compares two comparables using Groovy's default number aware comparator. |
|
static BitSet |
or(BitSet left,
BitSet right)
Bitwise OR together two BitSets. |
|
static Boolean |
or(Boolean left,
Boolean right)
Logical disjunction of two boolean operators |
|
static Number |
or(Number left,
Number right)
Bitwise OR together two numbers. |
|
static Process |
or(Process left,
Process right)
Overrides the or operator to allow one Process to asynchronously pipe data to another Process. |
|
static String |
padLeft(String self,
Number numberOfChars)
Pad a String with the spaces appended to the left |
|
static String |
padLeft(String self,
Number numberOfChars,
String padding)
Pad a String with the characters appended to the left |
|
static String |
padRight(String self,
Number numberOfChars)
Pad a String with the spaces appended to the right |
|
static String |
padRight(String self,
Number numberOfChars,
String padding)
Pad a String with the characters appended to the right |
|
static
|
permutations(List<T> self)
Finds all permutations of a collection. |
|
static Process |
pipeTo(Process left,
Process right)
Allows one Process to asynchronously pipe data to another Process. |
|
static Number |
plus(Character left,
Character right)
Add one Character to another. |
|
static Number |
plus(Character left,
Number right)
Add a Character and a Number. |
|
static
|
plus(Collection<T> left,
Collection<T> right)
Create a Collection as a union of two collections. |
|
static
|
plus(Collection<T> left,
T right)
Create a collection as a union of a Collection and an Object. |
|
static Date |
plus(Date self,
int days)
Add a number of days to this date and returns the new date. |
|
static Date |
plus(Date self,
int days)
Add a number of days to this date and returns the new date. |
|
static
|
plus(Map<K,V> self,
Collection<Map.Entry<K,V>> entries)
Returns a new Map containing all entries from self and entries,
giving precedence to entries. |
|
static
|
plus(Map<K,V> left,
Map<K,V> right)
Returns a new Map containing all entries from left and right,
giving precedence to right. |
|
static Number |
plus(Number left,
Character right)
Add a Number and a Character. |
|
static String |
plus(Number value,
String right)
Appends a String to the string representation of this number. |
|
static String |
plus(StringBuffer left,
String value)
Appends a String to this StringBuffer. |
|
static String |
plus(String left,
Object value)
Appends the String representation of the given operand to this string. |
|
static
|
pop(List<T> self)
Removes the last item from the List. |
|
static Number |
power(Number self,
Number exponent)
Power of a Number to a certain exponent. |
|
static Character |
previous(Character self)
Decrement a Character by one. |
|
static Date |
previous(Date self)
Decrement a Date by one day. |
|
static Date |
previous(Date self)
Decrement a java.sql.Date by one day. |
|
static Number |
previous(Number self)
Decrement a Number by one. |
|
static String |
previous(String self)
This method is called by the -- operator for the class String. |
|
protected static List |
primitiveArrayGet(Object self,
Collection indices)
Implements the getAt(Collection) method for primitve type arrays. |
|
protected static Object |
primitiveArrayGet(Object self,
int idx)
Implements the getAt(int) method for primitve type arrays. |
|
protected static List |
primitiveArrayGet(Object self,
Range range)
Implements the getAt(Range) method for primitve type arrays. |
|
protected static Object |
primitiveArrayPut(Object self,
int idx,
Object newValue)
Implements the setAt(int idx) method for primitve type arrays. |
|
static void |
print(Closure self,
Object value)
Print a value to the standard output stream. |
|
static void |
print(Object self,
Object value)
Print a value formatted Groovy style to self if it is a Writer, otherwise to the standard output stream. |
|
static void |
print(Object self,
PrintWriter out)
Print to a console in interactive format. |
|
static void |
print(PrintStream self,
Object value)
Print a value formatted Groovy style to the print stream. |
|
static void |
print(PrintWriter self,
Object value)
Print a value formatted Groovy style to the print writer. |
|
static void |
printf(Object self,
String format,
Object arg)
Prints a formatted string using the specified format string and arguments. |
|
static void |
printf(Object self,
String format,
Object[] values)
Printf to a console (Only works with JDK1.5 or later). |
|
static void |
println(Closure self)
Print a linebreak to the standard output stream. |
|
static void |
println(Closure self,
Object value)
Print a value (followed by a newline) to the standard output stream. |
|
static void |
println(Object self)
Print a linebreak to the standard output stream. |
|
static void |
println(Object self,
Object value)
Print a value formatted Groovy style (followed by a newline) to self if it is a Writer, otherwise to the standard output stream. |
|
static void |
println(Object self,
PrintWriter out)
Print to a console in interactive format. |
|
static void |
println(PrintStream self,
Object value)
Print a value formatted Groovy style (followed by a newline) to the print stream. |
|
static void |
println(PrintWriter self,
Object value)
Print a value formatted Groovy style (followed by a newline) to the print writer. |
|
static
|
push(List<T> self,
T value)
Appends an item to the List. |
|
static
|
putAll(Map<K,V> self,
Collection<Map.Entry<K,V>> entries)
Provides an easy way to append multiple Map.Entry values to a Map. |
|
static void |
putAt(BitSet self,
int index,
boolean value)
Support subscript-style assignment for a BitSet. |
|
static void |
putAt(BitSet self,
IntRange range,
boolean value)
Support assigning a range of values with a single assignment statement. |
|
static
|
putAt(List<T> self,
int idx,
T value)
A helper method to allow lists to work with subscript operators. |
|
static void |
putAt(List self,
EmptyRange range,
Collection value)
A helper method to allow lists to work with subscript operators. |
|
static void |
putAt(List self,
EmptyRange range,
Object value)
A helper method to allow lists to work with subscript operators. |
|
static void |
putAt(List self,
IntRange range,
Collection col)
List subscript assignment operator when given a range as the index and the assignment operand is a collection. |
|
static void |
putAt(List self,
IntRange range,
Object value)
List subscript assignment operator when given a range as the index. |
|
static void |
putAt(List self,
List splice,
List values)
A helper method to allow lists to work with subscript operators. |
|
static void |
putAt(List self,
List splice,
Object value)
A helper method to allow lists to work with subscript operators. |
|
static
|
putAt(Map<K,V> self,
K key,
V value)
A helper method to allow lists to work with subscript operators |
|
static void |
putAt(Object self,
String property,
Object newValue)
Allows the subscript operator to be used to set dynamically named property values. |
|
static void |
putAt(StringBuffer self,
EmptyRange range,
Object value)
Support the range subscript operator for StringBuffer. |
|
static void |
putAt(StringBuffer self,
IntRange range,
Object value)
Support the range subscript operator for StringBuffer. |
|
static byte[] |
readBytes(File file)
Reads the content of the file into a byte array. |
|
static String |
readLine(InputStream stream)
Deprecated. use Reader#readLine instead please |
|
static String |
readLine(Reader self)
Read a single, whole line from the given Reader. |
|
static List |
readLines(File file)
Reads the file into a list of Strings, with one item for each line. |
|
static List |
readLines(InputStream stream)
Reads the stream into a list, with one element for each line. |
|
static List<String> |
readLines(Reader reader)
Reads the reader into a list of Strings, with one entry for each line. |
|
static List<String> |
readLines(String self)
Return the lines of a String as a List of Strings. |
|
static String |
replaceAll(String self,
Pattern pattern,
String replacement)
Replaces all substrings of a String that match the given compiled regular expression with the given replacement. |
|
static String |
replaceAll(String self,
String regex,
Closure closure)
Replaces all occurrences of a captured group by the result of a closure on that text. |
|
static String |
replaceFirst(String self,
Pattern pattern,
String replacement)
Replaces the first substring of a String that matches the given compiled regular expression with the given replacement. |
|
static List |
respondsTo(Object self,
String name)
Returns an object satisfying Groovy truth if the implementing MetaClass responds to a method with the given name regardless of the arguments. |
|
static List |
respondsTo(Object self,
String name,
Object[] argTypes)
Returns an object satisfying Groovy truth if the implementing MetaClass responds to a method with the given name and arguments types. |
|
static
|
reverse(Iterator<T> self)
Reverses the iterator. |
|
static
|
reverse(List<T> self)
Reverses the list. |
|
static String |
reverse(String self)
Creates a new string which is the reverse (backwards) of this string |
|
static
|
reverse(T[] self)
Reverse the items in an Object array. |
|
static
|
reverseEach(List<T> self,
Closure closure)
Iterate over each element of the list in the reverse order. |
|
static
|
reverseEach(T[] self,
Closure closure)
Iterate over each element of the array in the reverse order. |
|
static Number |
rightShift(Number self,
Number operand)
Implementation of the right shift operator for integral types. |
|
static Number |
rightShiftUnsigned(Number self,
Number operand)
Implementation of the right shift (unsigned) operator for integral types. |
|
static long |
round(Double number)
Round the value |
|
static double |
round(Double number,
int precision)
Round the value |
|
static int |
round(Float number)
Round the value |
|
static float |
round(Float number,
int precision)
Round the value |
|
static TimerTask |
runAfter(Timer timer,
int delay,
Closure closure)
Allows a simple syntax for using timers. |
|
static void |
setIndex(Matcher matcher,
int idx)
Set the position of the given Matcher to the given index. |
|
static void |
setMetaClass(Class self,
MetaClass metaClass)
Sets the metaclass for a given class. |
|
static void |
setMetaClass(Object self,
MetaClass metaClass)
Set the metaclass for an object |
|
static void |
setText(File file,
String text)
Synonym for write(text) allowing file.text = 'foo'. |
|
static int |
size(boolean[] array)
Allows arrays to behave similar to collections. |
|
static int |
size(byte[] array)
Allows arrays to behave similar to collections. |
|
static int |
size(char[] array)
Allows arrays to behave similar to collections. |
|
static int |
size(double[] array)
Allows arrays to behave similar to collections. |
|
static long |
size(File self)
Provide the standard Groovy size() method for File. |
|
static int |
size(float[] array)
Allows arrays to behave similar to collections. |
|
static int |
size(int[] array)
Allows arrays to behave similar to collections. |
|
static int |
size(Iterator self)
Provide the standard Groovy size() method for Iterator. |
|
static int |
size(long[] array)
Allows arrays to behave similar to collections. |
|
static long |
size(Matcher self)
Provide the standard Groovy size() method for Matcher. |
|
static int |
size(Object[] self)
Provide the standard Groovy size() method for an array. |
|
static int |
size(short[] array)
Allows arrays to behave similar to collections. |
|
static int |
size(String text)
Provide the standard Groovy size() method for String. |
|
static int |
size(StringBuffer buffer)
Provide the standard Groovy size() method for StringBuffer. |
|
static
|
sort(Collection<T> self)
Sorts the given collection into a sorted list. |
|
static
|
sort(Collection<T> self,
Closure closure)
Sorts this Collection using the closure to determine the correct ordering. |
|
static
|
sort(Collection<T> self,
Comparator<T> comparator)
Sorts the Collection using the given comparator. |
|
static
|
sort(Iterator<T> self)
Sorts the given iterator items into a sorted iterator. |
|
static
|
sort(Iterator<T> self,
Closure closure)
Sorts the given iterator items into a sorted iterator using the Closure to determine the correct ordering. |
|
static
|
sort(Iterator<T> self,
Comparator<T> comparator)
Sorts the given iterator items into a sorted iterator using the comparator. |
|
static
|
sort(Map<K,V> self,
Closure closure)
Sorts the given map into a sorted map using the closure as a comparator. |
|
static
|
sort(SortedSet<T> self)
Avoids doing unnecessary work when sorting an already sorted set. |
|
static
|
sort(T[] self)
Sorts the given Object array into sorted order. |
|
static
|
sort(T[] self,
Closure closure)
Sorts the given Object array into a newly created array using the Closure to determine the correct ordering. |
|
static
|
sort(T[] self,
Comparator<T> comparator)
Sorts the given Object array into sorted order using the given comparator. |
|
static
|
split(Collection<T> self,
Closure closure)
Splits all items into two collections based on the closure condition. |
|
static String[] |
split(GString self)
Convenience method to split a GString (with whitespace as delimiter). |
|
static Collection |
split(Object self,
Closure closure)
Splits all items into two lists based on the closure condition. |
|
static String[] |
split(String self)
Convenience method to split a string (with whitespace as delimiter) Like tokenize, but returns an Array of Strings instead of a List |
|
static Object |
splitEachLine(File self,
String regex,
Closure closure)
Iterates through this file line by line, splitting each line using the given regex separator. |
|
static Object |
splitEachLine(InputStream stream,
String sep,
Closure closure)
Iterates through the given InputStream line by line, splitting each line using the given separator. |
|
static Object |
splitEachLine(InputStream stream,
String sep,
String charset,
Closure closure)
Iterates through the given InputStream line by line using the specified encoding, splitting each line using the given separator. |
|
static Object |
splitEachLine(Reader self,
String regex,
Closure closure)
Iterates through the given reader line by line, splitting each line using the given regex separator. |
|
static Object |
splitEachLine(String self,
String sep,
Closure closure)
Iterates through the given String line by line, splitting each line using the given separator. |
|
static SpreadMap |
spread(Map self)
Synonym for toSpreadMap(Map). |
|
static String |
sprintf(Object self,
String format,
Object arg)
Returns a formatted string using the specified format string and arguments. |
|
static String |
sprintf(Object self,
String format,
Object[] values)
Sprintf to a string (Only works with JDK1.5 or later). |
|
static void |
step(Number self,
Number to,
Number stepNumber,
Closure closure)
Iterates from this number up to the given number using a step increment. |
|
static
|
subMap(Map<K,V> map,
Collection<K> keys)
Creates a sub-Map containing the given keys. |
|
static
|
subsequences(List<T> self)
Finds all non-null subsequences of a list. |
|
static Object |
sum(Collection self)
Sums the items in a collection. |
|
static Object |
sum(Collection self,
Closure closure)
Sums the result of apply a closure to each item of a collection. |
|
static Object |
sum(Collection self,
Object initialValue)
Sums the items in a collection, adding the result to some initial value. |
|
static Object |
sum(Collection self,
Object initialValue,
Closure closure)
Sums the result of apply a closure to each item of a collection to sum intial value. |
|
static Object |
sum(Iterator self)
Sums the items from an Iterator. |
|
static Object |
sum(Iterator self,
Object initialValue)
Sums the items from an Iterator. |
|
static
|
tail(List<T> self)
Returns the items from the List excluding the first item. |
|
static void |
times(Number self,
Closure closure)
Executes the closure this many times, starting from zero. |
|
static String |
toArrayString(Object[] self)
Returns the string representation of the given array. |
|
static BigDecimal |
toBigDecimal(Number self)
Transform a Number into a BigDecimal |
|
static BigDecimal |
toBigDecimal(String self)
Parse a String into a BigDecimal |
|
static BigInteger |
toBigInteger(Number self)
Transform this Number into a BigInteger. |
|
static BigInteger |
toBigInteger(String self)
Parse a String into a BigInteger |
|
static Boolean |
toBoolean(String self)
Converts the given string into a Boolean object. |
|
static Character |
toCharacter(String self)
Converts the given string into a Character object using the first character in the string. |
|
static Double |
toDouble(Number self)
Transform a Number into a Double |
|
static Double |
toDouble(String self)
Parse a String into a Double |
|
static Float |
toFloat(Number self)
Transform a Number into a Float |
|
static Float |
toFloat(String self)
Parse a String into a Float |
|
static Integer |
toInteger(Number self)
Transform a Number into an Integer |
|
static Integer |
toInteger(String self)
Parse a String into an Integer |
|
static List |
tokenize(String self)
Tokenize a String (with a whitespace as the delimiter). |
|
static List |
tokenize(String self,
String token)
Tokenize a String based on the given string delimiter. |
|
static List<Boolean> |
toList(boolean[] array)
Converts this array to a List of the same size, with each element added to the list. |
|
static List<Byte> |
toList(byte[] array)
Converts this array to a List of the same size, with each element added to the list. |
|
static List<Character> |
toList(char[] array)
Converts this array to a List of the same size, with each element added to the list. |
|
static
|
toList(Collection<T> self)
Convert a collection to a List. |
|
static List<Double> |
toList(double[] array)
Converts this array to a List of the same size, with each element added to the list. |
|
static
|
toList(Enumeration<T> self)
Convert an enumeration to a List. |
|
static List<Float> |
toList(float[] array)
Converts this array to a List of the same size, with each element added to the list. |
|
static List<Integer> |
toList(int[] array)
Converts this array to a List of the same size, with each element added to the list. |
|
static
|
toList(Iterator<T> self)
Convert an iterator to a List. |
|
static List<Long> |
toList(long[] array)
Converts this array to a List of the same size, with each element added to the list. |
|
static List<Short> |
toList(short[] array)
Converts this array to a List of the same size, with each element added to the list. |
|
static List<String> |
toList(String self)
Converts the given String into a List of strings of one character. |
|
static
|
toList(T[] array)
Allows conversion of arrays into a mutable List. |
|
static String |
toListString(Collection self)
Returns the string representation of the given list. |
|
static Long |
toLong(Number self)
Transform a Number into a Long |
|
static Long |
toLong(String self)
Parse a String into a Long |
|
static char |
toLowerCase(Character self)
Converts the character to lowercase. |
|
static String |
toMapString(Map self)
Returns the string representation of this map. |
|
static GroovyRowResult |
toRowResult(ResultSet rs)
Deprecated. moved to SqlGroovyMethods.toRowResult(java.sql.ResultSet) |
|
static Short |
toShort(String self)
Parse a String into a Short |
|
static SpreadMap |
toSpreadMap(Map self)
Returns a new SpreadMap from this map. |
|
static SpreadMap |
toSpreadMap(Object[] self)
Creates a spreadable map from this array. |
|
static String |
toString(AbstractCollection self)
Returns the string representation of the given collection. |
|
static String |
toString(AbstractMap self)
Returns the string representation of the given map. |
|
static String |
toString(boolean[] self)
Returns the string representation of the given array. |
|
static String |
toString(byte[] self)
Returns the string representation of the given array. |
|
static String |
toString(char[] self)
Returns the string representation of the given array. |
|
static String |
toString(double[] self)
Returns the string representation of the given array. |
|
static String |
toString(float[] self)
Returns the string representation of the given array. |
|
static String |
toString(int[] self)
Returns the string representation of the given array. |
|
static String |
toString(long[] self)
Returns the string representation of the given array. |
|
static String |
toString(Object value)
Create a String representation of this object. |
|
static String |
toString(Object[] self)
Returns the string representation of this array's contents. |
|
static String |
toString(short[] self)
Returns the string representation of the given array. |
|
static char |
toUpperCase(Character self)
Converts the character to uppercase. |
|