Package org.codehaus.groovy.runtime
Class DefaultGroovyMethodsSupport
java.lang.Object
org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport
- Direct Known Subclasses:
DefaultGroovyMethods
,IOGroovyMethods
,NioExtensions
,PluginDefaultGroovyMethods
,PluginDefaultGroovyMethods
,ProcessGroovyMethods
,ResourceGroovyMethods
,SocketGroovyMethods
,StringGroovyMethods
Support methods for DefaultGroovyMethods and PluginDefaultMethods.
-
Constructor Summary
-
Method Summary
Modifier 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 void
Close the Closeable.static void
closeWithWarning
(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 Collection
protected static <T> Queue<T>
createSimilarQueue
(Queue<T> orig) protected static <T> Set<T>
createSimilarSet
(Set<T> orig) protected static int
normaliseIndex
(int i, int size) This converts a possibly negative index to a real index into the array.protected static boolean
sameType
(Collection[] cols) Determines if all items of this array are of the same type.protected static RangeInfo
subListBorders
(int size, EmptyRange range) protected static RangeInfo
subListBorders
(int size, Range range) protected static IntRange
subListRange
(RangeInfo info, IntRange range) protected static void
writeUTF16BomIfRequired
(OutputStream stream, String charset) protected static void
writeUTF16BomIfRequired
(OutputStream stream, Charset charset) protected static void
writeUTF16BomIfRequired
(Writer writer, String charset) protected static void
writeUTF16BomIfRequired
(Writer writer, Charset charset)
-
Constructor Details
-
DefaultGroovyMethodsSupport
public DefaultGroovyMethodsSupport()
-
-
Method Details
-
subListBorders
-
subListBorders
-
subListRange
-
normaliseIndex
protected static int normaliseIndex(int i, int size) This converts a possibly negative index to a real index into the array.- Parameters:
i
- the unnormalized indexsize
- the array size- Returns:
- the normalised index
-
closeWithWarning
Close the Closeable. Logging a warning if any problems occur.- Parameters:
closeable
- the thing to close
-
closeQuietly
Close the Closeable. Ignore any problems that might occur.- Parameters:
c
- the thing to close
-
cloneSimilarCollection
-
createSimilarOrDefaultCollection
-
createSimilarCollection
-
createSimilarCollection
-
createSimilarCollection
-
createSimilarList
-
createSimilarArray
protected static <T> T[] createSimilarArray(T[] orig, int newCapacity) -
createSimilarSet
-
createSimilarQueue
-
createSimilarMap
-
cloneSimilarMap
-
sameType
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
-
writeUTF16BomIfRequired
- Throws:
IOException
-
writeUTF16BomIfRequired
- Throws:
IOException
-
writeUTF16BomIfRequired
protected static void writeUTF16BomIfRequired(OutputStream stream, String charset) throws IOException - Throws:
IOException
-
writeUTF16BomIfRequired
protected static void writeUTF16BomIfRequired(OutputStream stream, Charset charset) throws IOException - Throws:
IOException
-