Package org.codehaus.groovy.runtime
Class DefaultGroovyMethodsSupport
java.lang.Object
org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport
- Direct Known Subclasses:
- DateGroovyMethods,- DefaultGroovyMethods,- IOGroovyMethods,- NioExtensions,- NioGroovyMethods,- PluginDefaultGroovyMethods,- PluginDefaultGroovyMethods,- ProcessGroovyMethods,- ResourceGroovyMethods,- SocketGroovyMethods,- StringGroovyMethods
public class DefaultGroovyMethodsSupport
extends java.lang.Object
Support methods for DefaultGroovyMethods and PluginDefaultMethods.
- 
Constructor SummaryConstructors Constructor Description DefaultGroovyMethodsSupport()
- 
Method SummaryModifier and Type Method Description protected static <T> java.util.Collection<T>cloneSimilarCollection(java.util.Collection<T> orig, int newCapacity)protected static <K, V> java.util.Map<K,V>cloneSimilarMap(java.util.Map<K,V> orig)static voidcloseQuietly(java.io.Closeable c)Close the Closeable.static voidcloseWithWarning(java.io.Closeable closeable)Close the Closeable.protected static <T> T[]createSimilarArray(T[] orig, int newCapacity)protected static <T> java.util.Collection<T>createSimilarCollection(java.lang.Iterable<T> iterable)protected static <T> java.util.Collection<T>createSimilarCollection(java.util.Collection<T> collection)protected static <T> java.util.Collection<T>createSimilarCollection(java.util.Collection<T> orig, int newCapacity)protected static <T> java.util.List<T>createSimilarList(java.util.List<T> orig, int newCapacity)protected static <K, V> java.util.Map<K,V>createSimilarMap(java.util.Map<K,V> orig)protected static java.util.CollectioncreateSimilarOrDefaultCollection(java.lang.Object object)protected static <T> java.util.Queue<T>createSimilarQueue(java.util.Queue<T> orig)protected static <T> java.util.Set<T>createSimilarSet(java.util.Set<T> orig)protected static intnormaliseIndex(int i, int size)This converts a possibly negative index to a real index into the array.protected static booleansameType(java.util.Collection[] cols)Determines if all items of this array are of the same type.protected static RangeInfosubListBorders(int size, EmptyRange range)protected static RangeInfosubListBorders(int size, Range range)protected static voidwriteUTF16BomIfRequired(java.io.OutputStream stream, java.lang.String charset)protected static voidwriteUTF16BomIfRequired(java.io.OutputStream stream, java.nio.charset.Charset charset)protected static voidwriteUTF16BomIfRequired(java.io.Writer writer, java.lang.String charset)protected static voidwriteUTF16BomIfRequired(java.io.Writer writer, java.nio.charset.Charset charset)Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
- 
Constructor Details- 
DefaultGroovyMethodsSupportpublic DefaultGroovyMethodsSupport()
 
- 
- 
Method Details- 
subListBorders
- 
subListBorders
- 
normaliseIndexprotected static int normaliseIndex(int i, int size)This converts a possibly negative index to a real index into the array.- Parameters:
- i- the unnormalized index
- size- the array size
- Returns:
- the normalised index
 
- 
closeWithWarningpublic static void closeWithWarning(java.io.Closeable closeable)Close the Closeable. Logging a warning if any problems occur.- Parameters:
- closeable- the thing to close
 
- 
closeQuietlypublic static void closeQuietly(java.io.Closeable c)Close the Closeable. Ignore any problems that might occur.- Parameters:
- c- the thing to close
 
- 
cloneSimilarCollectionprotected static <T> java.util.Collection<T> cloneSimilarCollection(java.util.Collection<T> orig, int newCapacity)
- 
createSimilarOrDefaultCollectionprotected static java.util.Collection createSimilarOrDefaultCollection(java.lang.Object object)
- 
createSimilarCollectionprotected static <T> java.util.Collection<T> createSimilarCollection(java.lang.Iterable<T> iterable)
- 
createSimilarCollectionprotected static <T> java.util.Collection<T> createSimilarCollection(java.util.Collection<T> collection)
- 
createSimilarCollectionprotected static <T> java.util.Collection<T> createSimilarCollection(java.util.Collection<T> orig, int newCapacity)
- 
createSimilarListprotected static <T> java.util.List<T> createSimilarList(java.util.List<T> orig, int newCapacity)
- 
createSimilarArrayprotected static <T> T[] createSimilarArray(T[] orig, int newCapacity)
- 
createSimilarSetprotected static <T> java.util.Set<T> createSimilarSet(java.util.Set<T> orig)
- 
createSimilarQueueprotected static <T> java.util.Queue<T> createSimilarQueue(java.util.Queue<T> orig)
- 
createSimilarMapprotected static <K, V> java.util.Map<K,V> createSimilarMap(java.util.Map<K,V> orig)
- 
cloneSimilarMapprotected static <K, V> java.util.Map<K,V> cloneSimilarMap(java.util.Map<K,V> orig)
- 
sameTypeprotected static boolean sameType(java.util.Collection[] cols)Determines if all items of this array are of the same type.- Parameters:
- cols- an array of collections
- Returns:
- true if the collections are all of the same type
 
- 
writeUTF16BomIfRequiredprotected static void writeUTF16BomIfRequired(java.io.Writer writer, java.lang.String charset) throws java.io.IOException- Throws:
- java.io.IOException
 
- 
writeUTF16BomIfRequiredprotected static void writeUTF16BomIfRequired(java.io.Writer writer, java.nio.charset.Charset charset) throws java.io.IOException- Throws:
- java.io.IOException
 
- 
writeUTF16BomIfRequiredprotected static void writeUTF16BomIfRequired(java.io.OutputStream stream, java.lang.String charset) throws java.io.IOException- Throws:
- java.io.IOException
 
- 
writeUTF16BomIfRequiredprotected static void writeUTF16BomIfRequired(java.io.OutputStream stream, java.nio.charset.Charset charset) throws java.io.IOException- Throws:
- java.io.IOException
 
 
-