|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavapoint.StaticClasses.Utilities
public class Utilities
| Field Summary | |
|---|---|
static int |
DEBUG_STACK_OFFSET
|
| Method Summary | ||
|---|---|---|
static void |
close(java.lang.Object closable)
Tries to close closable using reflection and without throwing an exception if it fails. |
|
static javax.swing.JFileChooser |
createFileChooser()
|
|
static javax.swing.JFileChooser |
createImageFileChooser()
|
|
static java.io.File |
createTemporaryFile(java.lang.String prefix,
java.lang.String suffix,
boolean persistent,
java.io.InputStream contents)
Tries to create a temporary file and initialize it using contents. |
|
static java.lang.String |
debug(int stackOffset,
java.lang.Object... objects)
Concatenates the source location of the call and the string representations of the parameters separated by spaces. |
|
static void |
debugPrint(java.lang.Object... objects)
Prints on the standard output the concatenation of the source location of the call and the string representations of the parameters separated by spaces. |
|
static java.io.File |
getApplicationFile()
|
|
static java.net.URL |
getApplicationURL()
|
|
static java.lang.Class<?> |
getCallerClass()
If a method A.a() calls a method B.b(), then the result of calling this method in b() will be A.class. |
|
static java.lang.String |
getCallerMethodName()
If a method a() calls a method b(), then the result of calling this method in b() will be "a". |
|
static int |
getDebugStackOffset()
|
|
static java.util.logging.Logger |
getLoggerForThisMethod()
Calls Logger.getLogger(String) using the fully qualified name of the calling method. |
|
static
|
throwUnchecked(java.lang.Throwable cause)
Use this method when you want to propagate a checked exception wrapped in a runtime exception instead of using the normal checked exception mechanism. |
|
static
|
toList(java.util.Enumeration<T> enumeration)
|
|
static void |
write(java.io.InputStream input,
java.io.OutputStream output)
Writes input to output; this method does not close the streams when it terminates. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEBUG_STACK_OFFSET
| Method Detail |
|---|
public static java.io.File createTemporaryFile(java.lang.String prefix,
java.lang.String suffix,
boolean persistent,
java.io.InputStream contents)
throws java.io.IOException
contents.
contents is closed at the end of this method.
prefix - suffix - persistent - true if the file shouldn't be automatically deletedcontents - java.io.IOException - ifcontents to the file
public static void write(java.io.InputStream input,
java.io.OutputStream output)
throws java.io.IOException
input to output; this method does not close the streams when it terminates.
input - output - java.io.IOException - if an I/O error occurspublic static void close(java.lang.Object closable)
closable using reflection and without throwing an exception if it fails.
closable - public static <T> java.util.List<T> toList(java.util.Enumeration<T> enumeration)
T - The type of the elementsenumeration - public static java.net.URL getApplicationURL()
public static java.io.File getApplicationFile()
public static java.lang.Class<?> getCallerClass()
A.a() calls a method B.b(), then the result of calling this method in b() will be A.class.
Thread.currentThread().getStackTrace().
null if the caller class cannot be retrieved
public static java.lang.String getCallerMethodName()
a() calls a method b(), then the result of calling this method in b() will be "a".
Thread.currentThread().getStackTrace().
null if the caller method cannot be retrieved
public static java.util.logging.Logger getLoggerForThisMethod()
Logger.getLogger(String) using the fully qualified name of the calling method.
Thread.currentThread().getStackTrace().
java.lang.NullPointerException - if the caller class cannot be retrievedpublic static <T> T throwUnchecked(java.lang.Throwable cause)
T - the type that the caller is supposed to returncause - java.lang.RuntimeException - with cause as cause if it is a checked exception, otherwise cause is re-thrown
public static java.lang.String debug(int stackOffset,
java.lang.Object... objects)
stackOffset - DEBUG_STACK_OFFSET is the source of the call,
DEBUG_STACK_OFFSET + 1 is the source of the call's caller, and so forth
[O .. Integer.MAX_VALUE]objects - public static void debugPrint(java.lang.Object... objects)
objects - public static int getDebugStackOffset()
[0 .. Integer.MAX_VALUE]public static javax.swing.JFileChooser createFileChooser()
public static javax.swing.JFileChooser createImageFileChooser()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||