edu.umd.cs.findbugs.util
Class Util
java.lang.Object
edu.umd.cs.findbugs.util.Util
public class Util
- extends java.lang.Object
- Author:
- William Pugh
Field Summary |
static boolean |
LOGGING
|
Constructor Summary |
Util()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOGGING
public static final boolean LOGGING
Util
public Util()
compare
public static int compare(int x,
int y)
- return sign of x - y
- Parameters:
x
- y
-
- Returns:
compare
public static int compare(long x,
long y)
- return sign of x - y
- Parameters:
x
- y
-
- Returns:
setBitIteratable
public static java.lang.Iterable<java.lang.Integer> setBitIteratable(java.util.BitSet b)
setBitIterator
public static java.util.Iterator<java.lang.Integer> setBitIterator(java.util.BitSet b)
repeat
public static java.lang.String repeat(java.lang.String s,
int number)
runLogAtShutdown
public static void runLogAtShutdown(java.lang.Runnable r)
emptyOrNonnullSingleton
public static <T> java.util.Set<T> emptyOrNonnullSingleton(T t)
immutableMap
public static <K,V> java.util.Map<K,V> immutableMap(java.util.Map<K,V> map)
nullSafeHashcode
public static int nullSafeHashcode(@CheckForNull
java.lang.Object o)
nullSafeEquals
public static <T> boolean nullSafeEquals(@CheckForNull
T o1,
@CheckForNull
T o2)
nullSafeCompareTo
public static <T extends java.lang.Comparable<? super T>> int nullSafeCompareTo(@CheckForNull
T o1,
@CheckForNull
T o2)
getReader
public static java.io.Reader getReader(@WillCloseWhenClosed
java.io.InputStream in)
throws java.io.UnsupportedEncodingException
- Throws:
java.io.UnsupportedEncodingException
getFileReader
public static java.io.Reader getFileReader(java.lang.String filename)
throws java.io.UnsupportedEncodingException,
java.io.FileNotFoundException
- Throws:
java.io.UnsupportedEncodingException
java.io.FileNotFoundException
getFileReader
public static java.io.Reader getFileReader(java.io.File filename)
throws java.io.UnsupportedEncodingException,
java.io.FileNotFoundException
- Throws:
java.io.UnsupportedEncodingException
java.io.FileNotFoundException
getWriter
public static java.io.Writer getWriter(@WillCloseWhenClosed
java.io.OutputStream out)
throws java.io.UnsupportedEncodingException,
java.io.FileNotFoundException
- Throws:
java.io.UnsupportedEncodingException
java.io.FileNotFoundException
getFileWriter
public static java.io.Writer getFileWriter(java.lang.String filename)
throws java.io.UnsupportedEncodingException,
java.io.FileNotFoundException
- Throws:
java.io.UnsupportedEncodingException
java.io.FileNotFoundException
closeSilently
public static void closeSilently(@WillClose
java.sql.Connection c)
closeSilently
public static void closeSilently(@WillClose
java.io.InputStream in)
closeSilently
public static void closeSilently(@WillClose
java.io.Reader in)
closeSilently
public static void closeSilently(@WillClose
java.io.OutputStream out)
getXMLType
public static java.lang.String getXMLType(@WillNotClose
java.io.InputStream in)
throws java.io.IOException
- Throws:
java.io.IOException
makeIOException
public static java.io.IOException makeIOException(java.lang.String msg,
java.lang.Throwable cause)
getFileExtension
public static java.lang.String getFileExtension(java.io.File f)
throwIOException
public static void throwIOException(java.lang.String msg,
java.lang.Throwable cause)
throws java.io.IOException
- Throws:
java.io.IOException
first
public static <E> E first(java.lang.Iterable<E> i)
- Parameters:
i
- the Iterable whose first element is to be retrieved
- Returns:
- first element of iterable
commonPrefix
public static java.lang.String commonPrefix(java.lang.String s1,
java.lang.String s2)
FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.