public class Utilities
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM Copyright field
|
Constructor and Description |
---|
Utilities() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
decodeUrlEncoded(java.lang.String s)
This method decodes a "x-www-form-url encoded" to a String.
|
static java.lang.String |
fileToString(java.lang.String fileName)
This method reads a file and returns the content as a String
|
static void |
main(java.lang.String[] args)
main entry point of the program.
|
static java.lang.String |
replaceString(java.lang.String src,
java.lang.String key,
java.lang.String value)
This method replaces all the occurrences of
key in the String src with
value . |
public static final java.lang.String COPYRIGHT
public static java.lang.String decodeUrlEncoded(java.lang.String s)
Note: Here we are not bothered about < or >
s
- the String
to decodeString
IllegalArgumentException:
- Raised when a '#' character is not followed by a numerical string.public static java.lang.String fileToString(java.lang.String fileName) throws java.lang.Exception
fileName
- the file name of the file to read.java.lang.Exception
- Thrown when the file does not exist or
any related IOExceptionpublic static void main(java.lang.String[] args)
public static java.lang.String replaceString(java.lang.String src, java.lang.String key, java.lang.String value)
key
in the String src
with
value
.src
- the original source String.key
- the String which is to be replaced.value
- the String with which key will be replaced with.