|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eaglei.datatools.etl.utils.BasicUtils
public class BasicUtils
Title: BasicUtils
Description: A collection of basic functions for standard operations like saving a string to file, and centering a frame
Copyright: Copyright (c) 2003
Company: Mindswap (http://www.mindswap.org)
| Constructor Summary | |
|---|---|
BasicUtils()
|
|
| Method Summary | |
|---|---|
static void |
centerFrame(java.awt.Window theParent,
java.awt.Window theFrame)
Centers a frame with respect to another window, or the whole screen |
static java.util.Set |
collectElements(java.util.Iterator theIter)
Returns the list of elements returned by an iterator in a Set |
static boolean |
containsAny(java.util.Set theList,
java.util.Set toSearch)
Checks to see if any elements of one set are present in another. |
static java.lang.String |
convertStreamToString(java.io.InputStream is)
|
static java.lang.String |
convertStringToUnicodeString(java.lang.String s)
Converts a regular java string to its unicode string representation |
static java.net.URL |
encode(java.net.URL theURL)
Encodes the specified URL, changes spaces to %20 |
static java.lang.String |
getFileAsString(java.lang.String fn)
Given a path to a file on the local disk, return the contents of that file as a String. |
static java.lang.String |
getRandomString()
Returns a randomly generated string of up to 15 characters. |
static java.lang.String |
getRandomString(int numChars)
Returns a randomly generated string of up to X characters. |
static java.lang.String |
getStringFromBufferedReader(java.io.BufferedReader aReader)
Read the contents of the specified reader return them as a String |
static java.awt.Image |
getTranslucentVersionOf(java.awt.Image img)
Changes an images alpha values to the specified value. |
static java.lang.String |
getURLAsString(java.net.URL theURL)
Returns the specified URL as a string. |
static java.lang.String |
hexEntityStringConvert(java.lang.String theString)
Converts any hex entity type chars ("é") to their ascii equivalent |
static boolean |
isFileURL(java.lang.String s)
Returns string if the parameter represents a valid file URL |
static boolean |
isInArray(int elem,
int[] array)
Returns true or false depending on whether or not the specified string is in the array. |
static boolean |
isValidURL(java.lang.String s)
Returns whether or not the parameter is a valid URL |
static java.lang.String |
replace(java.lang.String host,
java.lang.String oldchar,
java.lang.String newchar)
Given a string, replace all occurances of one string with another. |
static void |
saveStringToFile(java.lang.String toSave,
java.lang.String fn)
Save the specifed string to the given file name |
static void |
toFrontHack(javax.swing.JFrame theParent,
javax.swing.JFrame theFrame)
Moves a frame in front of another frame |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BasicUtils()
| Method Detail |
|---|
public static java.lang.String getFileAsString(java.lang.String fn)
throws java.io.IOException,
java.io.FileNotFoundException
fn - Fully qualified file name to a file on the local disk
java.io.IOException - if there are problems opening or reading from the file
java.io.FileNotFoundException - if the file cannot be found
public static java.lang.String getURLAsString(java.net.URL theURL)
throws java.io.IOException
theURL - URL the URL to read from
java.io.IOExceptionpublic static java.net.URL encode(java.net.URL theURL)
theURL - URL the url to encode
public static java.lang.String getStringFromBufferedReader(java.io.BufferedReader aReader)
throws java.io.IOException
aReader - BufferedReader the reader to read from
java.io.IOException
public static void saveStringToFile(java.lang.String toSave,
java.lang.String fn)
throws java.io.IOException,
java.io.FileNotFoundException
toSave - String the string to savefn - String the file to save the string to
java.io.IOException
java.io.FileNotFoundExceptionpublic static java.lang.String getRandomString()
public static java.lang.String getRandomString(int numChars)
numChars - the number of characters long the random string should be
public static boolean isValidURL(java.lang.String s)
s - String - the url to test
public static boolean isFileURL(java.lang.String s)
s - String the url
public static boolean isInArray(int elem,
int[] array)
elem - int to search forarray - int array to search through
public static java.lang.String convertStringToUnicodeString(java.lang.String s)
throws java.lang.Exception
s - Java String to convert to unicode
java.lang.Exceptionpublic static java.lang.String hexEntityStringConvert(java.lang.String theString)
theString - String the string to conver
public static void toFrontHack(javax.swing.JFrame theParent,
javax.swing.JFrame theFrame)
theParent - JFrame the parent, or reference frametheFrame - JFrame the frame to move in front
public static void centerFrame(java.awt.Window theParent,
java.awt.Window theFrame)
theParent - Window the reference (parent) frame, or null to center on the entire screentheFrame - Window the window to center
public static boolean containsAny(java.util.Set theList,
java.util.Set toSearch)
theList - Set the elements to look fortoSearch - Set the search set
public static java.util.Set collectElements(java.util.Iterator theIter)
theIter - Iterator
public static java.awt.Image getTranslucentVersionOf(java.awt.Image img)
img - Image to fade
public static java.lang.String replace(java.lang.String host,
java.lang.String oldchar,
java.lang.String newchar)
host - parent stringoldchar - String to removenewchar - String to insert in the place of oldchar in the String host
public static java.lang.String convertStreamToString(java.io.InputStream is)
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||