Java Doc for DefaultGroovyMethods.java in  » Scripting » groovy-1.0 » org » codehaus » groovy » runtime » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » groovy 1.0 » org.codehaus.groovy.runtime 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.codehaus.groovy.runtime.DefaultGroovyMethods

DefaultGroovyMethods
public class DefaultGroovyMethods (Code)
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.
author:
   James Strachan
author:
   Jeremy Rayner
author:
   Sam Pullara
author:
   Rod Cope
author:
   Guillaume Laforge
author:
   John Wilson
author:
   Hein Meling
author:
   Dierk Koenig
author:
   Pilho Kim
author:
   Marc Guillemot
author:
   Russel Winder
author:
   bing ran
author:
   Jochen Theodorou
version:
   $Revision: 4598 $

Inner Class :protected static class ProcessRunner implements Runnable
Inner Class :protected static class RangeInfo



Method Summary
public static  intabs(Number number)
    
public static  longabs(Long number)
    
public static  floatabs(Float number)
    
public static  doubleabs(Double number)
    
public static  Socketaccept(ServerSocket serverSocket, Closure closure)
    
public static  Numberand(Number left, Number right)
    
public static  Booleanand(Boolean left, Boolean right)
    
public static  booleanany(Object self, Closure closure)
    
public static  voidappend(File file, Object text)
    
public static  voidappend(File file, Object text, String charset)
    
public static  MapasImmutable(Map self)
    
public static  SortedMapasImmutable(SortedMap self)
    
public static  ListasImmutable(List self)
    
public static  SetasImmutable(Set self)
    
public static  SortedSetasImmutable(SortedSet self)
    
public static  CollectionasImmutable(Collection self)
    
public static  ListasList(Collection self)
    
public static  MapasSynchronized(Map self)
    
public static  SortedMapasSynchronized(SortedMap self)
    
public static  CollectionasSynchronized(Collection self)
    
public static  ListasSynchronized(List self)
    
public static  SetasSynchronized(Set self)
    
public static  SortedSetasSynchronized(SortedSet self)
    
public static  ObjectasType(Collection col, Class clazz)
    
public static  ObjectasType(Closure cl, Class clazz)
    
public static  ObjectasType(Map map, Class clazz)
    
public static  ObjectasType(Number self, Class c)
    
public static  ObjectasType(File f, Class c)
    
public static  ObjectasType(String self, Class c)
    
public static  ObjectasType(Object obj, Class type)
     Converts a given object to a type.
public static  FileasWritable(File file)
    
public static  FileasWritable(File file, String encoding)
    
protected static  ObjectcallClosureForMapEntry(Closure closure, Map.Entry entry)
    
public static  Stringcenter(String self, Number numberOfChars, String padding)
    
public static  Stringcenter(String self, Number numberOfChars)
    
