KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > groovy > tools > Utilities


1 package org.codehaus.groovy.tools;
2
3 /**
4  * Various utility functions for use in the compiler.
5  */

6
7 public abstract class Utilities
8 {
9    /**
10     * Returns a string made up of repetitions of the specified string.
11     */

12
13     public static String JavaDoc repeatString( String JavaDoc pattern, int repeats )
14     {
15         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc( pattern.length() * repeats );
16         for( int i = 0; i < repeats; i++ )
17         {
18             buffer.append( pattern );
19         }
20
21         return new String JavaDoc( buffer );
22     }
23
24
25    /**
26     * Returns the end-of-line marker.
27     */

28
29     public static String JavaDoc eol()
30     {
31         return eol;
32     }
33     
34     private static String JavaDoc eol = System.getProperty( "line.separator", "\n" );
35
36 }
37
Popular Tags