Class Util

java.lang.Object
edu.umd.cs.findbugs.util.Util

public class Util extends Object
  • Field Details

  • Constructor Details

    • Util

      public Util()
  • Method Details

    • startDameonThread

      public static Thread startDameonThread(Thread t)
    • runInDameonThread

      public static Thread runInDameonThread(Runnable r, String name)
    • runInDameonThread

      public static Thread runInDameonThread(Runnable r)
    • repeat

      public static String repeat(String s, int number)
    • runLogAtShutdown

      public static void runLogAtShutdown(Runnable r)
    • emptyOrNonnullSingleton

      public static <T> Set<T> emptyOrNonnullSingleton(T t)
    • immutableMap

      public static <K,V> Map<K,V> immutableMap(Map<K,V> map)
    • getReader

      public static Reader getReader(@WillCloseWhenClosed InputStream in)
    • getFileReader

      public static Reader getFileReader(String filename) throws IOException
      Throws:
      IOException
    • getFileReader

      public static Reader getFileReader(File filename) throws IOException
      Throws:
      IOException
    • getWriter

      public static Writer getWriter(@WillCloseWhenClosed OutputStream out)
    • getFileWriter

      public static Writer getFileWriter(String filename) throws IOException
      Throws:
      IOException
    • closeSilently

      public static void closeSilently(@WillClose InputStream in)
    • closeSilently

      @Deprecated public static void closeSilently(@WillClose Reader in)
      Deprecated.
      Use try-with-resources instead.
    • closeSilently

      @Deprecated public static void closeSilently(@WillClose OutputStream out)
      Deprecated.
      Use try-with-resources instead. And basically IOException from OutputStream.close() is not good to ignore.
    • closeSilently

      @Deprecated public static void closeSilently(@WillClose Closeable out)
      Deprecated.
      Use try-with-resources instead. And basically IOException from OutputStream.close() is not good to ignore.
    • closeSilently

      @Deprecated public static void closeSilently(@WillClose ZipFile zip)
      Deprecated.
      Use try-with-resources instead.
    • getXMLType

      public static String getXMLType(@WillNotClose InputStream in) throws IOException
      Throws:
      IOException
    • getFileExtension

      private static String getFileExtension(String name)
    • getFileExtension

      public static String getFileExtension(File f)
    • getFileExtensionIgnoringGz

      public static String getFileExtensionIgnoringGz(File f)
    • first

      public static <E> E first(Iterable<E> i)
      Parameters:
      i - the Iterable whose first element is to be retrieved
      Returns:
      first element of iterable
    • makeSmallHashMap

      public static <K,V> HashMap<K,V> makeSmallHashMap(Map<K,V> m)
    • makeSmallHashSet

      public static <K> HashSet<K> makeSmallHashSet(Collection<K> m)
    • makeSmallArrayList

      public static <K> ArrayList<K> makeSmallArrayList(List<K> m)
    • addTo

      public static <K> Set<K> addTo(Set<K> s, K k)
    • addTo

      public static <K> List<K> addTo(List<K> s, K k)
    • getMD5Digest

      @Nonnull public static MessageDigest getMD5Digest()
    • isPowerOfTwo

      public static boolean isPowerOfTwo(int i)