public class Utilities
extends java.lang.Object
| Modifier and Type | Method | Description |
|---|---|---|
static java.lang.String |
deleteChar(java.lang.String fromString,
char charToDelete) |
Removes all instances of the specified character from the given String.
|
static void |
dump(java.io.PrintWriter pw,
int padding,
java.lang.String string) |
Dumps padded text.
|
static boolean |
getBoolean(java.lang.String name) |
Gets a boolean property by name.
|
static java.io.InputStream |
getInputStream(java.net.URL url) |
Returns an input stream for the given URL.
|
static java.lang.Integer |
getInteger(java.lang.String name,
int defaultValue) |
Gets an Integer property by name.
|
static java.lang.Long |
getLong(java.lang.String name,
long defaultValue) |
Gets a long property by name.
|
static java.lang.String |
getProperty(java.lang.String name,
java.lang.String defaultValue) |
Gets a property by name and returns its value.
|
static java.lang.String |
getString(java.io.DataInputStream dis) |
Inputs a string from a DataInputStream.
|
static java.lang.String |
getString(java.nio.ByteBuffer bb) |
Inputs a string from a ByteBuffer.
|
static void |
outString(java.io.DataOutputStream dos,
java.lang.String s) |
Outputs a string to the given stream.
|
static java.lang.String |
pad(int padding) |
Returns a string with the given number of
spaces.
|
static java.lang.String |
pad(java.lang.String string,
int minLength) |
Pads with spaces or truncates the given string to guarantee that it is
exactly the desired length.
|
public static java.lang.String pad(int padding)
padding - the number of spaces in the stringpublic static java.lang.String pad(java.lang.String string,
int minLength)
string - the string to be paddedminLength - the desired length of the stringpublic static java.lang.String deleteChar(java.lang.String fromString,
char charToDelete)
fromString - the String to delete characters fromcharToDelete - the character to delete from the given Stringpublic static void dump(java.io.PrintWriter pw,
int padding,
java.lang.String string)
pw - the stream to send the outputpadding - the number of spaces in the stringstring - the string to outputpublic static java.io.InputStream getInputStream(java.net.URL url)
throws java.io.IOException
url - the url to open as a streamjava.io.IOException - if there is trouble creating the streampublic static void outString(java.io.DataOutputStream dos,
java.lang.String s)
throws java.io.IOException
dos - the streams - the string to outputjava.io.IOException - if an I/O error occurspublic static java.lang.String getString(java.io.DataInputStream dis)
throws java.io.IOException
dis - the streamjava.io.IOException - if an I/O error occurspublic static java.lang.String getString(java.nio.ByteBuffer bb)
throws java.io.IOException
bb - the input byte bufferjava.io.IOException - if an I/O error occurspublic static java.lang.String getProperty(java.lang.String name,
java.lang.String defaultValue)
name - the name of the propertydefaultValue - the default value to use if the property
cannot be found.public static boolean getBoolean(java.lang.String name)
name - the name of the propertypublic static java.lang.Long getLong(java.lang.String name,
long defaultValue)
name - the name of the propertydefaultValue - the default value to use if the property
cannot be found.public static java.lang.Integer getInteger(java.lang.String name,
int defaultValue)
name - the name of the propertydefaultValue - the default value to use if the property
cannot be found.