Class 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 Summary

    Constructor Description
  • Method Summary

    Modifier 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 void closeQuietly​( c)
    Close the Closeable.
    static void closeWithWarning​( 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.Collection createSimilarOrDefaultCollection​(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 int normaliseIndex​(int i, int size)
    This converts a possibly negative index to a real index into the array.
    protected static boolean sameType​(java.util.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 void writeUTF16BomIfRequired​( stream, java.lang.String charset)  
    protected static void writeUTF16BomIfRequired​( stream, java.nio.charset.Charset charset)  
    protected static void writeUTF16BomIfRequired​( writer, java.lang.String charset)  
    protected static void writeUTF16BomIfRequired​( writer, java.nio.charset.Charset charset)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultGroovyMethodsSupport

      public DefaultGroovyMethodsSupport()
  • Method Details

    • subListBorders

      protected static RangeInfo subListBorders​(int size, Range range)
    • subListBorders

      protected static RangeInfo subListBorders​(int size, EmptyRange range)
    • normaliseIndex

      protected static int normaliseIndex​(int i, int size)
      This converts a possibly negative index to a real index into the array.
      i - the unnormalized index
      size - the array size
      the normalised index
    • closeWithWarning

      public static void closeWithWarning​( closeable)
      Close the Closeable. Logging a warning if any problems occur.
      closeable - the thing to close
    • closeQuietly

      public static void closeQuietly​( c)
      Close the Closeable. Ignore any problems that might occur.
      c - the thing to close
    • cloneSimilarCollection

      protected static <T> java.util.Collection<T> cloneSimilarCollection​(java.util.Collection<T> orig, int newCapacity)
    • createSimilarOrDefaultCollection

      protected static java.util.Collection createSimilarOrDefaultCollection​(java.lang.Object object)
    • createSimilarCollection

      protected static <T> java.util.Collection<T> createSimilarCollection​(java.lang.Iterable<T> iterable)
    • createSimilarCollection

      protected static <T> java.util.Collection<T> createSimilarCollection​(java.util.Collection<T> collection)
    • createSimilarCollection

      protected static <T> java.util.Collection<T> createSimilarCollection​(java.util.Collection<T> orig, int newCapacity)
    • createSimilarList

      protected static <T> java.util.List<T> createSimilarList​(java.util.List<T> orig, int newCapacity)
    • createSimilarArray

      protected static <T> T[] createSimilarArray​(T[] orig, int newCapacity)
    • createSimilarSet

      protected static <T> java.util.Set<T> createSimilarSet​(java.util.Set<T> orig)
    • createSimilarQueue

      protected static <T> java.util.Queue<T> createSimilarQueue​(java.util.Queue<T> orig)
    • createSimilarMap

      protected static <K,​ V> java.util.Map<K,​V> createSimilarMap​(java.util.Map<K,​V> orig)
    • cloneSimilarMap

      protected static <K,​ V> java.util.Map<K,​V> cloneSimilarMap​(java.util.Map<K,​V> orig)
    • sameType

      protected static boolean sameType​(java.util.Collection[] cols)
      Determines if all items of this array are of the same type.
      cols - an array of collections
      true if the collections are all of the same type
    • writeUTF16BomIfRequired

      protected static void writeUTF16BomIfRequired​( writer, java.lang.String charset) throws
    • writeUTF16BomIfRequired

      protected static void writeUTF16BomIfRequired​( writer, java.nio.charset.Charset charset) throws
    • writeUTF16BomIfRequired

      protected static void writeUTF16BomIfRequired​( stream, java.lang.String charset) throws
    • writeUTF16BomIfRequired

      protected static void writeUTF16BomIfRequired​( stream, java.nio.charset.Charset charset) throws