|
Buju 0.4 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object biz.bbeans.util.BUtil
A collection of static utility methods.
Field Summary | |
static String |
SPACE
A single space |
Method Summary | |
static void |
debug(Object o,
String s)
Prints the object name and specified string to System.out . |
static Properties |
getBundleAsProperties(String fileName,
Locale locale,
Properties defaults)
|
static String |
getCopyrightMsg()
Returns copyright message. |
static DateFormat |
getDateFormat(String pattern)
Get a localized date format object, using the given pattern, if possible. |
static FileInputStream |
getFileInputStream(String fileName)
Get a FileInputStream for given file name. |
static FileOutputStream |
getFileOutputStream(String fileName)
Get a FileOutputStream for given file name. |
static String |
getFirstClassPath()
Return the first directory name in the classpath. |
static NumberFormat |
getNumberFormat(String pattern)
Get a localized number format object, using the given pattern, if possible. |
static Properties |
getProperties(String resourceName)
Convenience method to retrieve Properties from a system resource with the given name. |
static void |
handleException(Throwable exc)
General exception handling method, which prints the exception message to System.err and the stack trace. |
static Object |
loadObject(String fileName)
Loads serializable object from the specified file name. |
static String |
pad(String s,
int length)
Forces string to be the given length by padding with spaces or truncating. |
static void |
print(InputStream in,
OutputStream out)
Print the input stream to the output stream using a BufferedReader and BufferedWriter. |
static void |
run(String className,
String[] args)
Load the given class and call its main method in a new thread, passing the given arguments. |
static void |
storeObject(String fileName,
Serializable s)
Saves serializable object to the specified file name. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String SPACE
Method Detail |
public static final void debug(Object o, String s)
System.out
.
o
- should usually be the object calling this method.s
- string to print following the name of the object.public static final Properties getBundleAsProperties(String fileName, Locale locale, Properties defaults) throws MissingResourceException
MissingResourceException
public static final String getFirstClassPath()
public static final String getCopyrightMsg()
public static final DateFormat getDateFormat(String pattern)
pattern
- The template to use for formatting date strings and
parsing Date objects.
public static final FileInputStream getFileInputStream(String fileName)
public static final FileOutputStream getFileOutputStream(String fileName)
public static final NumberFormat getNumberFormat(String pattern)
pattern
- The template to use for parsing number strings and
formatting Number objects.
public static final Properties getProperties(String resourceName) throws IOException
BMail(Properties)
constructor.
try {
Properties props = BUtil.getProperties("mail.properties");
BMail myMailMessage = new BMail(props);
}
catch (java.io.IOException exc) {
//handle exception
}
resourceName
- The name of the system resource. Must be
visible and resolvable within the ClassLoader's classpath.
IOException
- If the properties cannot be loaded from the
input stream associated with the system resource.public static final void handleException(Throwable exc)
System.err
and the stack trace.
exc
- exception.public static final Object loadObject(String fileName) throws IOException, ClassNotFoundException, Throwable
fileName
- name of file containing serialized object.
IOException.
IOException
ClassNotFoundException
Throwable
public static final String pad(String s, int length)
s
- string to pad or truncate.length
- length of returned stringpublic static void print(InputStream in, OutputStream out)
public static final void run(String className, String[] args) throws ClassNotFoundException, IllegalArgumentException, NoSuchMethodException
ClassNotFoundException
IllegalArgumentException
NoSuchMethodException
public static final void storeObject(String fileName, Serializable s) throws IOException
s
- serializable object.fileName
- name of file to serialize object to.
IOException.
IOException
|
Buju 0.4 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |