Package org.codehaus.groovy.runtime
Class DefaultGroovyMethodsSupport
java.lang.Object
org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport
- Direct Known Subclasses:
- ArrayGroovyMethods,- DefaultGroovyMethods,- IOGroovyMethods,- NioExtensions,- PluginDefaultGroovyMethods,- PluginDefaultGroovyMethods,- ProcessGroovyMethods,- ResourceGroovyMethods,- SocketGroovyMethods,- StringGroovyMethods
Support methods for DefaultGroovyMethods and PluginDefaultMethods.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected static <T> Collection<T>cloneSimilarCollection(Collection<T> orig, int newCapacity) protected static <K,V> Map<K, V> cloneSimilarMap(Map<K, V> orig) static voidCloses the Closeable, ignoring any problems that might occur.static voidcloseWithWarning(Closeable closeable) Close the Closeable.protected static <T> T[]createSimilarArray(T[] orig, int newCapacity) protected static <T> Collection<T>createSimilarCollection(Iterable<T> iterable) protected static <T> Collection<T>createSimilarCollection(Collection<T> collection) protected static <T> Collection<T>createSimilarCollection(Collection<T> orig, int newCapacity) protected static <T> List<T>createSimilarList(List<T> orig, int newCapacity) protected static <K,V> Map<K, V> createSimilarMap(Map<K, V> orig) protected static Collectionprotected static <T> Queue<T>createSimilarQueue(Queue<T> orig) protected static <T> Set<T>createSimilarSet(Set<T> orig) protected static intnormaliseIndex(int i, int size) Converts a possibly negative index to a real index into the array.protected static booleanDetermines if all items of given array are of the same type.protected static booleansameType(Collection[] cols) Determines if all items of given array are of the same type.protected static RangeInfosubListBorders(int size, EmptyRange range) Helper method for getAt and putAt.protected static RangeInfosubListBorders(int size, Range range) Helper method for getAt and putAt.protected static IntRangesubListRange(RangeInfo info, IntRange range) Helper method for primitive array getAt.protected static voidwriteUTF16BomIfRequired(OutputStream stream, String charset) protected static voidwriteUTF16BomIfRequired(OutputStream stream, Charset charset) protected static voidwriteUTF16BomIfRequired(Writer writer, String charset) protected static voidwriteUTF16BomIfRequired(Writer writer, Charset charset) 
- 
Constructor Details- 
DefaultGroovyMethodsSupportpublic DefaultGroovyMethodsSupport()
 
- 
- 
Method Details- 
subListBordersHelper method for getAt and putAt.
- 
subListBordersHelper method for getAt and putAt.
- 
subListRangeHelper method for primitive array getAt.
- 
normaliseIndexprotected static int normaliseIndex(int i, int size) 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
 
- 
closeWithWarningClose the Closeable. Logging a warning if any problems occur.- Parameters:
- closeable- the thing to close
 
- 
closeQuietlyCloses the Closeable, ignoring any problems that might occur.- Parameters:
- c- the thing to close
 
- 
cloneSimilarCollection
- 
cloneSimilarMap
- 
createSimilarOrDefaultCollection
- 
createSimilarCollection
- 
createSimilarCollection
- 
createSimilarCollection
- 
createSimilarList
- 
createSimilarArrayprotected static <T> T[] createSimilarArray(T[] orig, int newCapacity) 
- 
createSimilarSet
- 
createSimilarQueue
- 
createSimilarMap
- 
sameTypeDetermines if all items of given array are of the same type.- Parameters:
- cols- an array of collections
- Returns:
- true if the collections are all of the same type
 
- 
sameTypeDetermines if all items of given array are of the same type.
- 
writeUTF16BomIfRequired- Throws:
- IOException
 
- 
writeUTF16BomIfRequired- Throws:
- IOException
 
- 
writeUTF16BomIfRequiredprotected static void writeUTF16BomIfRequired(OutputStream stream, String charset) throws IOException - Throws:
- IOException
 
- 
writeUTF16BomIfRequiredprotected static void writeUTF16BomIfRequired(OutputStream stream, Charset charset) throws IOException - Throws:
- IOException
 
 
-