public static  Listcollect(Object self, 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.
public static  Collectioncollect(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.
public static  Listcollect(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.
public static  Collectioncollect(Collection self, Collection collection, 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.
public static  Collectioncollect(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.
public static  Listcollect(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.
public static  intcompareTo(Character left, Number right)
    
public static  intcompareTo(Number left, Character right)
    
public static  intcompareTo(Character left, Character right)
    
public static  intcompareTo(Number left, Number right)
    
public static  voidconsumeProcessOutput(Process self)
     gets the input and error streams from a process and reads them to avoid the process to block due to a full ouput buffer.
public static  booleancontains(String self, String text)
    
public static  intcount(Collection self, Object value)
    
public static  intcount(String self, String text)
    
protected static  StringBufferWritercreateStringBufferWriter(StringBuffer self)
    
protected static  StringWritercreateStringWriter(String self)
    
public static  byte[]decodeBase64(String value)
    
public static  booleandisjoint(Collection left, Collection right)
     Returns true if the intersection of two collenctions is empty.
public static  Numberdiv(Character left, Number right)
    
public static  Numberdiv(Number left, Character right)
    
public static  Numberdiv(Character left, Character right)
    
public static  Numberdiv(Number left, Number right)
    
public static  voiddownto(Number self, Number to, Closure closure)
    
public static  voiddownto(long self, Number to, Closure closure)
    
public static  voiddownto(Long self, Number to, Closure closure)
    
public static  voiddownto(float self, Number to, Closure closure)
    
public static  voiddownto(Float self, Number to, Closure closure)
    
public static  voiddownto(double self, Number to, Closure closure)
    
public static  voiddownto(Double self, Number to, Closure closure)
    
public static  voiddownto(BigInteger self, Number to, Closure closure)
    
public static  voiddownto(BigDecimal self, Number to, Closure closure)
    
public static  Stringdump(Object self)
    
public static  voideach(Object self, Closure closure)
    
public static  voideach(Collection self, Closure closure)
    
public static  voideach(Map self, Closure closure)
     Allows a Map to be iterated through using a closure.
public static  voideach(Matcher self, Closure closure)
     Process each matched substring of the given group matcher.
public static  voideachByte(File self, Closure closure)
    
public static  voideachByte(InputStream is, Closure closure)
     Traverse through each byte of the specified stream.
public static  voideachByte(URL url, Closure closure)
    
public static  voideachDir(File self, Closure closure)
     Invokes the closure for each directory in the given directory, ignoring regular files.
public static  voideachFile(File self, Closure closure)
    
public static  voideachFileMatch(File self, Object filter, Closure closure)
     Invokes the closure for each file matching the given filter in the given directory - calling the isCase() method used by switch statements.
public static  voideachFileRecurse(File self, Closure closure)
     Invokes the closure for each file in the given directory and recursively.
public static  voideachLine(File self, Closure closure)
    
public static  voideachLine(Reader self, Closure closure)
     Iterates through the given reader line by line.
public static  voideachLine(InputStream stream, Closure closure)
    
public static  voideachLine(URL url, Closure closure)
    
public static  voideachMatch(String self, String regex, Closure closure)
     Process each regex group matched substring of the given string.
public static  voideachObject(File self, Closure closure)
    
public static  voideachObject(ObjectInputStream ois, Closure closure)
     Iterates through the given object stream object by object.
public static  voideachWithIndex(Object self, Closure closure)
    
public static  WritableencodeBase64(Byte[] data)
    
public static  WritableencodeBase64(byte[] data)
    
public static  booleanequals(List left, List right)
     Compare two Lists.
public static  booleanevery(Object self, Closure closure)
     Iterates over every element of a collection, and check whether a predicate is valid for all elements.
public static  Processexecute(String self)
     Executes the given string as a command line process.
public static  Processexecute(String[] commandArray)
     Executes the command specified by the String array that is the parameter. The first item in the array is the command the others are the parameters.
public static  Processexecute(String self, String[] envp, File dir)
     Executes the command specified by the self with environments envp under the working directory dir. For more control over the process mechanism in JDK 1.5 you can use java.lang.ProcessBuilder.
Parameters:
  self - a command line String to be executed.
Parameters:
  envp - an array of Strings, each element of whichhas environment variable settings in the formatname=value, ornull if the subprocess should inheritthe environment of the current process.
Parameters:
  dir - the working directory of the subprocess, ornull if the subprocess should inheritthe working directory of the current process.
public static  Processexecute(List commandList)
     Executes the command specified by the String list that is the parameter. The first item in the array is the command the others are the parameters.
public static  Processexecute(String self, List envp, File dir)
     Executes the command specified by the self with environments envp under the working directory dir. For more control over the process mechanism in JDK 1.5 you can use java.lang.ProcessBuilder.
Parameters:
  self - a command line String to be executed.
Parameters:
  envp - a List of Strings, each member of whichhas environment variable settings in the formatname=value, ornull if the subprocess should inheritthe environment of the current process.
Parameters:
  dir - the working directory of the subprocess, ornull if the subprocess should inheritthe working directory of the current process.
public static  voidfilterLine(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 or false.
public static  WritablefilterLine(File self, Closure closure)
    
public static  voidfilterLine(File self, Writer writer, Closure closure)
    
public static  WritablefilterLine(Reader reader, Closure closure)
     Filter the lines of a Reader and create a Writable in return to stream the filtered lines.
public static  WritablefilterLine(InputStream self, Closure predicate)
    
public static  voidfilterLine(InputStream self, Writer writer, Closure predicate)
     Filters lines from an input stream, writing to a writer, using a closure which returns boolean and takes a line.
public static  Objectfind(Object self, Closure closure)
    
public static  Objectfind(Collection self, Closure closure)
    
public static  Objectfind(Map self, Closure closure)
    
public static  ListfindAll(Object self, Closure closure)
    
public static  ListfindAll(Collection self, Closure closure)
    
public static  MapfindAll(Map self, Closure closure)
     Finds all entries matching the closure condition.
public static  intfindIndexOf(Object self, Closure closure)
    
public static  Listflatten(List self)
    
public static  Objectget(Map map, Object key, 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.
public static  ObjectgetAt(Object self, String property)
     Allows the subscript operator to be used to lookup dynamic property values. bean[somePropertyNameExpression].
public static  CharSequencegetAt(CharSequence text, int index)
     Support the subscript operator for String.
public static  StringgetAt(String text, int index)
    
public static  CharSequencegetAt(CharSequence text, Range range)
    
public static  CharSequencegetAt(CharSequence text, IntRange range)
    
public static  StringgetAt(String text, IntRange range)
    
public static  StringgetAt(String text, Range range)
    
public static  ObjectgetAt(Matcher matcher, int idx)
     Support the subscript operator, e.g.
public static  ListgetAt(List self, IntRange range)
    
public static  ListgetAt(List self, Collection indices)
    
public static  ListgetAt(Object[] self, Collection indices)
    
public static  CharSequencegetAt(CharSequence self, Collection indices)
    
public static  StringgetAt(String self, Collection indices)
    
public static  StringgetAt(Matcher self, Collection indices)
    
public static  ListgetAt(Object[] array, Range range)
    
public static  ListgetAt(Object[] array, IntRange range)
    
public static  ListgetAt(Object[] array, ObjectRange range)
    
public static  ObjectgetAt(Object[] array, int idx)
    
public static  ObjectgetAt(List self, int idx)
    
public static  ObjectgetAt(Map self, Object key)
    
public static  ListgetAt(Collection coll, String property)
    
public static  ObjectgetAt(byte[] array, int idx)
    
public static  ObjectgetAt(char[] array, int idx)
    
public static  ObjectgetAt(short[] array, int idx)
    
public static  ObjectgetAt(int[] array, int idx)
    
public static  ObjectgetAt(long[] array, int idx)
    
public static  ObjectgetAt(float[] array, int idx)
    
public static  ObjectgetAt(double[] array, int idx)
    
public static  ObjectgetAt(boolean[] array, int idx)
    
public static  ObjectgetAt(byte[] array, Range range)
    
public static  ObjectgetAt(char[] array, Range range)
    
public static  ObjectgetAt(short[] array, Range range)
    
public static  ObjectgetAt(int[] array, Range range)
    
public static  ObjectgetAt(long[] array, Range range)
    
public static  ObjectgetAt(float[] array, Range range)
    
public static  ObjectgetAt(double[] array, Range range)
    
public static  ObjectgetAt(boolean[] array, Range range)
    
public static  ObjectgetAt(byte[] array, IntRange range)
    
public static  ObjectgetAt(char[] array, IntRange range)
    
public static  ObjectgetAt(short[] array, IntRange range)
    
public static  ObjectgetAt(int[] array, IntRange range)
    
public static  ObjectgetAt(long[] array, IntRange range)
    
public static  ObjectgetAt(float[] array, IntRange range)
    
public static  ObjectgetAt(double[] array, IntRange range)
    
public static  ObjectgetAt(boolean[] array, IntRange range)
    
public static  ObjectgetAt(byte[] array, ObjectRange range)
    
public static  ObjectgetAt(char[] array, ObjectRange range)
    
public static  ObjectgetAt(short[] array, ObjectRange range)
    
public static  ObjectgetAt(int[] array, ObjectRange range)
    
public static  ObjectgetAt(long[] array, ObjectRange range)
    
public static  ObjectgetAt(float[] array, ObjectRange range)
    
public static  ObjectgetAt(double[] array, ObjectRange range)
    
public static  ObjectgetAt(boolean[] array, ObjectRange range)
    
public static  ObjectgetAt(byte[] array, Collection indices)
    
public static  ObjectgetAt(char[] array, Collection indices)
    
public static  ObjectgetAt(short[] array, Collection indices)
    
public static  ObjectgetAt(int[] array, Collection indices)
    
public static  ObjectgetAt(long[] array, Collection indices)
    
public static  ObjectgetAt(float[] array, Collection indices)
    
public static  ObjectgetAt(double[] array, Collection indices)
    
public static  ObjectgetAt(boolean[] array, Collection indices)
    
public static  intgetCount(Matcher matcher)
     Find the number of Strings matched to the given Matcher.
public static  InputStreamgetErr(Process self)
    
public static  InputStreamgetIn(Process self)
    
public static  ListgetMetaPropertyValues(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'.
public static  OutputStreamgetOut(Process self)
    
public static  MapgetProperties(Object self)
     Convenience method that calls DefaultGroovyMethods.getMetaPropertyValues(Object) (self) and provides the data in form of simple key/value pairs, i.e.
public static  ClassLoadergetRootLoader(ClassLoader cl)
     Iterates through the class loader parents until it finds a loader with a class named equal to org.codehaus.groovy.tools.RootLoader.
protected static  ListgetSubList(List self, List splice)
    
public static  StringgetText(File file, String charset)
    
public static  StringgetText(File file)
    
public static  StringgetText(URL url)
    
public static  StringgetText(URL url, String charset)
    
public static  StringgetText(InputStream is)
    
public static  StringgetText(InputStream is, String charset)
    
public static  StringgetText(Reader reader)
    
public static  StringgetText(BufferedReader reader)
     Reads the content of the BufferedReader and returns it as a String.
public static  StringgetText(Process self)
     Read the text of the output stream of the Process.
public static  Listgrep(Object self, 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.
public static  MapgroupBy(Collection self, Closure closure)
     Groups all collection members into groups determined by the supplied mapping closure.
public static  booleanhasGroup(Matcher matcher)
     Check whether a Matcher contains a group or not.
public static  Objectidentity(Object self, Closure closure)
    
public static  Objectinject(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.
public static  Objectinject(Object[] self, Object value, 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.
public static  Stringinspect(Object self)
     a String that matches what would be typed into a terminal tocreate this object.
public static  Numberintdiv(Character left, Number right)
    
public static  Numberintdiv(Number left, Character right)
    
public static  Numberintdiv(Character left, Character right)
    
public static  Numberintdiv(Number left, Number right)
    
public static  Listintersect(Collection left, Collection right)
    
public static  ObjectinvokeMethod(Object object, String method, Object arguments)
     Provide a dynamic method invocation method which can be overloaded in classes to implement dynamic proxies easily.
public static  booleanis(Object self, Object other)
     Identity check.
public static  booleanisCase(Object caseValue, Object switchValue)
    
public static  booleanisCase(String caseValue, Object switchValue)
    
public static  booleanisCase(Class caseValue, Object switchValue)
    
public static  booleanisCase(Collection caseValue, Object switchValue)
    
public static  booleanisCase(Pattern caseValue, Object switchValue)
    
public static  Iteratoriterator(Object o)
    
public static  Iteratoriterator(Enumeration enumeration)
    
public static  Iteratoriterator(NodeList nodeList)
    
public static  Iteratoriterator(Matcher matcher)
    
public static  Iteratoriterator(Reader value)
    
public static  Iteratoriterator(InputStream is)
     Standard iterator for a input stream which iterates through the stream content in a byte-based fashion.
public static  Iteratoriterator(DataInputStream dis)
     Standard iterator for a data input stream which iterates through the stream content in a byte-based fashion.
public static  Iteratoriterator(File f)
     Standard iterator for a file which iterates through the file content in a line-based fashion.
public static  Iteratoriterator(Iterator it)
    
public static  Stringjoin(Collection self, String separator)
    
public static  Stringjoin(Object[] self, String separator)
    
public static  CollectionleftShift(Collection self, Object value)
     Overloads the left shift operator to provide an easy way to append objects to a list
Parameters:
  self - a Collection
Parameters:
  value - an Object to be added to the collection.
public static  StringBufferleftShift(String self, Object value)
    
public static  StringBufferleftShift(StringBuffer self, Object value)
    
public static  WriterleftShift(Writer self, Object value)
    
public static  NumberleftShift(Number left, Number right)
     Implementation of the left shift operator for integral types.
public static  WriterleftShift(OutputStream self, Object value)
    
public static  OutputStreamleftShift(OutputStream self, InputStream in)
     Pipe an inputstream into an outputstream for efficient stream copying.
public static  OutputStreamleftShift(OutputStream self, byte[] value)
    
public static  FileleftShift(File file, Object text)
     Write the text to the File.
public static  WriterleftShift(Socket self, Object value)
    
public static  OutputStreamleftShift(Socket self, byte[] value)
    
public static  WriterleftShift(Process self, Object value)
    
public static  OutputStreamleftShift(Process self, byte[] value)
    
public static  Objectmax(Collection self)
    
public static  Objectmax(Collection self, Comparator comparator)
    
public static  Objectmax(Collection self, Closure closure)
    
public static  Objectmin(Collection self)
    
public static  Objectmin(Collection self, Comparator comparator)
    
public static  Objectmin(Collection self, Closure closure)
    
public static  Listminus(List self, Collection removeMe)
    
public static  Listminus(List self, Object operand)
    
public static  Stringminus(String left, Object value)
    
public static  Numberminus(Character left, Number right)
    
public static  Numberminus(Number left, Character right)
    
public static  Numberminus(Character left, Character right)
    
public static  Numberminus(Number left, Number right)
    
public static  Dateminus(Date self, int days)
    
public static  java.sql.Dateminus(java.sql.Date self, int days)
    
public static  Numbermod(Number left, Number right)
    
public static  Listmultiply(Collection self, Number factor)
     Create a List composed of the same elements repeated a certain number of times.
public static  Stringmultiply(String self, Number factor)
    
public static  Numbermultiply(Character left, Number right)
    
public static  Numbermultiply(Number left, Character right)
    
public static  Numbermultiply(Character left, Character right)
    
public static  Numbermultiply(Number left, Number right)
    
public static  Numbermultiply(BigDecimal left, Double right)
     Multiply a BigDecimal and a Double. Note: This method was added to enforce the Groovy rule of BigDecimal*Double == Double.
public static  Numbermultiply(BigDecimal left, BigInteger right)
     Multiply a BigDecimal and a BigInteger. Note: This method was added to enforce the Groovy rule of BigDecimal*long == long.
public static  Patternnegate(String self)
    
public static  Numbernegate(Number left)
    
public static  BufferedInputStreamnewInputStream(File file)
    
public static  ObjectnewInstance(Class c)
    
public static  ObjectnewInstance(Class c, Object[] args)
    
public static  ObjectInputStreamnewObjectInputStream(File file)
     Helper method to create an object input stream from the given file.
public static  BufferedOutputStreamnewOutputStream(File file)
    
public static  PrintWriternewPrintWriter(File file)
    
public static  PrintWriternewPrintWriter(File file, String charset)
    
public static  BufferedReadernewReader(File file)
    
public static  BufferedReadernewReader(File file, String charset)
    
public static  BufferedReadernewReader(InputStream self)
    
public static  BufferedWriternewWriter(File file)
    
public static  BufferedWriternewWriter(File file, boolean append)
    
public static  BufferedWriternewWriter(File file, String charset, boolean append)
    
public static  BufferedWriternewWriter(File file, String charset)
    
public static  Stringnext(String self)
     This method is called by the ++ operator for the class String. It increments the last character in the given string.
public static  Numbernext(Character self)
    
public static  Numbernext(Number self)
    
public static  Datenext(Date self)
    
public static  java.sql.Datenext(java.sql.Date self)
    
protected static  intnormaliseIndex(int i, int size)
     This converts a possibly negative index to a real index into the array.
public static  Numberor(Number left, Number right)
    
public static  Booleanor(Boolean left, Boolean right)
    
public static  StringpadLeft(String self, Number numberOfChars, String padding)
    
public static  StringpadLeft(String self, Number numberOfChars)
    
public static  StringpadRight(String self, Number numberOfChars, String padding)
    
public static  StringpadRight(String self, Number numberOfChars)
    
public static  Listplus(Collection left, Collection right)
    
public static  Listplus(Collection left, Object right)
    
public static  Stringplus(String left, Object value)
    
public static  Stringplus(Number value, String right)
    
public static  Stringplus(StringBuffer left, String value)
    
public static  Numberplus(Character left, Number right)
    
public static  Numberplus(Number left, Character right)
    
public static  Numberplus(Character left, Character right)
    
public static  Numberplus(Number left, Number right)
     Add two numbers and return the result.
public static  Dateplus(Date self, int days)
    
public static  java.sql.Dateplus(java.sql.Date self, int days)
    
public static  Objectpop(List self)
     Removes the last item from the List.
public static  Numberpower(Number self, Number exponent)
    
public static  Stringprevious(String self)
     This method is called by the -- operator for the class String. It decrements the last character in the given string.
public static  Numberprevious(Character self)
    
public static  Numberprevious(Number self)
    
public static  Dateprevious(Date self)
    
public static  java.sql.Dateprevious(java.sql.Date self)
    
protected static  ObjectprimitiveArrayGet(Object array, int idx)
    
protected static  ListprimitiveArrayGet(Object array, Range range)
    
protected static  ListprimitiveArrayGet(Object self, Collection indices)
    
protected static  voidprimitiveArrayPut(Object array, int idx, Object newValue)
    
public static  voidprint(Object self, Object value)
    
public static  voidprint(Object self, PrintWriter out)
    
public static  voidprintf(Object self, String format, Object[] values)
     Printf to a console.
public static  voidprintf(Object self, String format, Object arg)
     Returns a formatted string using the specified format string and arguments.

For examples,

 printf ( "Hello, %s!\n" , [ "world" ] as String[] )
 printf ( "Hello, %s!\n" , [ "Groovy" ])
 printf ( "%d + %d = %d\n" , [ 1 , 2 , 1+2 ] as Integer[] )
 printf ( "%d + %d = %d\n" , [ 3 , 3 , 3+3 ])
 

( 1..5 ).each { printf ( "-- %d\n" , [ it ] as Integer[] ) } ( 1..5 ).each { printf ( "-- %d\n" , [ it ] as int[] ) } ( 0x41..0x45 ).each { printf ( "-- %c\n" , [ it ] as char[] ) } ( 07..011 ).each { printf ( "-- %d\n" , [ it ] as byte[] ) } ( 7..11 ).each { printf ( "-- %d\n" , [ it ] as short[] ) } ( 7..11 ).each { printf ( "-- %d\n" , [ it ] as long[] ) } ( 7..11 ).each { printf ( "-- %5.2f\n" , [ it ] as float[] ) } ( 7..11 ).each { printf ( "-- %5.2g\n" , [ it ] as double[] ) }


Parameters:
  format - A format string
Parameters:
  arg - Argument which is referenced by the format specifiers in the formatstring.

public static  voidprintln(Object self)
     Print a linebreak to the standard out.
public static  voidprintln(Object self, Object value)
    
public static  voidprintln(Object self, PrintWriter out)
    
public static  voidputAt(Object self, String property, Object newValue)
     Allows the subscript operator to be used to set dynamically named property values. bean[somePropertyNameExpression] = foo.
public static  voidputAt(Object[] array, int idx, Object value)
    
public static  voidputAt(List self, int idx, Object value)
    
public static  voidputAt(StringBuffer self, IntRange range, Object value)
    
public static  voidputAt(StringBuffer self, EmptyRange range, Object value)
    
public static  voidputAt(List self, EmptyRange range, Object value)
    
public static  voidputAt(List self, IntRange range, Object value)
    
public static  voidputAt(List self, List splice, List values)
    
public static  voidputAt(List self, List splice, Object value)
    
public static  ObjectputAt(Map self, Object key, Object value)
    
public static  voidputAt(boolean[] array, int idx, Boolean newValue)
    
public static  voidputAt(byte[] array, int idx, Object newValue)
    
public static  voidputAt(char[] array, int idx, Object newValue)
    
public static  voidputAt(short[] array, int idx, Object newValue)
    
public static  voidputAt(int[] array, int idx, Object newValue)
    
public static  voidputAt(long[] array, int idx, Object newValue)
    
public static  voidputAt(float[] array, int idx, Object newValue)
    
public static  voidputAt(double[] array, int idx, Object newValue)
    
public static  byte[]readBytes(File file)
    
public static  StringreadLine(Reader self)
    
public static  StringreadLine(InputStream stream)
    
public static  ListreadLines(File file)
    
public static  ListreadLines(Reader reader)
    
public static  ListreadLines(InputStream stream)
    
public static  StringreplaceAll(String self, String regex, Closure closure)
     Replaces all occurrencies of a captured group by the result of a closure on that text.
public static  Stringreverse(String self)
    
public static  Listreverse(List self)
    
public static  voidreverseEach(List self, Closure closure)
     Iterate over each element of the list in the reverse order.
public static  NumberrightShift(Number left, Number right)
     Implementation of the right shift operator for integral types.
public static  NumberrightShiftUnsigned(Number left, Number right)
     Implementation of the right shift (unsigned) operator for integral types.
public static  intround(Float number)
    
public static  longround(Double number)
    
public static  voidrunAfter(Timer timer, int delay, Closure closure)
     Allow simple syntax for using timers.
public static  voidsetIndex(Matcher matcher, int idx)
     Set the position of the given Matcher to the given index.
public static  intsize(String text)
    
public static  intsize(StringBuffer buffer)
    
public static  longsize(File file)
    
public static  longsize(Matcher matcher)
    
public static  intsize(Object[] self)
    
public static  intsize(byte[] array)
    
public static  intsize(char[] array)
    
public static  intsize(short[] array)
    
public static  intsize(int[] array)
    
public static  intsize(long[] array)
    
public static  intsize(float[] array)
    
public static  intsize(double[] array)
    
public static  Listsort(Collection self)
     Sorts the given collection into a sorted list.
public static  SortedSetsort(SortedSet self)
    
public static  Listsort(Collection self, Comparator comparator)
    
public static  Listsort(Collection self, Closure closure)
    
public static  voidsplitEachLine(File self, String sep, Closure closure)
    
public static  voidsplitEachLine(Reader self, String sep, Closure closure)
     Iterates through the given reader line by line, splitting on the separator.
public static  SpreadMapspread(Map self)
    
public static  voidstep(Number self, Number to, Number stepNumber, Closure closure)
    
protected static  RangeInfosubListBorders(int size, IntRange range)
    
protected static  RangeInfosubListBorders(int size, EmptyRange range)
    
public static  MapsubMap(Map map, Collection keys)
     Creates a sub-Map containing the given keys.
public static  Objectsum(Collection self)
     Sums a collection of numeric values.
public static  Objectsum(Collection self, Closure closure)
     Sums the result of apply a closure to each item of a collection. coll.sum(closure) is equivalent to: coll.collect(closure).sum().
Parameters:
  self - a Collection
Parameters:
  closure - a single parameter closure that returns a numeric value.
public static  voidtimes(Number self, Closure closure)
    
public static  StringtoArrayString(Object[] self)
     Returns the string representation of the given array with the brace boundaries.
public static  BigDecimaltoBigDecimal(String self)
    
public static  BigDecimaltoBigDecimal(Number self)
    
public static  BigIntegertoBigInteger(String self)
    
public static  BigIntegertoBigInteger(Number self)
    
public static  BooleantoBoolean(String self)
    
public static  CharactertoCharacter(String self)
    
public static  DoubletoDouble(String self)
    
public static  DoubletoDouble(Number self)
    
public static  FloattoFloat(String self)
    
public static  FloattoFloat(Number self)
    
public static  IntegertoInteger(String self)
    
public static  IntegertoInteger(Number self)
    
public static  ListtoList(Collection self)
     Convert a collection to a List.
public static  ListtoList(Object[] array)
    
public static  ListtoList(byte[] array)
    
public static  ListtoList(char[] array)
    
public static  ListtoList(short[] array)
    
public static  ListtoList(int[] array)
    
public static  ListtoList(long[] array)
    
public static  ListtoList(float[] array)
    
public static  ListtoList(double[] array)
    
public static  ListtoList(String self)
    
public static  StringtoListString(Collection self)
     Returns the string representation of the given collection with the bracket boundaries.
public static  LongtoLong(String self)
    
public static  LongtoLong(Number self)
    
public static  StringtoMapString(Map self)
     Returns the string representation of the given map with bracket boundaries.
public static  SpreadMaptoSpreadMap(Map self)
     Returns the converted SpreadLMap of the given self.
public static  SpreadMaptoSpreadMap(Object[] self)
    
public static  StringtoString(Map self)
     Returns the string representation of the given map with bracket boundaries.
public static  StringtoString(Collection self)
     Returns the string representation of the given collection with the bracket boundaries.
public static  StringtoString(Object[] self)
     Returns the string representation of the given array with the brace boundaries.
protected static  StringtoString(Object value)
    
public static  URItoURI(String self)
     Transforms a String representing a URI into a URI object.
public static  URLtoURL(String self)
     Transforms a String representing a URL into a URL object.
public static  Listtokenize(String self, String token)
    
public static  Listtokenize(String self)
    
public static  voidtransformChar(Reader reader, Writer writer, Closure closure)
     Transforms the characters from a reader with a Closure and write them to a writer.
public static  voidtransformLine(Reader reader, Writer writer, Closure closure)
     Transforms the lines from a reader with a Closure and write them to a writer.
public static  Collectionunique(Collection self)
    
public static  Collectionunique(Collection self, Closure closure)
    
public static  Collectionunique(Collection self, Comparator comparator)
     Remove all duplicates from a given Collection. Works on the receiver object and returns it. The order of members in the Collection are compared by the given Comparator. For each duplicate, the first member which is returned by the given Collection's iterator is retained, but all other ones are removed. The given Collection's original order is preserved.

 class Person {

Parameters:
  self - a Collection
Parameters:
  comparator - a Comparator.
public static  voidupto(Number self, Number to, Closure closure)
    
public static  voidupto(long self, Number to, Closure closure)
    
public static  voidupto(Long self, Number to, Closure closure)
    
public static  voidupto(float self, Number to, Closure closure)
    
public static  voidupto(Float self, Number to, Closure closure)
    
public static  voidupto(Double self, Number to, Closure closure)
    
public static  voidupto(BigInteger self, Number to, Closure closure)
    
public static  voidupto(BigDecimal self, Number to, Closure closure)
    
public static  voiduse(Object self, Class categoryClass, Closure closure)
    
public static  voiduse(Object self, List categoryClassList, Closure closure)
    
public static  voiduse(Object self, Object[] array)
     use() a list of categories, specifying the list as varargs:
use(CategoryClass1, CategoryClass2) { ...
public static  voidwaitForOrKill(Process self, long numberOfMillis)
     Wait for the process to finish during a certain amount of time, otherwise stops the process.
public static  voidwithInputStream(File file, Closure closure)
    
public static  voidwithOutputStream(File file, Closure closure)
    
public static  voidwithPrintWriter(File file, Closure closure)
    
public static  voidwithReader(File file, Closure closure)
    
public static  voidwithReader(Reader reader, Closure closure)
    
public static  voidwithReader(URL url, Closure closure)
    
public static  voidwithReader(InputStream in, Closure closure)
    
public static  voidwithStream(InputStream stream, Closure closure)
    
public static  voidwithStream(OutputStream os, 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.
public static  voidwithStreams(Socket socket, 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.
public static  voidwithWriter(File file, Closure closure)
    
public static  voidwithWriter(File file, String charset, Closure closure)
    
public static  voidwithWriter(Writer writer, Closure closure)
    
public static  voidwithWriter(OutputStream stream, Closure closure)
    
public static  voidwithWriter(OutputStream stream, String charset, 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.
public static  voidwithWriterAppend(File file, String charset, Closure closure)
    
public static  voidwrite(Writer self, 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.
public static  voidwrite(File file, String text)
     Write the text to the File.
public static  voidwrite(File file, String text, String charset)
     Write the text to the File with a specified encoding.
public static  voidwriteLine(BufferedWriter writer, String line)
    
public static  Numberxor(Number left, Number right)
    
public static  Booleanxor(Boolean left, Boolean right)
    



Method Detail
abs
public static int abs(Number number)(Code)
Get the absolute value
Parameters:
  number - a Number the absolute value of that Number



abs
public static long abs(Long number)(Code)
Get the absolute value
Parameters:
  number - a Long the absolute value of that Long



abs
public static float abs(Float number)(Code)
Get the absolute value
Parameters:
  number - a Float the absolute value of that Float



abs
public static double abs(Double number)(Code)
Get the absolute value
Parameters:
  number - a Double the absolute value of that Double



accept
public static Socket accept(ServerSocket serverSocket, Closure closure) throws IOException(Code)
Allow to pass a Closure to the accept methods of ServerSocket
Parameters:
  serverSocket - a ServerSocket
Parameters:
  closure - a Closure a Socket
throws:
  IOException -



and
public static Number and(Number left, Number right)(Code)
Bitwise AND together two Numbers
Parameters:
  left - a Number
Parameters:
  right - another Number to bitwse AND the bitwise AND of both Numbers



and
public static Boolean and(Boolean left, Boolean right)(Code)



any
public static boolean any(Object self, Closure closure)(Code)
Iterates over every element of a collection, and check whether a predicate is valid for at least one element
Parameters:
  self - the object over which we iterate
Parameters:
  closure - the closure predicate used for matching true if any item in the collection matches the closure predicate



append
public static void append(File file, Object text) throws IOException(Code)
Append the text at the end of the File
Parameters:
  file - a File
Parameters:
  text - the text to append at the end of the File
throws:
  IOException -



append
public static void append(File file, Object text, String charset) throws IOException(Code)
Append the text at the end of the File with a specified encoding
Parameters:
  file - a File
Parameters:
  text - the text to append at the end of the File
Parameters:
  charset - the charset used
throws:
  IOException -



asImmutable
public static Map asImmutable(Map self)(Code)
A convenience method for creating an immutable map
Parameters:
  self - a Map an immutable Map



asImmutable
public static SortedMap asImmutable(SortedMap self)(Code)
A convenience method for creating an immutable sorted map
Parameters:
  self - a SortedMap an immutable SortedMap



asImmutable
public static List asImmutable(List self)(Code)
A convenience method for creating an immutable list
Parameters:
  self - a List an immutable List



asImmutable
public static Set asImmutable(Set self)(Code)
A convenience method for creating an immutable list
Parameters:
  self - a Set an immutable Set



asImmutable
public static SortedSet asImmutable(SortedSet self)(Code)
A convenience method for creating an immutable sorted set
Parameters:
  self - a SortedSet an immutable SortedSet



asImmutable
public static Collection asImmutable(Collection self)(Code)
A convenience method for creating an immutable Collection
Parameters:
  self - a Collection an immutable Collection



asList
public static List asList(Collection self)(Code)
Converts the given collection into a List
Parameters:
  self - a collection to be converted into a List a newly created List if this collection is not already a List



asSynchronized
public static Map asSynchronized(Map self)(Code)
A convenience method for creating a synchronized Map
Parameters:
  self - a Map a synchronized Map



asSynchronized
public static SortedMap asSynchronized(SortedMap self)(Code)
A convenience method for creating a synchronized SortedMap
Parameters:
  self - a SortedMap a synchronized SortedMap



asSynchronized
public static Collection asSynchronized(Collection self)(Code)
A convenience method for creating a synchronized Collection
Parameters:
  self - a Collection a synchronized Collection



asSynchronized
public static List asSynchronized(List self)(Code)
A convenience method for creating a synchronized List
Parameters:
  self - a List a synchronized List



asSynchronized
public static Set asSynchronized(Set self)(Code)
A convenience method for creating a synchronized Set
Parameters:
  self - a Set a synchronized Set



asSynchronized
public static SortedSet asSynchronized(SortedSet self)(Code)
A convenience method for creating a synchronized SortedSet
Parameters:
  self - a SortedSet a synchronized SortedSet



asType
public static Object asType(Collection col, Class clazz)(Code)



asType
public static Object asType(Closure cl, Class clazz)(Code)



asType
public static Object asType(Map map, Class clazz)(Code)



asType
public static Object asType(Number self, Class c)(Code)



asType
public static Object asType(File f, Class c)(Code)



asType
public static Object asType(String self, Class c)(Code)



asType
public static Object asType(Object obj, Class type)(Code)
Converts a given object to a type. This method is used through the "as" operator and is overloadable as any other operator.
Parameters:
  obj - the object to convert
Parameters:
  type - the goal type the resulting object



asWritable
public static File asWritable(File file)(Code)

Parameters:
  file - a File a File which wraps the input file and which implements Writable



asWritable
public static File asWritable(File file, String encoding)(Code)

Parameters:
  file - a File
Parameters:
  encoding - the encoding to be used when reading the file's contents File which wraps the input file and which implements Writable



callClosureForMapEntry
protected static Object callClosureForMapEntry(Closure closure, Map.Entry entry)(Code)



center
public static String center(String self, Number numberOfChars, String padding)(Code)
Center a String and padd it with the characters appended around it
Parameters:
  numberOfChars - the total number of characters
Parameters:
  padding - the charaters used for padding the String centered with padded character around



center
public static String center(String self, Number numberOfChars)(Code)
Center a String and padd it with spaces appended around it
Parameters:
  numberOfChars - the total number of characters the String centered with padded character around



collect
public static List collect(Object self, Closure closure)(Code)
Iterates through this object transforming each object into a new value using the closure as a transformer, returning a list of transformed values.
Parameters:
  self - the values of the object to map
Parameters:
  closure - the closure used to map each element of the collection a List of the mapped values



collect
public static Collection collect(Object self, Collection collection, Closure closure)(Code)
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.
Parameters:
  self - the values of the object to map
Parameters:
  collection - the Collection to which the mapped values are added
Parameters:
  closure - the closure used to map each element of the collection the resultant collection



collect
public static List collect(Collection self, Closure closure)(Code)
Iterates through this collection transforming each entry into a new value using the closure as a transformer, returning a list of transformed values.
Parameters:
  self - a collection
Parameters:
  closure - the closure used for mapping a List of the mapped values



collect
public static Collection collect(Collection self, Collection collection, Closure closure)(Code)
Iterates through this collection transforming each entry into a new value using the closure as a transformer, returning a list of transformed values.
Parameters:
  self - a collection
Parameters:
  collection - the Collection to which the mapped values are added
Parameters:
  closure - the closure used to map each element of the collection the resultant collection



collect
public static Collection collect(Map self, Collection collection, Closure closure)(Code)
Iterates through this Map transforming each entry into a new value using the closure as a transformer, returning a list of transformed values.
Parameters:
  self - a Map
Parameters:
  collection - the Collection to which the mapped values are added
Parameters:
  closure - the closure used for mapping, which can be with one(Map.Entry) or two(key, value) parameters a List of the mapped values



collect
public static List collect(Map self, Closure closure)(Code)
Iterates through this Map transforming each entry into a new value using the closure as a transformer, returning a list of transformed values.
Parameters:
  self - a Map
Parameters:
  closure - the closure used to map each element of the collection the resultant collection



compareTo
public static int compareTo(Character left, Number right)(Code)
Compare a Character and a Number
Parameters:
  left - a Character
Parameters:
  right - a Number the result of the comparison



compareTo
public static int compareTo(Number left, Character right)(Code)
Compare a Number and a Character
Parameters:
  left - a Number
Parameters:
  right - a Character the result of the comparison



compareTo
public static int compareTo(Character left, Character right)(Code)
Compare two Characters
Parameters:
  left - a Character
Parameters:
  right - a Character the result of the comparison



compareTo
public static int compareTo(Number left, Number right)(Code)
Compare two Numbers
Parameters:
  left - a Number
Parameters:
  right - another Number to compare to the comparision of both numbers



consumeProcessOutput
public static void consumeProcessOutput(Process self)(Code)
gets the input and error streams from a process and reads them to avoid the process to block due to a full ouput buffer. For this two Threads are started, so this method will return immediately
Parameters:
  self - a Process



contains
public static boolean contains(String self, String text)(Code)
Provide an implementation of contains() like Collection to make Strings more polymorphic This method is not required on JDK 1.5 onwards
Parameters:
  self - a String
Parameters:
  text - a String to look for true if this string contains the given text



count
public static int count(Collection self, Object value)(Code)
Counts the number of occurencies of the given value inside this collection
Parameters:
  self - the collection within which we count the number of occurencies
Parameters:
  value - the value the number of occurrencies



count
public static int count(String self, String text)(Code)
Count the number of occurencies of a substring
Parameters:
  self - a String
Parameters:
  text - a substring the number of occurrencies of the given string inside this String



createStringBufferWriter
protected static StringBufferWriter createStringBufferWriter(StringBuffer self)(Code)



createStringWriter
protected static StringWriter createStringWriter(String self)(Code)



decodeBase64
public static byte[] decodeBase64(String value)(Code)
Decode the Sting from base64 into a byte array
Parameters:
  value - the string to be decoded the decoded bytes as an array



disjoint
public static boolean disjoint(Collection left, Collection right)(Code)
Returns true if the intersection of two collenctions is empty.
Parameters:
  left - a Collection
Parameters:
  right - a Collection boolean true if the intersection of two collenctions is empty, false otherwise.



div
public static Number div(Character left, Number right)(Code)
Divide a Character by a Number
Parameters:
  left - a Character
Parameters:
  right - a Number the multiplication of both



div
public static Number div(Number left, Character right)(Code)
Divide a Number by a Character
Parameters:
  left - a Number
Parameters:
  right - a Character the multiplication of both



div
public static Number div(Character left, Character right)(Code)
Divide two Characters
Parameters:
  left - a Character
Parameters:
  right - another Character the multiplication of both



div
public static Number div(Number left, Number right)(Code)
Divide two Numbers
Parameters:
  left - a Number
Parameters:
  right - another Number a Number resulting of the divide operation



downto
public static void downto(Number self, Number to, Closure closure)(Code)
Iterates from this number down to the given number
Parameters:
  self - a Number
Parameters:
  to - another Number to go down to
Parameters:
  closure - the closure to call



downto
public static void downto(long self, Number to, Closure closure)(Code)



downto
public static void downto(Long self, Number to, Closure closure)(Code)



downto
public static void downto(float self, Number to, Closure closure)(Code)



downto
public static void downto(Float self, Number to, Closure closure)(Code)



downto
public static void downto(double self, Number to, Closure closure)(Code)



downto
public static void downto(Double self, Number to, Closure closure)(Code)



downto
public static void downto(BigInteger self, Number to, Closure closure)(Code)



downto
public static void downto(BigDecimal self, Number to, Closure closure)(Code)



dump
public static String dump(Object self)(Code)
Generates a detailed dump string of an object showing its class, hashCode and fields



each
public static void each(Object self, Closure closure)(Code)
Allows objects to be iterated through using a closure
Parameters:
  self - the object over which we iterate
Parameters:
  closure - the closure applied on each element found



each
public static void each(Collection self, Closure closure)(Code)
Allows objects to be iterated through using a closure
Parameters:
  self - the collection over which we iterate
Parameters:
  closure - the closure applied on each element of the collection



each
public static void each(Map self, Closure closure)(Code)
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.
Parameters:
  self - the map over which we iterate
Parameters:
  closure - the closure applied on each entry of the map



each
public static void each(Matcher self, Closure closure)(Code)
Process each matched substring of the given group matcher. The object passed to the closure is an array of strings, matched per a successful match.
Parameters:
  self - the source matcher
Parameters:
  closure - a closure



eachByte
public static void eachByte(File self, Closure closure) throws IOException(Code)
Traverse through each byte of the specified File
Parameters:
  self - a File
Parameters:
  closure - a closure



eachByte
public static void eachByte(InputStream is, Closure closure) throws IOException(Code)
Traverse through each byte of the specified stream. The stream is closed afterwards.
Parameters:
  is - stream to iterate over, closed after the method call
Parameters:
  closure - closure to apply to each byte
throws:
  IOException -



eachByte
public static void eachByte(URL url, Closure closure) throws IOException(Code)
Traverse through each byte of the specified URL
Parameters:
  url - url to iterate over
Parameters:
  closure - closure to apply to each byte
throws:
  IOException -



eachDir
public static void eachDir(File self, Closure closure) throws FileNotFoundException, IllegalArgumentException(Code)
Invokes the closure for each directory in the given directory, ignoring regular files.
Parameters:
  self - a directory
Parameters:
  closure - a closure
throws:
  FileNotFoundException - Thrown if the given directory does not exist
throws:
  IllegalArgumentException - Thrown if the provided File object does not represent a directory



eachFile
public static void eachFile(File self, Closure closure) throws FileNotFoundException, IllegalArgumentException(Code)
Invokes the closure for each file in the given directory
Parameters:
  self - a File
Parameters:
  closure - a closure
throws:
  FileNotFoundException - Thrown if the given directory does not exist
throws:
  IllegalArgumentException - Thrown if the provided File object does not represent a directory



eachFileMatch
public static void eachFileMatch(File self, Object filter, Closure closure) throws FileNotFoundException, IllegalArgumentException(Code)
Invokes the closure for each file matching the given filter in the given directory - calling the isCase() method used by switch statements. This method can be used with different kinds of filters like regular expresions, classes, ranges etc.
Parameters:
  self - a file
Parameters:
  filter - the filter to perform on the directory (using the isCase(object) method)
Parameters:
  closure -
throws:
  FileNotFoundException - Thrown if the given directory does not exist
throws:
  IllegalArgumentException - Thrown if the provided File object does not represent a directory



eachFileRecurse
public static void eachFileRecurse(File self, Closure closure) throws FileNotFoundException, IllegalArgumentException(Code)
Invokes the closure for each file in the given directory and recursively. It is a depth-first exploration, directories are included in the search.
Parameters:
  self - a File
Parameters:
  closure - a closure
throws:
  FileNotFoundException - Thrown if the given directory does not exist
throws:
  IllegalArgumentException - Thrown if the provided File object does not represent a directory



eachLine
public static void eachLine(File self, Closure closure) throws IOException(Code)
Iterates through the given file line by line
Parameters:
  self - a File
Parameters:
  closure - a closure
throws:
  IOException -



eachLine
public static void eachLine(Reader self, Closure closure) throws IOException(Code)
Iterates through the given reader line by line. The Reader is closed afterwards
Parameters:
  self - a Reader, closed after the method returns
Parameters:
  closure - a closure
throws:
  IOException -



eachLine
public static void eachLine(InputStream stream, Closure closure) throws IOException(Code)
Iterates through the given stream line by line
Parameters:
  stream - a stream
Parameters:
  closure - a closure
throws:
  IOException -



eachLine
public static void eachLine(URL url, Closure closure) throws IOException(Code)
Iterates through the lines read from the URL's associated input stream
Parameters:
  url - a URL to open and read
Parameters:
  closure - a closure to apply on each line
throws:
  IOException -



eachMatch
public static void eachMatch(String self, String regex, Closure closure)(Code)
Process each regex group matched substring of the given string. If the closure parameter takes one argument an array with all match groups is passed to it. If the closure takes as many arguments as there are match groups, then each parameter will be one match group.
Parameters:
  self - the source string
Parameters:
  regex - a Regex string
Parameters:
  closure - a closure with one parameter or as much parameters as groups



eachObject
public static void eachObject(File self, Closure closure) throws IOException, ClassNotFoundException(Code)
Iterates through the given file object by object
Parameters:
  self - a File
Parameters:
  closure - a closure
throws:
  IOException -
throws:
  ClassNotFoundException -



eachObject
public static void eachObject(ObjectInputStream ois, Closure closure) throws IOException, ClassNotFoundException(Code)
Iterates through the given object stream object by object. The ObjectInputStream is closed afterwards.
Parameters:
  ois - an ObjectInputStream, closed after the operation
Parameters:
  closure - a closure
throws:
  IOException -
throws:
  ClassNotFoundException -



eachWithIndex
public static void eachWithIndex(Object self, Closure closure)(Code)
Allows object to be iterated through a closure with a counter
Parameters:
  self - an Object
Parameters:
  closure - a Closure



encodeBase64
public static Writable encodeBase64(Byte[] data)(Code)



encodeBase64
public static Writable encodeBase64(byte[] data)(Code)
Produce a Writable object which writes the base64 encoding of the byte array Calling toString() on the result rerurns the encoding as a String
Parameters:
  data - byte array to be encoded object which will write the base64 encoding of the byte array



equals
public static boolean equals(List left, List right)(Code)
Compare two Lists. If numbers exits in the Lists, then they are compared as numbers, for example 2 == 2L.
Parameters:
  left - a List
Parameters:
  right - a List boolean true if two Lists equals, false otherwise.



every
public static boolean every(Object self, Closure closure)(Code)
Iterates over every element of a collection, and check whether a predicate is valid for all elements.
Parameters:
  self - the object over which we iterate
Parameters:
  closure - the closure predicate used for matching true if every item in the collection matches the closurepredicate



execute
public static Process execute(String self) throws IOException(Code)
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.
Parameters:
  self - a command line String the Process which has just started for this command line string



execute
public static Process execute(String[] commandArray) throws IOException(Code)
Executes the command specified by the String array that is the parameter. The first item in the array is the command the others are the parameters. For more control over the process mechanism in JDK 1.5 you can use java.lang.ProcessBuilder.
Parameters:
  commandArray - an array of String containing the command name andparameters as separate items in the array. the Process which has just started for this command line string.



execute
public static Process execute(String self, String[] envp, File dir) throws IOException(Code)
Executes the command specified by the self with environments envp under the working directory dir. For more control over the process mechanism in JDK 1.5 you can use java.lang.ProcessBuilder.
Parameters:
  self - a command line String to be executed.
Parameters:
  envp - an array of Strings, each element of whichhas environment variable settings in the formatname=value, ornull if the subprocess should inheritthe environment of the current process.
Parameters:
  dir - the working directory of the subprocess, ornull if the subprocess should inheritthe working directory of the current process. the Process which has just started for this command line string.



execute
public static Process execute(List commandList) throws IOException(Code)
Executes the command specified by the String list that is the parameter. The first item in the array is the command the others are the parameters. All entries must be Strings. For more control over the process mechanism in JDK 1.5 you can use java.lang.ProcessBuilder.
Parameters:
  commandList - a list of String containing the command name andparameters as separate items in the list. the Process which has just started for this command line string.



execute
public static Process execute(String self, List envp, File dir) throws IOException(Code)
Executes the command specified by the self with environments envp under the working directory dir. For more control over the process mechanism in JDK 1.5 you can use java.lang.ProcessBuilder.
Parameters:
  self - a command line String to be executed.
Parameters:
  envp - a List of Strings, each member of whichhas environment variable settings in the formatname=value, ornull if the subprocess should inheritthe environment of the current process.
Parameters:
  dir - the working directory of the subprocess, ornull if the subprocess should inheritthe working directory of the current process. the Process which has just started for this command line string.



filterLine
public static void filterLine(Reader reader, Writer writer, Closure closure) throws IOException(Code)
Filter the lines from a reader and write them on the writer, according to a closure which returns true or false. Both Reader and Writer are closed after the operation.
Parameters:
  reader - a reader, closed after the call
Parameters:
  writer - a writer, closed after the call
Parameters:
  closure - the closure which returns booleans
throws:
  IOException -



filterLine
public static Writable filterLine(File self, Closure closure) throws IOException(Code)
Filters the lines of a File and creates a Writeable in return to stream the filtered lines
Parameters:
  self - a File
Parameters:
  closure - a closure which returns a boolean indicating to filterthe line or not a Writable closure
throws:
  IOException - if self is not readable



filterLine
public static void filterLine(File self, Writer writer, Closure closure) throws IOException(Code)
Filter the lines from a File and write them on a writer, according to a closure which returns true or false
Parameters:
  self - a File
Parameters:
  writer - a writer
Parameters:
  closure - a closure which returns a boolean value and takes a line as input
throws:
  IOException - if self is not readable



filterLine
public static Writable filterLine(Reader reader, Closure closure)(Code)
Filter the lines of a Reader and create a Writable in return to stream the filtered lines.
Parameters:
  reader - a reader
Parameters:
  closure - a closure returning a boolean indicating to filter or not a line a Writable closure



filterLine
public static Writable filterLine(InputStream self, Closure predicate)(Code)
Filter lines from an input stream using a closure predicate
Parameters:
  self - an input stream
Parameters:
  predicate - a closure which returns boolean and takes a line a filtered writer



filterLine
public static void filterLine(InputStream self, Writer writer, Closure predicate) throws IOException(Code)
Filters lines from an input stream, writing to a writer, using a closure which returns boolean and takes a line.
Parameters:
  self - an InputStream
Parameters:
  writer - a writer to write output to
Parameters:
  predicate - a closure which returns a boolean and takes a line as input



find
public static Object find(Object self, Closure closure)(Code)
Finds the first value matching the closure condition
Parameters:
  self - an Object with an iterator returning its values
Parameters:
  closure - a closure condition the first Object found



find
public static Object find(Collection self, Closure closure)(Code)
Finds the first value matching the closure condition
Parameters:
  self - a Collection
Parameters:
  closure - a closure condition the first Object found



find
public static Object find(Map self, Closure closure)(Code)
Finds the first value matching the closure condition
Parameters:
  self - a Map
Parameters:
  closure - a closure condition the first Object found



findAll
public static List findAll(Object self, Closure closure)(Code)
Finds all values matching the closure condition
Parameters:
  self - an Object with an Iterator returning its values
Parameters:
  closure - a closure condition a List of the values found



findAll
public static List findAll(Collection self, Closure closure)(Code)
Finds all values matching the closure condition
Parameters:
  self - a Collection
Parameters:
  closure - a closure condition a List of the values found



findAll
public static Map findAll(Map self, Closure closure)(Code)
Finds all entries matching the closure condition. 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.
Parameters:
  self - a Map
Parameters:
  closure - a closure condition applying on the entries a new subMap



findIndexOf
public static int findIndexOf(Object self, Closure closure)(Code)
Iterates over every element of the collection and return the index of the first object that matches the condition specified in the closure
Parameters:
  self - the iteration object over which we iterate
Parameters:
  closure - the filter to perform a match on the collection an integer that is the index of the first macthed object.



flatten
public static List flatten(List self)(Code)
Flatten a list
Parameters:
  self - a List a flattened List



get
public static Object get(Map map, Object key, Object defaultValue)(Code)
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.
Parameters:
  map - a Map
Parameters:
  key - the key to lookup the value of
Parameters:
  defaultValue - the value to return and add to the map for this key ifthere is no entry for the given key the value of the given key or the default value, added to the map if thekey did not exist



getAt
public static Object getAt(Object self, String property)(Code)
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.
Parameters:
  self - the object to act upon



getAt
public static CharSequence getAt(CharSequence text, int index)(Code)
Support the subscript operator for String.
Parameters:
  text - a String
Parameters:
  index - the index of the Character to get the Character at the given index



getAt
public static String getAt(String text, int index)(Code)
Support the subscript operator for String
Parameters:
  text - a String the Character object at the given index



getAt
public static CharSequence getAt(CharSequence text, Range range)(Code)
Support the range subscript operator for CharSequence
Parameters:
  text - a CharSequence
Parameters:
  range - a Range the subsequence CharSequence



getAt
public static CharSequence getAt(CharSequence text, IntRange range)(Code)
Support the range subscript operator for CharSequence or StringBuffer with IntRange
Parameters:
  text - a CharSequence
Parameters:
  range - an IntRange the subsequence CharSequence



getAt
public static String getAt(String text, IntRange range)(Code)
Support the range subscript operator for String with IntRange
Parameters:
  text - a String
Parameters:
  range - an IntRange the resulting String



getAt
public static String getAt(String text, Range range)(Code)
Support the range subscript operator for String
Parameters:
  text - a String
Parameters:
  range - a Range a substring corresponding to the Range



getAt
public static Object getAt(Matcher matcher, int idx)(Code)
Support the subscript operator, e.g. matcher[index], for a regex Matcher.

For an example using no group match,

 def p = /ab[d|f]/
 def m = "abcabdabeabf" =~ p
 for (i in 0..
 

For an example using group matches,

 def p = /(?:ab([c|d|e|f]))/
 def m = "abcabdabeabf" =~ p
 for (i in 0..
 

For another example using group matches,

 def m = "abcabdabeabfabxyzabx" =~ /(?:ab([d|x-z]+))/
 m.count.times {
 println( "m.groupCount() = " + m.groupCount())
 println( "  " + it + ": " + m[it] )   // m[it] is a List
 }
 

Parameters:
  matcher - a Matcher
Parameters:
  idx - an index object a matched String if no groups matched, list of matched groups otherwise.



getAt
public static List getAt(List self, IntRange range)(Code)
Support the range subscript operator for a List
Parameters:
  self - a List
Parameters:
  range - a Range a sublist based on range borders or a new list if range is reversed
See Also:   java.util.List.subList(intint)



getAt
public static List getAt(List self, Collection indices)(Code)
Allows a List to be used as the indices to be used on a List
Parameters:
  self - a List
Parameters:
  indices - a Collection of indices a new list of the values at the given indices



getAt
public static List getAt(Object[] self, Collection indices)(Code)
Allows a List to be used as the indices to be used on a List
Parameters:
  self - an Array of Objects
Parameters:
  indices - a Collection of indices a new list of the values at the given indices



getAt
public static CharSequence getAt(CharSequence self, Collection indices)(Code)
Allows a List to be used as the indices to be used on a CharSequence
Parameters:
  self - a CharSequence
Parameters:
  indices - a Collection of indices a String of the values at the given indices



getAt
public static String getAt(String self, Collection indices)(Code)
Allows a List to be used as the indices to be used on a String
Parameters:
  self - a String
Parameters:
  indices - a Collection of indices a String of the values at the given indices



getAt
public static String getAt(Matcher self, Collection indices)(Code)
Allows a List to be used as the indices to be used on a Matcher
Parameters:
  self - a Matcher
Parameters:
  indices - a Collection of indices a String of the values at the given indices



getAt
public static List getAt(Object[] array, Range range)(Code)
Support the range subscript operator for an Array
Parameters:
  array - an Array of Objects
Parameters:
  range - a Range a range of a list from the range's from index up to but notincluding the ranges's to value



getAt
public static List getAt(Object[] array, IntRange range)(Code)



getAt
public static List getAt(Object[] array, ObjectRange range)(Code)



getAt
public static Object getAt(Object[] array, int idx)(Code)
Support the subscript operator for an Array
Parameters:
  array - an Array of Objects
Parameters:
  idx - an index the value at the given index



getAt
public static Object getAt(List self, int idx)(Code)
Support the subscript operator for a List
Parameters:
  self - a List
Parameters:
  idx - an index the value at the given index



getAt
public static Object getAt(Map self, Object key)(Code)
Support the subscript operator for a List
Parameters:
  self - a Map
Parameters:
  key - an Object as a key for the map the value corresponding to the given key



getAt
public static List getAt(Collection coll, String property)(Code)
Support the subscript operator for List
Parameters:
  coll - a Collection
Parameters:
  property - a String a List



getAt
public static Object getAt(byte[] array, int idx)(Code)



getAt
public static Object getAt(char[] array, int idx)(Code)



getAt
public static Object getAt(short[] array, int idx)(Code)



getAt
public static Object getAt(int[] array, int idx)(Code)



getAt
public static Object getAt(long[] array, int idx)(Code)



getAt
public static Object getAt(float[] array, int idx)(Code)



getAt
public static Object getAt(double[] array, int idx)(Code)



getAt
public static Object getAt(boolean[] array, int idx)(Code)



getAt
public static Object getAt(byte[] array, Range range)(Code)



getAt
public static Object getAt(char[] array, Range range)(Code)



getAt
public static Object getAt(short[] array, Range range)(Code)



getAt
public static Object getAt(int[] array, Range range)(Code)



getAt
public static Object getAt(long[] array, Range range)(Code)



getAt
public static Object getAt(float[] array, Range range)(Code)



getAt
public static Object getAt(double[] array, Range range)(Code)



getAt
public static Object getAt(boolean[] array, Range range)(Code)



getAt
public static Object getAt(byte[] array, IntRange range)(Code)



getAt
public static Object getAt(char[] array, IntRange range)(Code)



getAt
public static Object getAt(short[] array, IntRange range)(Code)



getAt
public static Object getAt(int[] array, IntRange range)(Code)



getAt
public static Object getAt(long[] array, IntRange range)(Code)



getAt
public static Object getAt(float[] array, IntRange range)(Code)



getAt
public static Object getAt(double[] array, IntRange range)(Code)



getAt
public static Object getAt(boolean[] array, IntRange range)(Code)



getAt
public static Object getAt(byte[] array, ObjectRange range)(Code)



getAt
public static Object getAt(char[] array, ObjectRange range)(Code)



getAt
public static Object getAt(short[] array, ObjectRange range)(Code)



getAt
public static Object getAt(int[] array, ObjectRange range)(Code)



getAt
public static Object getAt(long[] array, ObjectRange range)(Code)



getAt
public static Object getAt(float[] array, ObjectRange range)(Code)



getAt
public static Object getAt(double[] array, ObjectRange range)(Code)



getAt
public static Object getAt(boolean[] array, ObjectRange range)(Code)



getAt
public static Object getAt(byte[] array, Collection indices)(Code)



getAt
public static Object getAt(char[] array, Collection indices)(Code)



getAt
public static Object getAt(short[] array, Collection indices)(Code)



getAt
public static Object getAt(int[] array, Collection indices)(Code)



getAt
public static Object getAt(long[] array, Collection indices)(Code)



getAt
public static Object getAt(float[] array, Collection indices)(Code)



getAt
public static Object getAt(double[] array, Collection indices)(Code)



getAt
public static Object getAt(boolean[] array, Collection indices)(Code)



getCount
public static int getCount(Matcher matcher)(Code)
Find the number of Strings matched to the given Matcher.
Parameters:
  matcher - a Matcher int the number of Strings matched to the given matcher.



getErr
public static InputStream getErr(Process self)(Code)
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 an InputStream



getIn
public static InputStream getIn(Process self)(Code)
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 an InputStream



getMetaPropertyValues
public static List getMetaPropertyValues(Object self)(Code)
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'.
Parameters:
  self - the receiver object list of PropertyValue objects
See Also:   groovy.util.Expando.getMetaPropertyValues



getOut
public static OutputStream getOut(Process self)(Code)
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 an OutputStream



getProperties
public static Map getProperties(Object self)(Code)
Convenience method that calls DefaultGroovyMethods.getMetaPropertyValues(Object) (self) and provides the data in form of simple key/value pairs, i.e. without type() information.
Parameters:
  self - the receiver object meta properties as Map of key/value pairs



getRootLoader
public static ClassLoader getRootLoader(ClassLoader cl)(Code)
Iterates through the class loader parents until it finds a loader with a class named equal to org.codehaus.groovy.tools.RootLoader. If there is no such class null will be returned. The name has to be used because a direct compare with == may fail as the class may be loaded through different classloaders.
See Also:   org.codehaus.groovy.tools.RootLoader



getSubList
protected static List getSubList(List self, List splice)(Code)



getText
public static String getText(File file, String charset) throws IOException(Code)
Reads the content of the File opened with the specified encoding and returns it as a String
Parameters:
  file - the file whose content we want to read
Parameters:
  charset - the charset used to read the content of the file a String containing the content of the file
throws:
  IOException -



getText
public static String getText(File file) throws IOException(Code)
Reads the content of the File and returns it as a String
Parameters:
  file - the file whose content we want to read a String containing the content of the file
throws:
  IOException -



getText
public static String getText(URL url) throws IOException(Code)
Reads the content of this URL and returns it as a String
Parameters:
  url - URL to read content from the text from that URL
throws:
  IOException -



getText
public static String getText(URL url, String charset) throws IOException(Code)
Reads the content of this URL and returns it as a String
Parameters:
  url - URL to read content from
Parameters:
  charset - opens the stream with a specified charset the text from that URL
throws:
  IOException -



getText
public static String getText(InputStream is) throws IOException(Code)
Reads the content of this InputStream and returns it as a String
Parameters:
  is - an input stream the text from that URL
throws:
  IOException -



getText
public static String getText(InputStream is, String charset) throws IOException(Code)
Reads the content of this InputStream with a specified charset and returns it as a String
Parameters:
  is - an input stream
Parameters:
  charset - opens the stream with a specified charset the text from that URL
throws:
  IOException -



getText
public static String getText(Reader reader) throws IOException(Code)
Reads the content of the Reader and returns it as a String
Parameters:
  reader - a Reader whose content we want to read a String containing the content of the buffered reader
throws:
  IOException -



getText
public static String getText(BufferedReader reader) throws IOException(Code)
Reads the content of the BufferedReader and returns it as a String. The BufferedReader is closed afterwards.
Parameters:
  reader - a BufferedReader whose content we want to read a String containing the content of the buffered reader
throws:
  IOException -



getText
public static String getText(Process self) throws IOException(Code)
Read the text of the output stream of the Process.
Parameters:
  self - a Process the text of the output
throws:
  IOException -



grep
public static List grep(Object self, Object filter)(Code)
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.
Parameters:
  self - the object over which we iterate
Parameters:
  filter - the filter to perform on the collection (using the isCase(object) method) a list of objects which match the filter



groupBy
public static Map groupBy(Collection self, Closure closure)(Code)
Groups all collection members into groups determined by the supplied mapping closure.
Parameters:
  self - a collection to group (no map)
Parameters:
  closure - a closure mapping entries on keys a new Map grouped by keys



hasGroup
public static boolean hasGroup(Matcher matcher)(Code)
Check whether a Matcher contains a group or not.
Parameters:
  matcher - a Matcher boolean true if matcher contains at least one group.



identity
public static Object identity(Object self, Closure closure)(Code)
Allows the closure to be called for the object reference self
Parameters:
  self - the object to have a closure act upon
Parameters:
  closure - the closure to call on the object result of calling the closure



inject
public static Object inject(Collection self, Object value, Closure closure)(Code)
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.
Parameters:
  self - a Collection
Parameters:
  value - a value
Parameters:
  closure - a closure the last value of the last iteration



inject
public static Object inject(Object[] self, Object value, Closure closure)(Code)
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.
Parameters:
  self - an Object[]
Parameters:
  value - a value
Parameters:
  closure - a closure the last value of the last iteration



inspect
public static String inspect(Object self)(Code)
a String that matches what would be typed into a terminal tocreate this object. e.g. [1, 'hello'].inspect() -> [1, "hello"]



intdiv
public static Number intdiv(Character left, Number right)(Code)
Integer Divide a Character by a Number
Parameters:
  left - a Character
Parameters:
  right - a Number the integer division of both



intdiv
public static Number intdiv(Number left, Character right)(Code)
Integer Divide a Number by a Character
Parameters:
  left - a Number
Parameters:
  right - a Character the integer division of both



intdiv
public static Number intdiv(Character left, Character right)(Code)
Integer Divide two Characters
Parameters:
  left - a Character
Parameters:
  right - another Character the integer division of both



intdiv
public static Number intdiv(Number left, Number right)(Code)
Integer Divide two Numbers
Parameters:
  left - a Number
Parameters:
  right - another Number a Number (an Integer) resulting of the integer division operation



intersect
public static List intersect(Collection left, Collection right)(Code)
Create a List composed of the intersection of both collections
Parameters:
  left - a Collection
Parameters:
  right - a Collection a List as an intersection of both collections



invokeMethod
public static Object invokeMethod(Object object, String method, Object arguments)(Code)
Provide a dynamic method invocation method which can be overloaded in classes to implement dynamic proxies easily.



is
public static boolean is(Object self, Object other)(Code)
Identity check. Since == is overridden in Groovy with the meaning of equality we need some fallback to check for object identity.
Parameters:
  self -
Parameters:
  other - true if self and other are identical, false otherwise



isCase
public static boolean isCase(Object caseValue, Object switchValue)(Code)



isCase
public static boolean isCase(String caseValue, Object switchValue)(Code)



isCase
public static boolean isCase(Class caseValue, Object switchValue)(Code)



isCase
public static boolean isCase(Collection caseValue, Object switchValue)(Code)



isCase
public static boolean isCase(Pattern caseValue, Object switchValue)(Code)



iterator
public static Iterator iterator(Object o)(Code)



iterator
public static Iterator iterator(Enumeration enumeration)(Code)
an Iterator for an Enumeration



iterator
public static Iterator iterator(NodeList nodeList)(Code)
an Iterator for a NodeList



iterator
public static Iterator iterator(Matcher matcher)(Code)
an Iterator for a Matcher



iterator
public static Iterator iterator(Reader value)(Code)
an Iterator for a Reader



iterator
public static Iterator iterator(InputStream is)(Code)
Standard iterator for a input stream which iterates through the stream content in a byte-based fashion.
Parameters:
  is -



iterator
public static Iterator iterator(DataInputStream dis)(Code)
Standard iterator for a data input stream which iterates through the stream content in a byte-based fashion.
Parameters:
  dis -



iterator
public static Iterator iterator(File f) throws IOException(Code)
Standard iterator for a file which iterates through the file content in a line-based fashion.
Parameters:
  f -
throws:
  IOException -



iterator
public static Iterator iterator(Iterator it)(Code)



join
public static String join(Collection self, String separator)(Code)
Concatenates all of the items of the collection together with the given String as a separator
Parameters:
  self - a Collection of objects
Parameters:
  separator - a String separator the joined String



join
public static String join(Object[] self, String separator)(Code)
Concatenates all of the elements of the array together with the given String as a separator
Parameters:
  self - an array of Object
Parameters:
  separator - a String separator the joined String



leftShift
public static Collection leftShift(Collection self, Object value)(Code)
Overloads the left shift operator to provide an easy way to append objects to a list
Parameters:
  self - a Collection
Parameters:
  value - an Object to be added to the collection. a Collection with an Object added to it.



leftShift
public static StringBuffer leftShift(String self, Object value)(Code)
Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a String
Parameters:
  self - a String
Parameters:
  value - an Obect a StringBuffer



leftShift
public static StringBuffer leftShift(StringBuffer self, Object value)(Code)
Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a StringBuffer
Parameters:
  self - a StringBuffer
Parameters:
  value - a value to append a StringBuffer



leftShift
public static Writer leftShift(Writer self, Object value) throws IOException(Code)
Overloads the left shift operator to provide an append mechanism to add things to a writer
Parameters:
  self - a Writer
Parameters:
  value - a value to append a StringWriter



leftShift
public static Number leftShift(Number left, Number right)(Code)
Implementation of the left shift operator for integral types. Non integral Number types throw UnsupportedOperationException.



leftShift
public static Writer leftShift(OutputStream self, Object value) throws IOException(Code)
Overloads the left shift operator to provide an append mechanism to add things to a stream
Parameters:
  self - an OutputStream
Parameters:
  value - a value to append a Writer



leftShift
public static OutputStream leftShift(OutputStream self, InputStream in) throws IOException(Code)
Pipe an inputstream into an outputstream for efficient stream copying.
Parameters:
  self - stream on which to write
Parameters:
  in - stream to read from the outputstream itself
throws:
  IOException -



leftShift
public static OutputStream leftShift(OutputStream self, byte[] value) throws IOException(Code)
Overloads the left shift operator to provide an append mechanism to add bytes to a stream
Parameters:
  self - an OutputStream
Parameters:
  value - a value to append an OutputStream



leftShift
public static File leftShift(File file, Object text) throws IOException(Code)
Write the text to the File.
Parameters:
  file - a File
Parameters:
  text - the text to write to the File
throws:
  IOException -



leftShift
public static Writer leftShift(Socket self, Object value) throws IOException(Code)
Overloads the left shift operator to provide an append mechanism to add things to the output stream of a socket
Parameters:
  self - a Socket
Parameters:
  value - a value to append a Writer



leftShift
public static OutputStream leftShift(Socket self, byte[] value) throws IOException(Code)
Overloads the left shift operator to provide an append mechanism to add bytes to the output stream of a socket
Parameters:
  self - a Socket
Parameters:
  value - a value to append an OutputStream



leftShift
public static Writer leftShift(Process self, Object value) throws IOException(Code)
Overloads the left shift operator to provide an append mechanism to pipe into a Process
Parameters:
  self - a Process
Parameters:
  value - a value to append a Writer



leftShift
public static OutputStream leftShift(Process self, byte[] value) throws IOException(Code)
Overloads the left shift operator to provide an append mechanism to pipe into a Process
Parameters:
  self - a Process
Parameters:
  value - a value to append an OutputStream



max
public static Object max(Collection self)(Code)
Selects the maximum value found in the collection
Parameters:
  self - a Collection the maximum value



max
public static Object max(Collection self, Comparator comparator)(Code)
Selects the maximum value found in the collection using the given comparator
Parameters:
  self - a Collection
Parameters:
  comparator - a Comparator the maximum value



max
public static Object max(Collection self, Closure closure)(Code)
Selects the maximum value found in the collection using the given closure as a comparator
Parameters:
  self - a Collection
Parameters:
  closure - a closure used as a comparator the maximum value



min
public static Object min(Collection self)(Code)
Selects the minimum value found in the collection
Parameters:
  self - a Collection the minimum value



min
public static Object min(Collection self, Comparator comparator)(Code)
Selects the minimum value found in the collection using the given comparator
Parameters:
  self - a Collection
Parameters:
  comparator - a Comparator the minimum value



min
public static Object min(Collection self, Closure closure)(Code)
Selects the minimum value found in the collection using the given closure as a comparator
Parameters:
  self - a Collection
Parameters:
  closure - a closure used as a comparator the minimum value



minus
public static List minus(List self, Collection removeMe)(Code)
Create a List composed of the elements of the first list minus the elements of the collection
Parameters:
  self - a List
Parameters:
  removeMe - a Collection of elements to remove a List with the common elements removed



minus
public static List minus(List self, Object operand)(Code)



minus
public static String minus(String left, Object value)(Code)
Remove a part of a String
Parameters:
  left - a String
Parameters:
  value - a String part to remove a String minus the part to be removed



minus
public static Number minus(Character left, Number right)(Code)
Subtract a Number from a Character
Parameters:
  left - a Character
Parameters:
  right - a Number the addition of the Character and the Number



minus
public static Number minus(Number left, Character right)(Code)
Subtract a Character from a Number
Parameters:
  left - a Number
Parameters:
  right - a Character the addition of the Character and the Number



minus
public static Number minus(Character left, Character right)(Code)
Subtraction two Characters
Parameters:
  left - a Character
Parameters:
  right - a Character the addition of both Characters



minus
public static Number minus(Number left, Number right)(Code)
Substraction of two Numbers
Parameters:
  left - a Number
Parameters:
  right - another Number to substract to the first one the substraction



minus
public static Date minus(Date self, int days)(Code)
Subtracts a number of days from this date and returns the new date
Parameters:
  self - a Date the new date



minus
public static java.sql.Date minus(java.sql.Date self, int days)(Code)
Subtracts a number of days from this date and returns the new date
Parameters:
  self - a java.sql.Date the new date



mod
public static Number mod(Number left, Number right)(Code)
Performs a division modulus operation
Parameters:
  left - a Number
Parameters:
  right - another Number to mod the modulus result



multiply
public static List multiply(Collection self, Number factor)(Code)
Create a List composed of the same elements repeated a certain number of times.
Parameters:
  self - a Collection
Parameters:
  factor - the number of times to append a List



multiply
public static String multiply(String self, Number factor)(Code)
Repeat a String a certain number of times
Parameters:
  self - a String to be repeated
Parameters:
  factor - the number of times the String should be repeated a String composed of a repeatition
throws:
  IllegalArgumentException - if the number of repeatition is < 0



multiply
public static Number multiply(Character left, Number right)(Code)
Multiply a Character by a Number
Parameters:
  left - a Character
Parameters:
  right - a Number the multiplication of both



multiply
public static Number multiply(Number left, Character right)(Code)
Multiply a Number by a Character
Parameters:
  left - a Number
Parameters:
  right - a Character the multiplication of both



multiply
public static Number multiply(Character left, Character right)(Code)
Multiply two Characters
Parameters:
  left - a Character
Parameters:
  right - another Character the multiplication of both



multiply
public static Number multiply(Number left, Number right)(Code)
Multiply two Numbers
Parameters:
  left - a Number
Parameters:
  right - another Number the multiplication of both



multiply
public static Number multiply(BigDecimal left, Double right)(Code)
Multiply a BigDecimal and a Double. Note: This method was added to enforce the Groovy rule of BigDecimal*Double == Double. Without this method, the multiply(BigDecimal) method in BigDecimal would respond and return a BigDecimal instead. Since BigDecimal is prefered over Number, the Number*Number method is not choosen as in older versions of Groovy.
Parameters:
  left - a BigDecimal
Parameters:
  right - a Double the multiplication of both



multiply
public static Number multiply(BigDecimal left, BigInteger right)(Code)
Multiply a BigDecimal and a BigInteger. Note: This method was added to enforce the Groovy rule of BigDecimal*long == long. Without this method, the multiply(BigDecimal) method in BigDecimal would respond and return a BigDecimal instead. Since BigDecimal is prefered over Number, the Number*Number method is not choosen as in older versions of Groovy. Biginteger is the fallback for all integer types in Groovy
Parameters:
  left - a BigDecimal
Parameters:
  right - a BigInteger the multiplication of both



negate
public static Pattern negate(String self)(Code)
Turns a String into a regular expression pattern
Parameters:
  self - a String to convert into a regular expression the regular expression pattern



negate
public static Number negate(Number left)(Code)
Negates the number
Parameters:
  left - a Number the negation of the number



newInputStream
public static BufferedInputStream newInputStream(File file) throws FileNotFoundException(Code)
Helper method to create a buffered input stream for a file
Parameters:
  file - a File a BufferedInputStream of the file
throws:
  FileNotFoundException -



newInstance
public static Object newInstance(Class c)(Code)



newInstance
public static Object newInstance(Class c, Object[] args)(Code)



newObjectInputStream
public static ObjectInputStream newObjectInputStream(File file) throws FileNotFoundException, IOException(Code)
Helper method to create an object input stream from the given file.
Parameters:
  file - a file an object input stream
throws:
  FileNotFoundException -
throws:
  IOException -



newOutputStream
public static BufferedOutputStream newOutputStream(File file) throws IOException(Code)
Helper method to create a buffered output stream for a file
Parameters:
  file -
throws:
  FileNotFoundException -



newPrintWriter
public static PrintWriter newPrintWriter(File file) throws IOException(Code)
Helper method to create a new PrintWriter for a file
Parameters:
  file - a File
throws:
  FileNotFoundException -



newPrintWriter
public static PrintWriter newPrintWriter(File file, String charset) throws IOException(Code)
Helper method to create a new PrintWriter for a file with a specified charset
Parameters:
  file - a File
Parameters:
  charset - the charset a PrintWriter
throws:
  FileNotFoundException -



newReader
public static BufferedReader newReader(File file) throws IOException(Code)
Helper method to create a buffered reader for a file
Parameters:
  file - a File a BufferedReader
throws:
  IOException -



newReader
public static BufferedReader newReader(File file, String charset) throws FileNotFoundException, UnsupportedEncodingException(Code)
Helper method to create a buffered reader for a file, with a specified charset
Parameters:
  file - a File
Parameters:
  charset - the charset with which we want to write in the File a BufferedReader
throws:
  FileNotFoundException - if the File was not found
throws:
  UnsupportedEncodingException - if the encoding specified is not supported



newReader
public static BufferedReader newReader(InputStream self)(Code)
Provides a reader for an arbitrary input stream
Parameters:
  self - an input stream a reader



newWriter
public static BufferedWriter newWriter(File file) throws IOException(Code)
Helper method to create a buffered writer for a file
Parameters:
  file - a File a BufferedWriter
throws:
  FileNotFoundException -



newWriter
public static BufferedWriter newWriter(File file, boolean append) throws IOException(Code)
Helper method to create a buffered writer for a file in append mode
Parameters:
  file - a File
Parameters:
  append - true if in append mode a BufferedWriter
throws:
  FileNotFoundException -



newWriter
public static BufferedWriter newWriter(File file, String charset, boolean append) throws IOException(Code)
Helper method to create a buffered writer for a file
Parameters:
  file - a File
Parameters:
  charset - the name of the encoding used to write in this file
Parameters:
  append - true if in append mode a BufferedWriter
throws:
  FileNotFoundException -



newWriter
public static BufferedWriter newWriter(File file, String charset) throws IOException(Code)
Helper method to create a buffered writer for a file
Parameters:
  file - a File
Parameters:
  charset - the name of the encoding used to write in this file a BufferedWriter
throws:
  FileNotFoundException -



next
public static String next(String self)(Code)
This method is called by the ++ operator for the class String. It increments the last character in the given string. If the character in the string is Character.MAX_VALUE a Character.MIN_VALUE will be appended. The empty string is incremented to a string consisting of the character Character.MIN_VALUE.
Parameters:
  self - a String an incremented String



next
public static Number next(Character self)(Code)
Increment a Character by one
Parameters:
  self - a Character an incremented Number



next
public static Number next(Number self)(Code)
Increment a Number by one
Parameters:
  self - a Number an incremented Number



next
public static Date next(Date self)(Code)
Increments a Date by a day
Parameters:
  self - a Date the next days date



next
public static java.sql.Date next(java.sql.Date self)(Code)
Increments a java.sql.Date by a day
Parameters:
  self - a java.sql.Date the next days date



normaliseIndex
protected static int normaliseIndex(int i, int size)(Code)
This converts a possibly negative index to a real index into the array.
Parameters:
  i -
Parameters:
  size -



or
public static Number or(Number left, Number right)(Code)
Bitwise OR together two numbers
Parameters:
  left - a Number
Parameters:
  right - another Number to bitwise OR the bitwise OR of both Numbers



or
public static Boolean or(Boolean left, Boolean right)(Code)



padLeft
public static String padLeft(String self, Number numberOfChars, String padding)(Code)
Pad a String with the characters appended to the left
Parameters:
  numberOfChars - the total number of characters
Parameters:
  padding - the charaters used for padding the String padded to the left



padLeft
public static String padLeft(String self, Number numberOfChars)(Code)
Pad a String with the spaces appended to the left
Parameters:
  numberOfChars - the total number of characters the String padded to the left



padRight
public static String padRight(String self, Number numberOfChars, String padding)(Code)
Pad a String with the characters appended to the right
Parameters:
  numberOfChars - the total number of characters
Parameters:
  padding - the charaters used for padding the String padded to the right



padRight
public static String padRight(String self, Number numberOfChars)(Code)
Pad a String with the spaces appended to the right
Parameters:
  numberOfChars - the total number of characters the String padded to the right



plus
public static List plus(Collection left, Collection right)(Code)
Create a List as a union of both Collections
Parameters:
  left - the left Collection
Parameters:
  right - the right Collection a List



plus
public static List plus(Collection left, Object right)(Code)
Create a List as a union of a Collection and an Object
Parameters:
  left - a Collection
Parameters:
  right - an object to append a List



plus
public static String plus(String left, Object value)(Code)
Appends a String
Parameters:
  left - a String
Parameters:
  value - any Object a String



plus
public static String plus(Number value, String right)(Code)
Appends a String
Parameters:
  value - a Number
Parameters:
  right - a String a String



plus
public static String plus(StringBuffer left, String value)(Code)
Appends a String
Parameters:
  left - a StringBuffer
Parameters:
  value - a String a String



plus
public static Number plus(Character left, Number right)(Code)
Add a Character and a Number
Parameters:
  left - a Character
Parameters:
  right - a Number the addition of the Character and the Number



plus
public static Number plus(Number left, Character right)(Code)
Add a Number and a Character
Parameters:
  left - a Number
Parameters:
  right - a Character the addition of the Character and the Number



plus
public static Number plus(Character left, Character right)(Code)
Add two Characters
Parameters:
  left - a Character
Parameters:
  right - a Character the addition of both Characters



plus
public static Number plus(Number left, Number right)(Code)
Add two numbers and return the result.
Parameters:
  left - a Number
Parameters:
  right - another Number to add the addition of both Numbers



plus
public static Date plus(Date self, int days)(Code)
Adds a number of days to this date and returns the new date
Parameters:
  self - a Date
Parameters:
  days - the number of days to increase the new date



plus
public static java.sql.Date plus(java.sql.Date self, int days)(Code)
Adds a number of days to this date and returns the new date
Parameters:
  self - a java.sql.Date
Parameters:
  days - the number of days to increase the new date



pop
public static Object pop(List self)(Code)
Removes the last item from the List. Using add() and pop() is similar to push and pop on a Stack.
Parameters:
  self - a List the item removed from the List
throws:
  NoSuchElementException - if the list is empty and you try to pop() it.



power
public static Number power(Number self, Number exponent)(Code)
Power of a Number to a certain exponent
Parameters:
  self - a Number
Parameters:
  exponent - a Number exponent a Number to the power of a certain exponent



previous
public static String previous(String self)(Code)
This method is called by the -- operator for the class String. It decrements the last character in the given string. If the character in the string is Character.MIN_VALUE it will be deleted. The empty string can't be decremented.
Parameters:
  self - a String a String with a decremented digit at the end



previous
public static Number previous(Character self)(Code)
Decrement a Character by one
Parameters:
  self - a Character a decremented Number



previous
public static Number previous(Number self)(Code)
Decrement a Number by one
Parameters:
  self - a Number a decremented Number



previous
public static Date previous(Date self)(Code)
Decrement a Date by a day
Parameters:
  self - a Date the previous days date



previous
public static java.sql.Date previous(java.sql.Date self)(Code)
Decrement a java.sql.Date by a day
Parameters:
  self - a java.sql.Date the previous days date



primitiveArrayGet
protected static Object primitiveArrayGet(Object array, int idx)(Code)
Implements the getAt(int) method for primitve type arrays



primitiveArrayGet
protected static List primitiveArrayGet(Object array, Range range)(Code)
Implements the getAt(Range) method for primitve type arrays



primitiveArrayGet
protected static List primitiveArrayGet(Object self, Collection indices)(Code)
Implements the getAt(Collection) method for primitve type arrays



primitiveArrayPut
protected static void primitiveArrayPut(Object array, int idx, Object newValue)(Code)
Implements the set(int idx) method for primitve type arrays



print
public static void print(Object self, Object value)(Code)
Print to a console in interactive format



print
public static void print(Object self, PrintWriter out)(Code)
Print to a console in interactive format



printf
public static void printf(Object self, String format, Object[] values)(Code)
Printf to a console. Only works with JDK1.5 or later.



printf
public static void printf(Object self, String format, Object arg)(Code)
Returns a formatted string using the specified format string and arguments.

For examples,

 printf ( "Hello, %s!\n" , [ "world" ] as String[] )
 printf ( "Hello, %s!\n" , [ "Groovy" ])
 printf ( "%d + %d = %d\n" , [ 1 , 2 , 1+2 ] as Integer[] )
 printf ( "%d + %d = %d\n" , [ 3 , 3 , 3+3 ])
 

( 1..5 ).each { printf ( "-- %d\n" , [ it ] as Integer[] ) } ( 1..5 ).each { printf ( "-- %d\n" , [ it ] as int[] ) } ( 0x41..0x45 ).each { printf ( "-- %c\n" , [ it ] as char[] ) } ( 07..011 ).each { printf ( "-- %d\n" , [ it ] as byte[] ) } ( 7..11 ).each { printf ( "-- %d\n" , [ it ] as short[] ) } ( 7..11 ).each { printf ( "-- %d\n" , [ it ] as long[] ) } ( 7..11 ).each { printf ( "-- %5.2f\n" , [ it ] as float[] ) } ( 7..11 ).each { printf ( "-- %5.2g\n" , [ it ] as double[] ) }


Parameters:
  format - A format string
Parameters:
  arg - Argument which is referenced by the format specifiers in the formatstring. The type of arg should be one of Object[], List,int[], short[], byte[], char[], boolean[], long[], float[], or double[].
since:
   JDK 1.5




println
public static void println(Object self)(Code)
Print a linebreak to the standard out.



println
public static void println(Object self, Object value)(Code)
Print to a console in interactive format along with a newline



println
public static void println(Object self, PrintWriter out)(Code)
Print to a console in interactive format
Parameters:
  out - the PrintWriter used for printing



putAt
public static void putAt(Object self, String property, Object newValue)(Code)
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 property names which are known at compile time.
Parameters:
  self - the object to act upon
Parameters:
  property - the name of the property to set
Parameters:
  newValue - the value to set



putAt
public static void putAt(Object[] array, int idx, Object value)(Code)
Support the subscript operator for an Array
Parameters:
  array - an Array of Objects
Parameters:
  idx - an index
Parameters:
  value - an Object to put at the given index



putAt
public static void putAt(List self, int idx, Object value)(Code)
A helper method to allow lists to work with subscript operators
Parameters:
  self - a List
Parameters:
  idx - an index
Parameters:
  value - the value to put at the given index



putAt
public static void putAt(StringBuffer self, IntRange range, Object value)(Code)
Support the range subscript operator for StringBuffer
Parameters:
  self - a StringBuffer
Parameters:
  range - a Range
Parameters:
  value - the object that's toString() will be inserted



putAt
public static void putAt(StringBuffer self, EmptyRange range, Object value)(Code)
Support the range subscript operator for StringBuffer
Parameters:
  self - a StringBuffer
Parameters:
  range - a Range
Parameters:
  value - the object that's toString() will be inserted



putAt
public static void putAt(List self, EmptyRange range, Object value)(Code)
A helper method to allow lists to work with subscript operators
Parameters:
  self - a List
Parameters:
  range - the subset of the list to set
Parameters:
  value - the values to put at the given sublist or a Collection of values



putAt
public static void putAt(List self, IntRange range, Object value)(Code)
A helper method to allow lists to work with subscript operators
Parameters:
  self - a List
Parameters:
  range - the subset of the list to set
Parameters:
  value - the value to put at the given sublist or a Collection of values



putAt
public static void putAt(List self, List splice, List values)(Code)
A helper method to allow lists to work with subscript operators
Parameters:
  self - a List
Parameters:
  splice - the subset of the list to set
Parameters:
  values - the value to put at the given sublist



putAt
public static void putAt(List self, List splice, Object value)(Code)
A helper method to allow lists to work with subscript operators
Parameters:
  self - a List
Parameters:
  splice - the subset of the list to set
Parameters:
  value - the value to put at the given sublist



putAt
public static Object putAt(Map self, Object key, Object value)(Code)
A helper method to allow lists to work with subscript operators
Parameters:
  self - a Map
Parameters:
  key - an Object as a key for the map the value corresponding to the given key



putAt
public static void putAt(boolean[] array, int idx, Boolean newValue)(Code)



putAt
public static void putAt(byte[] array, int idx, Object newValue)(Code)



putAt
public static void putAt(char[] array, int idx, Object newValue)(Code)



putAt
public static void putAt(short[] array, int idx, Object newValue)(Code)



putAt
public static void putAt(int[] array, int idx, Object newValue)(Code)



putAt
public static void putAt(long[] array, int idx, Object newValue)(Code)



putAt
public static void putAt(float[] array, int idx, Object newValue)(Code)



putAt
public static void putAt(double[] array, int idx, Object newValue)(Code)



readBytes
public static byte[] readBytes(File file) throws IOException(Code)
Reads the content of the file into an array of byte
Parameters:
  file - a File a List of Bytes



readLine
public static String readLine(Reader self) throws IOException(Code)
Read a single, whole line from the given Reader
Parameters:
  self - a Reader a line
throws:
  IOException -



readLine
public static String readLine(InputStream stream) throws IOException(Code)
Read a single, whole line from the given InputStream
Parameters:
  stream - an InputStream a line
throws:
  IOException -



readLines
public static List readLines(File file) throws IOException(Code)
Reads the file into a list of Strings for each line
Parameters:
  file - a File a List of lines
throws:
  IOException -



readLines
public static List readLines(Reader reader) throws IOException(Code)
Reads the reader into a list of Strings for each line
Parameters:
  reader - a Reader a List of lines
throws:
  IOException -



readLines
public static List readLines(InputStream stream) throws IOException(Code)
Reads the stream into a list of Strings for each line
Parameters:
  stream - a stream a List of lines
throws:
  IOException -



replaceAll
public static String replaceAll(String self, String regex, Closure closure)(Code)
Replaces all occurrencies of a captured group by the result of a closure on that text.

For examples,

 assert "FOOBAR-FOOBAR-" == "foobar-FooBar-".replaceAll("(([fF][oO]{2})[bB]ar)", { Object[] it -> it[0].toUpperCase() })
 

Here, it[0] is the global string of the matched group it[1] is the first string in the matched group it[2] is the second string in the matched group

assert "FOO-FOO-" == "foobar-FooBar-".replaceAll("(([fF][oO]{2})[bB]ar)", { x, y, z -> z.toUpperCase() })

Here, x is the global string of the matched group y is the first string in the matched group z is the second string in the matched group


Parameters:
  self - a String
Parameters:
  regex - the capturing regex
Parameters:
  closure - the closure to apply on each captured group a String with replaced content



reverse
public static String reverse(String self)(Code)
Creates a new string which is the reverse (backwards) of this string
Parameters:
  self - a String a new string with all the characters reversed.



reverse
public static List reverse(List self)(Code)
Reverses the list
Parameters:
  self - a List a reversed List



reverseEach
public static void reverseEach(List self, Closure closure)(Code)
Iterate over each element of the list in the reverse order.
Parameters:
  self - a List
Parameters:
  closure - a closure



rightShift
public static Number rightShift(Number left, Number right)(Code)
Implementation of the right shift operator for integral types. Non integral Number types throw UnsupportedOperationException.



rightShiftUnsigned
public static Number rightShiftUnsigned(Number left, Number right)(Code)
Implementation of the right shift (unsigned) operator for integral types. Non integral Number types throw UnsupportedOperationException.



round
public static int round(Float number)(Code)
Get the absolute value
Parameters:
  number - a Float the absolute value of that Float



round
public static long round(Double number)(Code)
Round the value
Parameters:
  number - a Double the absolute value of that Double



runAfter
public static void runAfter(Timer timer, int delay, Closure closure)(Code)
Allow simple syntax for using timers.
Parameters:
  timer - a timer object
Parameters:
  delay - the delay in milliseconds before running the closure code
Parameters:
  closure -



setIndex
public static void setIndex(Matcher matcher, int idx)(Code)
Set the position of the given Matcher to the given index.
Parameters:
  matcher - a Matcher
Parameters:
  idx - the index number



size
public static int size(String text)(Code)
Makes a String look like a Collection by adding support for the size() method
Parameters:
  text - a String the length of the String



size
public static int size(StringBuffer buffer)(Code)
Provide standard Groovy size() method for StringBuffers
Parameters:
  buffer - a StringBuffer the length of the StringBuffer



size
public static long size(File file)(Code)
Provide the standard Groovy size method



size
public static long size(Matcher matcher)(Code)
Provide the standard Groovy size method



size
public static int size(Object[] self)(Code)
Makes an Array look like a Collection by adding support for the size() method
Parameters:
  self - an Array of Object the size of the Array



size
public static int size(byte[] array)(Code)



size
public static int size(char[] array)(Code)



size
public static int size(short[] array)(Code)



size
public static int size(int[] array)(Code)



size
public static int size(long[] array)(Code)



size
public static int size(float[] array)(Code)



size
public static int size(double[] array)(Code)



sort
public static List sort(Collection self)(Code)
Sorts the given collection into a sorted list.
Parameters:
  self - the collection to be sorted the sorted collection as a List



sort
public static SortedSet sort(SortedSet self)(Code)
Avoids doing unnecessary work when sorting an already sorted set
Parameters:
  self - the sorted set



sort
public static List sort(Collection self, Comparator comparator)(Code)
A convenience method for sorting a Collection with a specific comparator
Parameters:
  self - a collection to be sorted
Parameters:
  comparator - a Comparator used for the comparison a newly created sorted List



sort
public static List sort(Collection self, Closure closure)(Code)
A convenience method for sorting a Collection using a closure as a comparator
Parameters:
  self - a Collection to be sorted
Parameters:
  closure - a Closure used as a comparator a newly created sorted List



splitEachLine
public static void splitEachLine(File self, String sep, Closure closure) throws IOException(Code)
Iterates through the given file line by line, splitting on the seperator
Parameters:
  self - a File
Parameters:
  sep - a String separator
Parameters:
  closure - a closure
throws:
  IOException -



splitEachLine
public static void splitEachLine(Reader self, String sep, Closure closure) throws IOException(Code)
Iterates through the given reader line by line, splitting on the separator. The Reader is closed afterwards.
Parameters:
  self - a Reader, closed after the method returns
Parameters:
  sep - a String separator
Parameters:
  closure - a closure
throws:
  IOException -



spread
public static SpreadMap spread(Map self)(Code)



step
public static void step(Number self, Number to, Number stepNumber, Closure closure)(Code)
Iterates from this number up to the given number using a step increment
Parameters:
  self - a Number to start with
Parameters:
  to - a Number to go up to
Parameters:
  stepNumber - a Number representing the step increment
Parameters:
  closure - the closure to call



subListBorders
protected static RangeInfo subListBorders(int size, IntRange range)(Code)



subListBorders
protected static RangeInfo subListBorders(int size, EmptyRange range)(Code)



subMap
public static Map subMap(Map map, Collection keys)(Code)
Creates a sub-Map containing the given keys. This method is similar to List.subList() but uses keys rather than index ranges.
Parameters:
  map - a Map
Parameters:
  keys - a Collection of keys a new Map containing the given keys



sum
public static Object sum(Collection self)(Code)
Sums a collection of numeric values. coll.sum() is equivalent to: coll.inject(0) {value, item -> value + item}.
Parameters:
  self - Collection of values to add together. The sum of all of the list itmems.



sum
public static Object sum(Collection self, Closure closure)(Code)
Sums the result of apply a closure to each item of a collection. coll.sum(closure) is equivalent to: coll.collect(closure).sum().
Parameters:
  self - a Collection
Parameters:
  closure - a single parameter closure that returns a numeric value. The sum of the values returned by applying the closure to eachitem of the list.



times
public static void times(Number self, Closure closure)(Code)
Iterates a number of times
Parameters:
  self - a Number
Parameters:
  closure - the closure to call a number of times



toArrayString
public static String toArrayString(Object[] self)(Code)
Returns the string representation of the given array with the brace boundaries.
Parameters:
  self - an Object[] the string representation



toBigDecimal
public static BigDecimal toBigDecimal(String self)(Code)
Parse a String into a BigDecimal
Parameters:
  self - a String a BigDecimal



toBigDecimal
public static BigDecimal toBigDecimal(Number self)(Code)
Transform a Number into a BigDecimal
Parameters:
  self - a Number an BigDecimal



toBigInteger
public static BigInteger toBigInteger(String self)(Code)
Parse a String into a BigInteger
Parameters:
  self - a String a BigInteger



toBigInteger
public static BigInteger toBigInteger(Number self)(Code)
Transform a Number into a BigInteger
Parameters:
  self - a Number an BigInteger



toBoolean
public static Boolean toBoolean(String self)(Code)
Converts the given string into a Boolean object If the trimmed string is "true", "y" or "1" (ignoring case) then the result is true othewrwise it is false
Parameters:
  self - a String The Boolean value



toCharacter
public static Character toCharacter(String self)(Code)
Converts the given string into a Character object using the first character in the string
Parameters:
  self - a String the first Character



toDouble
public static Double toDouble(String self)(Code)
Parse a String into a Double
Parameters:
  self - a String a Double



toDouble
public static Double toDouble(Number self)(Code)
Transform a Number into a Double
Parameters:
  self - a Number an Double



toFloat
public static Float toFloat(String self)(Code)
Parse a String into a Float
Parameters:
  self - a String a Float



toFloat
public static Float toFloat(Number self)(Code)
Transform a Number into a Float
Parameters:
  self - a Number an Float



toInteger
public static Integer toInteger(String self)(Code)
Parse a String into an Integer
Parameters:
  self - a String an Integer



toInteger
public static Integer toInteger(Number self)(Code)
Transform a Number into an Integer
Parameters:
  self - a Number an Integer



toList
public static List toList(Collection self)(Code)
Convert a collection to a List.
Parameters:
  self - a collection a List



toList
public static List toList(Object[] array)(Code)
Allows conversion of arrays into a mutable List
Parameters:
  array - an Array of Objects the array as a List



toList
public static List toList(byte[] array)(Code)



toList
public static List toList(char[] array)(Code)



toList
public static List toList(short[] array)(Code)



toList
public static List toList(int[] array)(Code)



toList
public static List toList(long[] array)(Code)



toList
public static List toList(float[] array)(Code)



toList
public static List toList(double[] array)(Code)



toList
public static List toList(String self)(Code)
Converts the given String into a List of strings of one character
Parameters:
  self - a String a List of characters (a 1-character String)



toListString
public static String toListString(Collection self)(Code)
Returns the string representation of the given collection with the bracket boundaries.
Parameters:
  self - a Collection the string representation



toLong
public static Long toLong(String self)(Code)
Parse a String into a Long
Parameters:
  self - a String a Long



toLong
public static Long toLong(Number self)(Code)
Transform a Number into a Long
Parameters:
  self - a Number an Long



toMapString
public static String toMapString(Map self)(Code)
Returns the string representation of the given map with bracket boundaries.
Parameters:
  self - a Map the string representation



toSpreadMap
public static SpreadMap toSpreadMap(Map self)(Code)
Returns the converted SpreadLMap of the given self.

For examples, if there is defined a function like as

 def fn(a, b, c, d) { return a + b + c + d }
 
, then all of the following three have the same meaning.
 println fn(a:1, [b:2, c:3].toSpreadMap(), d:4)
 println fn(a:1, *:[b:2, c:3], d:4)
 println fn(a:1, b:2, c:3, d:4)
 


Parameters:
  self - a list to be converted into a spreadmap a newly created Spreadmap if this list is not null and its size is positive.




toSpreadMap
public static SpreadMap toSpreadMap(Object[] self)(Code)



toString
public static String toString(Map self)(Code)
Returns the string representation of the given map with bracket boundaries.
Parameters:
  self - a Map the string representation



toString
public static String toString(Collection self)(Code)
Returns the string representation of the given collection with the bracket boundaries.
Parameters:
  self - a Collection the string representation



toString
public static String toString(Object[] self)(Code)
Returns the string representation of the given array with the brace boundaries.
Parameters:
  self - an Object[] the string representation



toString
protected static String toString(Object value)(Code)



toURI
public static URI toURI(String self) throws URISyntaxException(Code)
Transforms a String representing a URI into a URI object.
Parameters:
  self - the String representing a URI a URI
throws:
  URISyntaxException - is thrown if the URI is not well formed.



toURL
public static URL toURL(String self) throws MalformedURLException(Code)
Transforms a String representing a URL into a URL object.
Parameters:
  self - the String representing a URL a URL
throws:
  MalformedURLException - is thrown if the URL is not well formed.



tokenize
public static List tokenize(String self, String token)(Code)
Tokenize a String
Parameters:
  self - a String
Parameters:
  token - the delimiter a List of tokens



tokenize
public static List tokenize(String self)(Code)
Tokenize a String (with a whitespace as delimiter)
Parameters:
  self - a String a List of tokens



transformChar
public static void transformChar(Reader reader, Writer writer, Closure closure) throws IOException(Code)
Transforms the characters from a reader with a Closure and write them to a writer.
Parameters:
  reader -
Parameters:
  writer -
Parameters:
  closure -



transformLine
public static void transformLine(Reader reader, Writer writer, Closure closure) throws IOException(Code)
Transforms the lines from a reader with a Closure and write them to a writer. Both Reader and Writer are closed after the operation
Parameters:
  reader - Lines of text to be transformed. Reader is closed afterwards.
Parameters:
  writer - Where transformed lines are written. Writer is closed afterwards.
Parameters:
  closure - Single parameter closure that is called to transform each line oftext from the reader, before writing it to the writer.



unique
public static Collection unique(Collection self)(Code)



unique
public static Collection unique(Collection self, Closure closure)(Code)
A convenience method for making a collection unique using a closure as a comparator (by Michael Baehr)
Parameters:
  self - a Collection
Parameters:
  closure - a Closure used as a comparator self without any duplicates



unique
public static Collection unique(Collection self, Comparator comparator)(Code)
Remove all duplicates from a given Collection. Works on the receiver object and returns it. The order of members in the Collection are compared by the given Comparator. For each duplicate, the first member which is returned by the given Collection's iterator is retained, but all other ones are removed. The given Collection's original order is preserved.

 class Person {

Parameters:
  self - a Collection
Parameters:
  comparator - a Comparator. self without duplicates



upto
public static void upto(Number self, Number to, Closure closure)(Code)
Iterates from this number up to the given number
Parameters:
  self - a Number
Parameters:
  to - another Number to go up to
Parameters:
  closure - the closure to call



upto
public static void upto(long self, Number to, Closure closure)(Code)



upto
public static void upto(Long self, Number to, Closure closure)(Code)



upto
public static void upto(float self, Number to, Closure closure)(Code)



upto
public static void upto(Float self, Number to, Closure closure)(Code)



upto
public static void upto(Double self, Number to, Closure closure)(Code)



upto
public static void upto(BigInteger self, Number to, Closure closure)(Code)



upto
public static void upto(BigDecimal self, Number to, Closure closure)(Code)



use
public static void use(Object self, Class categoryClass, Closure closure)(Code)
Scoped use method



use
public static void use(Object self, List categoryClassList, Closure closure)(Code)
Scoped use method with list of categories



use
public static void use(Object self, Object[] array)(Code)
use() a list of categories, specifying the list as varargs:
use(CategoryClass1, CategoryClass2) { ... }
This method prevents the error of forgetting to wrap the the category classes in a list.
Parameters:
  self -
Parameters:
  array -



waitForOrKill
public static void waitForOrKill(Process self, long numberOfMillis)(Code)
Wait for the process to finish during a certain amount of time, otherwise stops the process.
Parameters:
  self - a Process
Parameters:
  numberOfMillis - the number of milliseconds to wait before stopping the process



withInputStream
public static void withInputStream(File file, Closure closure) throws IOException(Code)
Helper method to create a new InputStream for a file and then passes it into the closure and ensures its closed again afterwords
Parameters:
  file - a File
throws:
  FileNotFoundException -



withOutputStream
public static void withOutputStream(File file, Closure closure) throws IOException(Code)
Helper method to create a new OutputStream for a file and then passes it into the closure and ensures its closed again afterwords
Parameters:
  file - a File
throws:
  FileNotFoundException -



withPrintWriter
public static void withPrintWriter(File file, Closure closure) throws IOException(Code)
Helper method to create a new PrintWriter for a file and then passes it into the closure and ensures its closed again afterwords
Parameters:
  file - a File
throws:
  FileNotFoundException -



withReader
public static void withReader(File file, Closure closure) throws IOException(Code)
Helper method to create a new BufferedReader for a file and then passes it into the closure and ensures its closed again afterwords
Parameters:
  file -
throws:
  FileNotFoundException -



withReader
public static void withReader(Reader reader, Closure closure) throws IOException(Code)
Allows a Reader to be used, calling the closure with the reader and then ensuring that the reader is closed down again irrespective of whether exceptions occur or the
Parameters:
  reader - the reader which is used and then closed
Parameters:
  closure - the closure that the writer is passed into
throws:
  IOException -



withReader
public static void withReader(URL url, Closure closure) throws IOException(Code)
Helper method to create a new BufferedReader for a URL and then passes it into the closure and ensures its closed again afterwords
Parameters:
  url - a URL
throws:
  FileNotFoundException -



withReader
public static void withReader(InputStream in, Closure closure) throws IOException(Code)
Helper method to create a new BufferedReader for a stream and then passes it into the closure and ensures its closed again afterwords
Parameters:
  in - a stream
throws:
  FileNotFoundException -



withStream
public static void withStream(InputStream stream, Closure closure) throws IOException(Code)
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
Parameters:
  stream - the stream which is used and then closed
Parameters:
  closure - the closure that the stream is passed into
throws:
  IOException -



withStream
public static void withStream(OutputStream os, Closure closure) throws IOException(Code)
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.
Parameters:
  os - the stream which is used and then closed
Parameters:
  closure - the closure that the stream is passed into
throws:
  IOException -



withStreams
public static void withStreams(Socket socket, Closure closure) throws IOException(Code)
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.
Parameters:
  socket - a Socket
Parameters:
  closure - a Closure
throws:
  IOException -



withWriter
public static void withWriter(File file, Closure closure) throws IOException(Code)
Helper method to create a new BufferedWriter for a file and then passes it into the closure and ensures it is closed again afterwords
Parameters:
  file - a File
Parameters:
  closure - a closure
throws:
  FileNotFoundException -



withWriter
public static void withWriter(File file, String charset, Closure closure) throws IOException(Code)
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
Parameters:
  file - a File
Parameters:
  charset - the charset used
Parameters:
  closure - a closure
throws:
  FileNotFoundException -



withWriter
public static void withWriter(Writer writer, Closure closure) throws IOException(Code)
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
Parameters:
  writer - the writer which is used and then closed
Parameters:
  closure - the closure that the writer is passed into
throws:
  IOException -



withWriter
public static void withWriter(OutputStream stream, Closure closure) throws IOException(Code)
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
Parameters:
  stream - the stream which is used and then closed
Parameters:
  closure - the closure that the writer is passed into
throws:
  IOException -



withWriter
public static void withWriter(OutputStream stream, String charset, Closure closure) throws IOException(Code)
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.
Parameters:
  stream - the stream which is used and then closed
Parameters:
  charset - the charset used
Parameters:
  closure - the closure that the writer is passed into
throws:
  IOException -



withWriterAppend
public static void withWriterAppend(File file, String charset, Closure closure) throws IOException(Code)
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
Parameters:
  file - a File
Parameters:
  charset - the charset used
Parameters:
  closure - a closure
throws:
  FileNotFoundException -



write
public static void write(Writer self, Writable writable) throws IOException(Code)
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.
Parameters:
  self - a Writer
Parameters:
  writable - an object implementing the Writable interface



write
public static void write(File file, String text) throws IOException(Code)
Write the text to the File.
Parameters:
  file - a File
Parameters:
  text - the text to write to the File
throws:
  IOException -



write
public static void write(File file, String text, String charset) throws IOException(Code)
Write the text to the File with a specified encoding.
Parameters:
  file - a File
Parameters:
  text - the text to write to the File
Parameters:
  charset - the charset used
throws:
  IOException -



writeLine
public static void writeLine(BufferedWriter writer, String line) throws IOException(Code)
Write the text and append a new line (depending on the platform line-ending)
Parameters:
  writer - a BufferedWriter
Parameters:
  line - the line to write
throws:
  IOException -



xor
public static Number xor(Number left, Number right)(Code)
Bitwise XOR together two Numbers
Parameters:
  left - a Number
Parameters:
  right - another Number to bitwse XOR the bitwise XOR of both Numbers



xor
public static Boolean xor(Boolean left, Boolean right)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.