public class Utilities
extends java.lang.Object
Constructor | Description |
---|---|
Utilities() |
Modifier and Type | Method | Description |
---|---|---|
static java.lang.Object[][] |
addToArray(java.lang.Object[][] original,
java.lang.Object[] item) |
Utility method to extend an array.
|
static boolean |
checkTrueOrFalse(java.util.Properties attributes,
java.lang.String key) |
Checks for a true/false value of a key in a Properties object.
|
static java.lang.String |
convertFromUtf32(int codePoint) |
Converts a UTF32 code point value to a String with the corresponding character(s).
|
static java.lang.String |
convertToHex(byte[] bytes) |
Converts an array of bytes to a String of hexadecimal values
|
static int |
convertToUtf32(char[] text,
int idx) |
Converts a unicode character in a character array to a UTF 32 code point value.
|
static int |
convertToUtf32(char highSurrogate,
char lowSurrogate) |
Returns the code point of a UTF32 character corresponding with
a high and a low surrogate value.
|
static int |
convertToUtf32(java.lang.String text,
int idx) |
Converts a unicode character in a String to a UTF32 code point value
|
static char[] |
copyOfRange(char[] original,
int from,
int to) |
Copies the specified range of the specified array into a new array.
|
static <K,V> java.util.Set<K> |
getKeySet(java.util.Hashtable<K,V> table) |
Deprecated.
|
static float |
inchesToMillimeters(float value) |
Measurement conversion from inches to millimeters.
|
static float |
inchesToPoints(float value) |
Measurement conversion from inches to points.
|
static boolean |
isSurrogateHigh(char c) |
Check if the value of a character belongs to a certain interval
that indicates it's the higher part of a surrogate pair.
|
static boolean |
isSurrogateLow(char c) |
Check if the value of a character belongs to a certain interval
that indicates it's the lower part of a surrogate pair.
|
static boolean |
isSurrogatePair(char[] text,
int idx) |
Checks if two subsequent characters in a character array are
are the higher and the lower character in a surrogate
pair (and therefore eligible for conversion to a UTF 32 character).
|
static boolean |
isSurrogatePair(java.lang.String text,
int idx) |
Checks if two subsequent characters in a String are
are the higher and the lower character in a surrogate
pair (and therefore eligible for conversion to a UTF 32 character).
|
static float |
millimetersToInches(float value) |
Measurement conversion from millimeters to inches.
|
static float |
millimetersToPoints(float value) |
Measurement conversion from millimeters to points.
|
static float |
pointsToInches(float value) |
Measurement conversion from points to inches.
|
static float |
pointsToMillimeters(float value) |
Measurement conversion from points to millimeters.
|
static java.lang.String |
readFileToString(java.io.File file) |
Reads the contents of a file to a String.
|
static java.lang.String |
readFileToString(java.lang.String path) |
Reads the contents of a file to a String.
|
static void |
skip(java.io.InputStream is,
int size) |
This method is an alternative for the
InputStream.skip()
-method that doesn't seem to work properly for big values of size
. |
static java.net.URL |
toURL(java.lang.String filename) |
This method makes a valid URL from a given filename.
|
static java.lang.String |
unEscapeURL(java.lang.String src) |
Unescapes an URL.
|
@Deprecated public static <K,V> java.util.Set<K> getKeySet(java.util.Hashtable<K,V> table)
K
- type for the keyV
- type for the valuetable
- a Hashtablepublic static java.lang.Object[][] addToArray(java.lang.Object[][] original, java.lang.Object[] item)
original
- the original array or null
item
- the item to be added to the arraypublic static boolean checkTrueOrFalse(java.util.Properties attributes, java.lang.String key)
attributes
- key
- public static java.lang.String unEscapeURL(java.lang.String src)
src
- the url to unescapepublic static java.net.URL toURL(java.lang.String filename) throws java.net.MalformedURLException
This method makes the conversion of this library from the JAVA 2 platform to a JDK1.1.x-version easier.
filename
- a given filenamejava.net.MalformedURLException
public static void skip(java.io.InputStream is, int size) throws java.io.IOException
InputStream.skip()
-method that doesn't seem to work properly for big values of size
.is
- the InputStream
size
- the number of bytes to skipjava.io.IOException
public static final float millimetersToPoints(float value)
value
- a value in millimeterspublic static final float millimetersToInches(float value)
value
- a value in millimeterspublic static final float pointsToMillimeters(float value)
value
- a value in pointspublic static final float pointsToInches(float value)
value
- a value in pointspublic static final float inchesToMillimeters(float value)
value
- a value in inchespublic static final float inchesToPoints(float value)
value
- a value in inchespublic static boolean isSurrogateHigh(char c)
c
- the characterpublic static boolean isSurrogateLow(char c)
c
- the characterpublic static boolean isSurrogatePair(java.lang.String text, int idx)
text
- the String with the high and low surrogate charactersidx
- the index of the 'high' character in the pairpublic static boolean isSurrogatePair(char[] text, int idx)
text
- the character array with the high and low surrogate charactersidx
- the index of the 'high' character in the pairpublic static int convertToUtf32(char highSurrogate, char lowSurrogate)
highSurrogate
- the high surrogate valuelowSurrogate
- the low surrogate valuepublic static int convertToUtf32(char[] text, int idx)
text
- a character array that has the unicode character(s)idx
- the index of the 'high' characterpublic static int convertToUtf32(java.lang.String text, int idx)
text
- a String that has the unicode character(s)idx
- the index of the 'high' characterpublic static java.lang.String convertFromUtf32(int codePoint)
codePoint
- a Unicode valuepublic static java.lang.String readFileToString(java.lang.String path) throws java.io.IOException
path
- the path to the filejava.io.IOException
public static java.lang.String readFileToString(java.io.File file) throws java.io.IOException
file
- a filejava.io.IOException
- if file was not found or could not be read.public static java.lang.String convertToHex(byte[] bytes)
bytes
- a byte arraypublic static char[] copyOfRange(char[] original, int from, int to)
original
- the array from which a range is to be copiedfrom
- the initial index of the range to be copied, inclusiveto
- the final index of the range to be copied, exclusive.
(This index may lie outside the array.)java.lang.ArrayIndexOutOfBoundsException
- if from < 0
or from > original.length
java.lang.IllegalArgumentException
- if from > tojava.lang.NullPointerException
- if original is nullCopyright © 1998–2018. All rights reserved.