Modifier | Constructor and Description |
---|---|
private |
Utilities()
Avoid construction.
|
Modifier and Type | Method and Description |
---|---|
static String |
deleteChar(String fromString,
char charToDelete)
Removes all instances of the specified character from the given String.
|
static void |
dump(PrintWriter pw,
int padding,
String string)
Dumps padded text.
|
static boolean |
getBoolean(String name)
Gets a boolean property by name.
|
static InputStream |
getInputStream(URL url)
Returns an input stream for the given URL.
|
static Integer |
getInteger(String name,
int defaultValue)
Gets an Integer property by name.
|
static Long |
getLong(String name,
long defaultValue)
Gets a long property by name.
|
static String |
getProperty(String name,
String defaultValue)
Gets a property by name and returns its value.
|
static String |
getString(ByteBuffer bb)
Inputs a string from a ByteBuffer.
|
static String |
getString(DataInputStream dis)
Inputs a string from a DataInputStream.
|
static void |
outString(DataOutputStream dos,
String s)
Outputs a string to the given stream.
|
static String |
pad(int padding)
Returns a string with the given number of
spaces.
|
static String |
pad(String string,
int minLength)
Pads with spaces or truncates the given string to guarantee that it is
exactly the desired length.
|
private Utilities()
public static String pad(int padding)
padding
- the number of spaces in the stringpublic static String pad(String string, int minLength)
string
- the string to be paddedminLength
- the desired length of the stringpublic static String deleteChar(String fromString, char charToDelete)
fromString
- the String to delete characters fromcharToDelete
- the character to delete from the given Stringpublic static void dump(PrintWriter pw, int padding, String string)
pw
- the stream to send the outputpadding
- the number of spaces in the stringstring
- the string to outputpublic static InputStream getInputStream(URL url) throws IOException
url
- the url to open as a streamIOException
- if there is trouble creating the streampublic static void outString(DataOutputStream dos, String s) throws IOException
dos
- the streams
- the string to outputIOException
- if an I/O error occurspublic static String getString(DataInputStream dis) throws IOException
dis
- the streamIOException
- if an I/O error occurspublic static String getString(ByteBuffer bb) throws IOException
bb
- the input byte bufferIOException
- if an I/O error occurspublic static String getProperty(String name, String defaultValue)
name
- the name of the propertydefaultValue
- the default value to use if the property
cannot be found.public static boolean getBoolean(String name)
name
- the name of the propertypublic static Long getLong(String name, long defaultValue)
name
- the name of the propertydefaultValue
- the default value to use if the property
cannot be found.public static Integer getInteger(String name, int defaultValue)
name
- the name of the propertydefaultValue
- the default value to use if the property
cannot be found.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses