public class IlvUtil extends Object
Modifier and Type | Method and Description |
---|---|
static String |
AbbreviatePathName(String pathname,
IlvApplication application,
int maxCharacterCount,
boolean atLeastFilename)
Abbreviates a file name string to a string containing a specified number
of characters.
|
static Object[] |
AddToArray(Object[] src,
Object object)
Adds the
object in the src array. |
static Object[] |
AddToArray(Object[] src,
Object object,
int index)
Adds the
object in the src array at the
specified index . |
static Object[] |
CopyArray(Object[] src)
Makes a copy of the specified array of objects.
|
static Color |
DecodeColor(String s)
Decodes the specified string to a color.
|
static Font |
DecodeFont(String s)
Decodes the specified string to a font.
|
static String |
EncodeColor(Color color)
Encodes the specified color.
|
static String |
EncodeFont(Font font)
Encodes the specified font.
|
static String |
GetFileExtension(String filename)
Returns the extension of the specified file name.
|
static String |
GetFileName(String pathname)
Returns the file name of the specified pathname.
|
static String |
GetFileName(URL url)
Returns the file name of the specified file URL.
|
static String |
GetRelativePath(String p1,
String p2)
Calculates the relative path expression that defines the specified
pathname
p1 relative to the specified
p2 directory path. |
static int |
IndexOf(Object[] src,
Object object)
Gets the index of the specified
object in the
src array of objects. |
static boolean |
IsWhitespace(String s)
Determines whether the specified string is composed of white characters.
|
static Object[] |
RemoveFromArray(Object[] src,
int index)
Removes the object at the
index in the src
array. |
static Object[] |
RemoveFromArray(Object[] src,
Object object)
Removes the
object from the src array. |
static Object[] |
SetElementAt(Object[] src,
Object object,
int index)
Sets the
object at the specified index in the
src array of objects. |
public static Object[] AddToArray(Object[] src, Object object, int index)
object
in the src
array at the
specified index
.src
array
plus the specified object.public static Object[] AddToArray(Object[] src, Object object)
object
in the src
array.src
array
plus the specified object.public static Object[] RemoveFromArray(Object[] src, int index)
index
in the src
array.src
- The array of objects to remove an object from.index
- The index of the object to remove.src
array without the object at the specified index.public static Object[] RemoveFromArray(Object[] src, Object object)
object
from the src
array.src
- The array of objects to remove the object
from.object
- The object to remove.src
array without the object
. If the specified object was not
contained in the src
array, the src
is returned.public static int IndexOf(Object[] src, Object object)
object
in the
src
array of objects.src
array
of objects; -1
if this object is not contained in the array.public static Object[] SetElementAt(Object[] src, Object object, int index)
object
at the specified index
in the
src
array of objects.src
- The array of objects to set an element to or null
.object
- The object to set.index
- The index to set the object at.src
array of objects, if the specified
index is lower than the length of this array. Otherwise, a new array of
objects is created and returned. This new array has a length equal to
index + 1
. The first src.length
objects are the
objects specified in the src
array. The objects
at the index from src.length
to index - 1
are null
and the object at the index
is the
specified object
.public static Object[] CopyArray(Object[] src)
src
- The array of objects to copy.public static String AbbreviatePathName(String pathname, IlvApplication application, int maxCharacterCount, boolean atLeastFilename)
For example, the string subdir1/subdir2/subdir3/file.txt
will
be abbreviated to the strings:
maxCharacterCount
is equal to
20
.maxCharacterCount
is equal to
6
but atLeastFilename
is true
pathname
- The pathname to truncate.application
- The application to get the abbreviation format from.
If it is null
, the abbreviation format will be ...{0}
.maxCharacterCount
- The maximum number of characters allowed for
the abbreviated string. If atLeastFilename
is true
,
the resulting string can exceed the maxCharacterCount
value.atLeastFilename
- If true
, the resulting string
can exceed the maximum number of characters allowed to contain the
file name of the specified pathname. Otherwise, the returned string
never exceeds the maximum number of characters allowed.public static String GetFileName(String pathname)
pathname
- A file name (no URL protocol, no URI escaping).public static String GetRelativePath(String p1, String p2)
p1
relative to the specified
p2
directory path.p1
- The pathname to return a relative path from
(no URL protocol, no URI escaping).p2
- The directory path that the returned relative path is based on
(no URL protocol, no URI escaping).public static String GetFileName(URL url)
url
- The URL to get the file name from.public static String GetFileExtension(String filename)
filename
- The file name to retrieve the extension from.public static boolean IsWhitespace(String s)
Character.isWhitespace()
returns true
for this character.s
- The string to test.true
if the specified string is composed of
white characters; false
otherwise.public static String EncodeColor(Color color)
color
- The color to get a string representation from.DecodeColor(java.lang.String)
public static Color DecodeColor(String s)
s
- The string to decode.null
,
if the specified string does not contain a color representation.EncodeColor(java.awt.Color)
public static String EncodeFont(Font font)
font
- The font to encode.DecodeFont(java.lang.String)
public static Font DecodeFont(String s)
s
- The string to decode.null
if the specified string does not contain a font representation.EncodeFont(java.awt.Font)
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.