public final class Text
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_DATE_FORMAT_PATTERN
The default format pattern used in strftime() if no pattern
parameter has been supplied.
|
static char[] |
hexTable
used for the md5
|
static java.lang.String |
NON_VALID_CHARS
Non-valid handle characters: / \ : * ? " < > | and carriage return.
(That's slash, backslash, colon, asterisk, question mark, quotation mark, less than symbol, greater than symbol, pipe, and carriage return.) |
static java.util.TimeZone |
TIMEZONE_LOCAL
The local timezone
|
static java.util.TimeZone |
TIMEZONE_UTC
The UTC timezone
|
static java.util.BitSet |
URISave
The list of characters that are not encoded by the
escape()
and unescape() methods. |
static java.util.BitSet |
URISaveEx
Same as
URISave but also contains the '/' |
Modifier and Type | Method and Description |
---|---|
static int |
compareHandles(java.lang.String h1,
java.lang.String h2)
compares to handles lexigographically with one exception: the '/'
character is always considered smaller than all other chars.
|
static java.lang.String |
createValidLabel(java.lang.String labelhint)
Create a valid label out of an arbitrary string.
|
static java.lang.String |
dateToRfc1123String(java.util.Date date)
Returns a stringified date accoring to the date format specified in
RTF1123.
|
static java.lang.String |
digest(java.lang.String algorithm,
byte[] data)
Digest the plain string using the given algorithm.
|
static java.lang.String |
digest(java.lang.String algorithm,
java.lang.String data)
Deprecated.
|
static java.lang.String |
digest(java.lang.String algorithm,
java.lang.String data,
java.lang.String enc)
Digest the plain string using the given algorithm.
|
static java.lang.String |
escape(java.lang.String string)
Does a URL encoding of the
string . |
static java.lang.String |
escape(java.lang.String string,
char escape)
Does an URL encoding of the
string using the
escape character. |
static java.lang.String |
escape(java.lang.String string,
char escape,
boolean isPath)
Does an URL encoding of the
string using the
escape character. |
static java.lang.String |
escapePath(java.lang.String path)
Does a URL encoding of the
path . |
static java.lang.String |
escapeXml(java.lang.String string)
Escapes all character that have specific meaning in XMl/HTML, namely
'<', '>', '"', '&' by their isolating encoding aequivalents
"<", ">", """, "&"
|
static java.lang.String[] |
explode(java.lang.String str,
int ch)
returns an array of strings decomposed of the original string, split at
every occurance of 'ch'.
|
static java.lang.String[] |
explode(java.lang.String str,
int ch,
boolean respectEmpty)
returns an array of strings decomposed of the original string, split at
every occurance of 'ch'.
|
static java.lang.String |
formatISO8601(java.util.Calendar cal)
Formats a
Calendar value into an ISO8601-compliant
date/time string. |
static java.lang.String |
fullFilePath(java.lang.String parent,
java.lang.String path)
this method does the similar than the
fullPath(String, String)
but it considers the parent as parent directory rather than a base
handle. |
static java.lang.String |
fullPath(java.lang.String base,
java.lang.String path)
returns a full path.
|
static java.lang.String |
getAbsoluteParent(java.lang.String handle,
int level)
Returns the nth absolute parent of the handle, where n=level.
|
static java.lang.String |
getLabel(java.lang.String handle)
Deprecated.
use
getName(String) |
static java.lang.String |
getLabel(java.lang.String handle,
char delim)
Deprecated.
|
static java.lang.String |
getLocalName(java.lang.String qname)
Returns the local name of the given
qname . |
static java.lang.String |
getName(java.lang.String path)
Returns the name part of the path
|
static java.lang.String |
getName(java.lang.String path,
boolean ignoreTrailingSlash)
Same as
getName(String) but adding the possibility
to pass paths that end with a trailing '/' |
static java.lang.String |
getName(java.lang.String path,
char delim)
Returns the name part of the path, delimited by the given
delim |
static java.lang.String |
getNamespacePrefix(java.lang.String qname)
Returns the namespace prefix of the given
qname . |
static java.lang.String |
getRelativeParent(java.lang.String handle,
int level)
Returns the nth relative parent of the handle, where n=level.
|
static java.lang.String |
implode(java.lang.String[] arr,
java.lang.String delim)
Concatenates all strings in the string array using the specified delimiter.
|
static boolean |
isDescendant(java.lang.String handle,
java.lang.String descendant)
Determines if the
descendant handle is hierarchical a
descendant of handle . |
static boolean |
isDescendantOrEqual(java.lang.String handle,
java.lang.String descendant)
Determines if the
descendant handle is hierarchical a
descendant of handle or equal to it. |
static boolean |
isSibling(java.lang.String h1,
java.lang.String h2)
Determines, if two handles are sister-pages, that meens, if they
represent the same hierarchic level and share the same parent page.
|
static java.lang.String |
joinFixSlash(java.lang.String first,
java.lang.String second)
Deprecated.
|
static java.lang.String |
makeCanonicalPath(char[] source)
make a cannonical path.
|
static java.lang.String |
makeCanonicalPath(java.lang.String path)
Make a path canonical.
|
static java.lang.String |
makeCanonicalPath(java.lang.StringBuffer source)
Deprecated.
use
makeCanonicalPath(char[]) instead |
static java.lang.String |
md5(java.lang.String data)
Deprecated.
|
static java.lang.String |
md5(java.lang.String data,
java.lang.String enc)
Calculate an MD5 hash of the string given.
|
static java.util.Date |
parseDate(java.lang.String dateString)
Parses the date string based on the format pattern which is in the
default format
dd.MM.yyyy HH:mm:ss . |
static java.util.Date |
parseDate(java.lang.String dateString,
boolean isUTC)
Parses the date string based on the format pattern which is in the
default format
dd.MM.yyyy HH:mm:ss . |
static java.util.Date |
parseDate(java.lang.String dateString,
java.lang.String formatPattern)
Parses the date string based on the format pattern which is in the
format used by the Java platfrom SimpleDateFormat class.
|
static java.util.Date |
parseDate(java.lang.String dateString,
java.lang.String formatPattern,
boolean isUTC)
Parses the date string based on the format pattern which is in the
format used by the Java platfrom SimpleDateFormat class.
|
static java.util.Calendar |
parseISO8601(java.lang.String text)
Parses an ISO8601-compliant date/time string.
|
static java.lang.String |
replace(java.lang.String text,
java.lang.String oldString,
java.lang.String newString)
Replaces all occurences of
oldString in text
with newString . |
static java.lang.String |
replaceVariables(java.util.Properties variables,
java.lang.String value,
boolean ignoreMissing)
Performs variable replacement on the given string value.
|
static java.lang.String[] |
split(java.lang.String str,
int ch)
Deprecated.
|
static java.lang.String[] |
split(java.lang.String str,
int ch,
boolean respectEmpty)
Deprecated.
|
static java.lang.String |
sprintf(java.lang.String format,
java.lang.Object a0)
Formats a string according to format and argument.
|
static java.lang.String |
sprintf(java.lang.String format,
java.lang.Object[] args)
This method implements the famous and ubiquituous
sprintf
formatter in Java. |
static java.lang.String |
sprintf(java.lang.String format,
java.lang.Object a0,
java.lang.Object a1)
Formats a string according to format and argument.
|
static java.lang.String |
sprintf(java.lang.String format,
java.lang.Object a0,
java.lang.Object a1,
java.lang.Object a2)
Formats a string according to format and argument.
|
static java.lang.String |
sprintf(java.lang.String format,
java.lang.Object a0,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3)
Formats a string according to format and argument.
|
static java.lang.String |
sprintf(java.lang.String format,
java.lang.Object a0,
java.lang.Object a1,
java.lang.Object a2,
java.lang.Object a3,
java.lang.Object a4)
Formats a string according to format and argument.
|
static java.lang.String |
strftime(java.util.Date date)
Implements a date formatting routine supporting (a subset) of the POSIX
strftime() function. |
static java.lang.String |
strftime(java.util.Date date,
boolean asUTC)
Implements a date formatting routine supporting (a subset) of the POSIX
strftime() function. |
static java.lang.String |
strftime(java.util.Date date,
java.lang.String formatPattern,
boolean asUTC)
Implements a date formatting routine supporting (a subset) of the POSIX
strftime() function. |
static java.lang.String |
strftime(java.util.Date date,
java.lang.String formatPattern,
java.util.TimeZone zone)
Implements a date formatting routine supporting (a subset) of the POSIX
strftime() function. |
static java.lang.String |
unescape(java.lang.String string)
Does a URL decoding of the
string . |
static java.lang.String |
unescape(java.lang.String string,
char escape)
Does a URL decoding of the
string using the
escape character. |
static void |
validateLabel(java.lang.String labelhint)
Checks if the label is not empty and contains all valid label chars.
|
public static final java.lang.String DEFAULT_DATE_FORMAT_PATTERN
public static final java.util.TimeZone TIMEZONE_UTC
public static final java.util.TimeZone TIMEZONE_LOCAL
public static final char[] hexTable
public static java.util.BitSet URISave
escape()
and unescape()
methods. They contains the characters as
defined 'unreserved' in section 2.3 of the RFC 2396 'URI genric syntax':
unreserved = alphanum | mark mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"
public static java.util.BitSet URISaveEx
URISave
but also contains the '/'public static final java.lang.String NON_VALID_CHARS
public static java.lang.String[] split(java.lang.String str, int ch)
explode(String, int)
str
- the string to decomposech
- the character to use a split patternpublic static java.lang.String[] split(java.lang.String str, int ch, boolean respectEmpty)
explode(String, int, boolean)
str
- the string to decomposech
- the character to use a split patternrespectEmpty
- if true
, empty elements are generatedpublic static java.lang.String[] explode(java.lang.String str, int ch)
str
- the string to decomposech
- the character to use a split patternpublic static java.lang.String[] explode(java.lang.String str, int ch, boolean respectEmpty)
str
- the string to decomposech
- the character to use a split patternrespectEmpty
- if true
, empty elements are generatedpublic static java.lang.String implode(java.lang.String[] arr, java.lang.String delim)
arr
- delim
- public static java.lang.String replace(java.lang.String text, java.lang.String oldString, java.lang.String newString)
oldString
in text
with newString
.text
- oldString
- old substring to be replaced with newString
newString
- new substring to replace occurences of oldString
public static java.lang.String getName(java.lang.String path)
path
- the pathpublic static java.lang.String getName(java.lang.String path, char delim)
delim
path
- the pathdelim
- the delimiterpublic static java.lang.String getName(java.lang.String path, boolean ignoreTrailingSlash)
getName(String)
but adding the possibility
to pass paths that end with a trailing '/'path
- the pathignoreTrailingSlash
- if true
a trailing slash is ignoredgetName(String)
public static java.lang.String getNamespacePrefix(java.lang.String qname)
qname
. If the
prefix is missing, an empty string is returned. Please note, that this
method does not validate the name or prefix.
the qname has the format: qname := [prefix ':'] local;qname
- a qualified namejava.lang.NullPointerException
- if qname
is null
getLocalName(String)
public static java.lang.String getLocalName(java.lang.String qname)
qname
. Please note, that
this method does not validate the name.
the qname has the format: qname := [prefix ':'] local;qname
- a qualified namejava.lang.NullPointerException
- if qname
is null
getNamespacePrefix(String)
public static int compareHandles(java.lang.String h1, java.lang.String h2)
h1
- the first handleh2
- the second handlepublic static java.lang.String fullFilePath(java.lang.String parent, java.lang.String path)
fullPath(String, String)
but it considers the parent as parent directory rather than a base
handle. if further respects full qualified uri's.
parent
- the base handlepath
- the pathpublic static java.lang.String fullPath(java.lang.String base, java.lang.String path)
base | path | result ----------+----------+------------ "" | "" | / /foo | "" | /foo "" | /foo | /foo "." | foo | foo /foo/bar | bla | /foo/bla /foo/bar | /bla | /bla /foo/bar | ../bla | /bla /foo/bar | ./bla | /foo/bla foo | bar | bar
base
- the base handlepath
- the pathpublic static java.lang.String makeCanonicalPath(java.lang.String path)
Text.makeCanonicalPath(new StringBuffer(path));
path
- path to make canonicalpublic static java.lang.String makeCanonicalPath(java.lang.StringBuffer source)
makeCanonicalPath(char[])
insteadsource
- the input sourcepublic static java.lang.String makeCanonicalPath(char[] source)
source
- the input sourcepublic static boolean isSibling(java.lang.String h1, java.lang.String h2)
h1
- first handleh2
- second handlepublic static boolean isDescendant(java.lang.String handle, java.lang.String descendant)
descendant
handle is hierarchical a
descendant of handle
.
handle
- the current handledescendant
- the potential descendanttrue
if the descendant
is a descendant;
false
otherwise.public static boolean isDescendantOrEqual(java.lang.String handle, java.lang.String descendant)
descendant
handle is hierarchical a
descendant of handle
or equal to it.
handle
- the current handledescendant
- the potential descendanttrue
if the descendant
is a descendant
or equal; false
otherwise.public static java.lang.String getLabel(java.lang.String handle)
getName(String)
handle
- the handlepublic static java.lang.String getLabel(java.lang.String handle, char delim)
getName(String, char)
handle
- the stringdelim
- the delimiterpublic static java.lang.String md5(java.lang.String data, java.lang.String enc) throws java.io.UnsupportedEncodingException
data
- the data to encodeenc
- the character encoding to usejava.io.UnsupportedEncodingException
- if the given encoding is not supportedpublic static java.lang.String md5(java.lang.String data)
md5(String, String)
data
- the data to encodepublic static java.lang.String digest(java.lang.String algorithm, java.lang.String data, java.lang.String enc) throws java.security.NoSuchAlgorithmException, java.io.UnsupportedEncodingException
algorithm
- The alogrithm for the digest. This algorithm must be
supported by the MessageDigest class.data
- The plain text String to be digested.enc
- The character encoding to usejava.security.NoSuchAlgorithmException
- if the desired algorithm is not supported by
the MessageDigest class.java.io.UnsupportedEncodingException
- if the encoding is not supportedpublic static java.lang.String digest(java.lang.String algorithm, java.lang.String data) throws java.security.NoSuchAlgorithmException
digest(String, String, String)
algorithm
- The alogrithm for the digest. This algorithm must be
supported by the MessageDigest class.data
- The plain text String to be digested.java.security.NoSuchAlgorithmException
- if the desired algorithm is not supported by
the MessageDigest class.public static java.lang.String digest(java.lang.String algorithm, byte[] data) throws java.security.NoSuchAlgorithmException
algorithm
- The alogrithm for the digest. This algorithm must be
supported by the MessageDigest class.data
- the data to digest with the given algorithmjava.security.NoSuchAlgorithmException
- if the desired algorithm is not supported by
the MessageDigest class.public static java.lang.String getRelativeParent(java.lang.String handle, int level)
Example:
Text.getRelativeParent("/en/home/index/about", 1) == "/en/home/index"
handle
- the handle of the pagelevel
- the level of the parentpublic static java.lang.String getAbsoluteParent(java.lang.String handle, int level)
Example:
Text.getAbsoluteParent("/en/home/index/about", 1) == "/en/home"
handle
- the handle of the pagelevel
- the level of the parentpublic static java.lang.String escape(java.lang.String string, char escape)
string
using the
escape
character. The characters that don't need encoding
are those defined 'unreserved' in section 2.3 of the 'URI genric syntax'
RFC 2396, but without the escape character.string
- the string to encode.escape
- the escape character.java.lang.NullPointerException
- if string
is null
.public static java.lang.String escape(java.lang.String string, char escape, boolean isPath)
string
using the
escape
character. The characters that don't need encoding
are those defined 'unreserved' in section 2.3 of the 'URI genric syntax'
RFC 2396, but without the escape character. If isPath
is
true
, additionally the slash '/' is ignored, too.string
- the string to encode.escape
- the escape character.isPath
- if true
, the string is treated as pathjava.lang.NullPointerException
- if string
is null
.public static java.lang.String escapeXml(java.lang.String string)
string
- the string to escapenull
if the input string was
null
public static java.lang.String escape(java.lang.String string)
string
. The characters that
don't need encoding are those defined 'unreserved' in section 2.3 of
the 'URI genric syntax' RFC 2396.string
- the string to encodejava.lang.NullPointerException
- if string
is null
.public static java.lang.String escapePath(java.lang.String path)
path
. The characters that
don't need encoding are those defined 'unreserved' in section 2.3 of
the 'URI genric syntax' RFC 2396. In contrast to the
escape(String)
method, not the entire path string is escaped,
but every individual part (i.e. the slashes are not escaped).path
- the path to encodejava.lang.NullPointerException
- if path
is null
.public static java.lang.String unescape(java.lang.String string, char escape)
string
using the
escape
character. Please note that in opposite to the
URLDecoder
it does not transform the + into spaces.string
- the string to decodeescape
- the escape characterjava.lang.NullPointerException
- if string
is null
.java.lang.ArrayIndexOutOfBoundsException
- if not enough character follow an
escape characterjava.lang.IllegalArgumentException
- if the 2 characters following the escape
character do not represent a hex-number.public static java.lang.String unescape(java.lang.String string)
string
. Please note that in
opposite to the URLDecoder
it does not transform the +
into spaces.string
- the string to decodejava.lang.NullPointerException
- if string
is null
.java.lang.ArrayIndexOutOfBoundsException
- if not enough character follow an
escape characterjava.lang.IllegalArgumentException
- if the 2 characters following the escape
character do not represent a hex-number.public static java.lang.String dateToRfc1123String(java.util.Date date)
public static java.lang.String strftime(java.util.Date date, java.lang.String formatPattern, java.util.TimeZone zone)
strftime()
function.date
- The date value to be formattedformatPattern
- The pattern used to format the date. This pattern
supports a subset of the pattern characters of the POSIX
strftime()
function. If this pattern is empty or
null
the default pattern
dd.MM.yyyy HH:mm:ss
is used.zone
- Defines for which time zone the date should be outputted. If
this parameter is null
, then the local time zone is taken.public static java.lang.String strftime(java.util.Date date, java.lang.String formatPattern, boolean asUTC)
strftime()
function.date
- The date value to be formattedformatPattern
- The pattern used to format the date. This pattern
supports a subset of the pattern characters of the POSIX
strftime()
function. If this pattern is empty or
null
the default pattern
dd.MM.yyyy HH:mm:ss
is used.asUTC
- Defines whether to interpret the date as belong to the UTC
time zone or the local time zone.public static java.lang.String strftime(java.util.Date date, boolean asUTC)
strftime()
function. The default pattern
dd.MM.yyyy HH:mm:ss
is used to format the date.date
- The date value to be formattedasUTC
- Defines whether to interpret the date as belong to the UTC
time zone or the local time zone.public static java.lang.String strftime(java.util.Date date)
strftime()
function. The default pattern
dd.MM.yyyy HH:mm:ss
is used to format the date, which is
interpreted to be in the local time zone.date
- The date value to be formattedpublic static java.util.Date parseDate(java.lang.String dateString, java.lang.String formatPattern) throws java.text.ParseException
dateString
- The date string to be parsedformatPattern
- the pattern to use for parsing. If null
or empty, the same default pattern is used as with
strftime(Date, String, boolean)
, namely
dd.MM.yyyy HH:mm:ss
.java.text.ParseException
- if the date string cannot be parsed accordinung
to the format pattern.public static java.util.Date parseDate(java.lang.String dateString, java.lang.String formatPattern, boolean isUTC) throws java.text.ParseException
dateString
- The date string to be parsedformatPattern
- the pattern to use for parsing. If null
or empty, the same default pattern is used as with
strftime(Date, String, boolean)
, namely
dd.MM.yyyy HH:mm:ss
.isUTC
- if true
the date string is considered in UTC,
otherwise the default timezone of the host is used.java.text.ParseException
- if the date string cannot be parsed accordinung
to the format pattern.public static java.util.Date parseDate(java.lang.String dateString) throws java.text.ParseException
dd.MM.yyyy HH:mm:ss
.dateString
- The date string to be parsedjava.text.ParseException
- if the date string cannot be parsed accordinung
to the format pattern.public static java.util.Date parseDate(java.lang.String dateString, boolean isUTC) throws java.text.ParseException
dd.MM.yyyy HH:mm:ss
.dateString
- The date string to be parsedisUTC
- if true
the date string is considered in UTC,
otherwise the default timezone of the host is used.java.text.ParseException
- if the date string cannot be parsed accordinung
to the format pattern.public static java.lang.String sprintf(java.lang.String format, java.lang.Object[] args)
sprintf
formatter in Java. The arguments to the method are the formatting string
and the list of arguments defined by the formatting instructions
contained in the formatting string.
Each element in the argument array is either a Number
object
or any other Object
type. Whenever the formatting string
stipulates the corresponding argument to be numeric, it is assumed this
array element to be a Number
. If this is not the case an
IllegalArgumentException
is thrown. If a String
argument is stipulated by the formatting string, a simple call to the
toString()
method of the object yields the
String
required.
SPECIFICATION
sprintf
accepts a series of arguments, applies to each a
format specifier from format
, and stores the formatted data
to the result Strint
. The method throws an
IllegalArgumentException
if either the format
is incorrect, there are not enough arguments for the format
or if any of the argument's type is wrong. sprintf
returns
when it reaches the end of the format string. If there are more
arguments than the format requires, excess arguments are ignored.
format
is a String
containing two types of
objects: ordinary characters (other than %
), which
are copied unchanged to the output, and conversion specifications,
each of which is introduced by %
. (To include
%
in the output, use %%
in the format
string.) A conversion specification has the following form:
[ flags ] [ width ] [ "." prec ] [ size ]
type
The fields of the conversion specification have the following meanings:
-
),
plus (+
), space ("
"), zero (0
),
and sharp (#
). They can appear in any combination.
- |
The result of the conversion is left justified, and the right is padded with blanks. If you do not use this flag, the result is right justified, and padded on the left. |
+ |
The result of a signed conversion (as determined by type) will always begin with a plus or minus sign. (If you do not use this flag, positive values do not begin with a plus sign.) |
" " (space) |
If the first character of a signed conversion specification is
not a sign, or if a signed conversion results in no characters,
the result will begin with a space. If the space
( ) flag and the plus (+ ) flag both
appear, the space flag is ignored. |
0 |
If the type is d , i ,
o , u , x , X ,
e , E , f , g ,
or G : leading zeroes, are used to pad the field
width (following any indication of sign or base); no spaces
are used for padding. If the zero (0 ) and minus
(- ) flags both appear, the zero (0 )
flag will be ignored. For d , i ,
o , u , x , X
conversions, if a precision prec is specified, the zero
(0 ) flag is ignored.
Note that 0 is interpreted as a flag, not as the beginning of a field width. |
# |
The result is to be converted to an alternative form, according
to the type character:
0x prefix.
0X prefix.
e or E , but trailing
zeroes arenot removed.
|
*
), in which case an integral numeric argument
is used as the field width. Negative field widths are not supported; if
you attempt to specify a negative field width, it is interpreted as a
minus (i
) flag followed by a positive field width.
.
' (a period). This field gives the maximum number of
characters to print in a conversion; the minimum number of digits of an
integer to print, for conversions with type d
,
i
, o
, u
, x
, and
X
; the maximum number of significant digits, for the
g
and G
conversions; or the number of digits
to print after the decimal point, for e
, E
,
and f
conversions. You can specify the precision either
directly as a decimal integer or indirectly by using an asterisk
(*
), in which case an integral numeric argument is used as
the precision. Supplying a negative precision is equivalent to
omitting the precision. If only a period is specified the precision
is zero. If a precision appears with any other conversion type
than those listed here, the behavior is undefined.
h
, l
, and L
are optional size
characters which override the default way that sprintf
interprets the data type of the corresponding argument.
h
forces the following d
, i
,
o
, u
, x
, or X
conversion type to apply to a short
or unsigned
short
. Similarily, an l
forces the following
d
, i
, o
, u
,
x
, or X
conversion type to apply to
a long
or unsigned long
. If an h
or an l
appears with another conversion specifier, the
behavior is undefined. L
forces a following
e
, E
, f
, g
, or
G
conversion type to apply to a long
double
argument. If L
appears with any other
conversion type, the behavior is undefined.
sprintf
performs. Here is a table of these:
%
%
)
c
String
of which only the first
character is printed.
s
String
ends; takes any Object
whose
toString()
method is called to get the
String
to print.
d
Number
(same
as i
)
d
Number
(same
as d
)
d
Number
u
Number
.
This conversion is not supported correctly by the Java
implementation and is really the same as i
.
x
Number
X
Number
f
Number
e
Number
E
e
, but using E to
introduce the exponent; takes a Number
g
f
or e
form, based on given value and precision &emdash; trailing zeros
and the decimal point are printed only if necessary; takes a
Number
G
g
, but using E
for the exponent if an exponent is needed; takes a
Number
n
IllegalArgumentException
if used.
p
IllegalArgumentException
if used.
IMPLEMENTATION NOTES
Due to the nature of the Java programming language, neither pointer
conversions, nor unsigned
and long double
conversions are supported.
Also the Java implementation only distinguishes between
Number
and other Object
arguments. If a
numeric argument is expected as per the format
String
, the current argument must be a Number
object that is converted to a basic type as expected. If a
String
or char
argument is expected, any
Object is valid, whose toString()
method is used to convert
to a String
.
format
- The format string as known from the POSIX sprintf()
C function.args
- The list of arguments to accomodate the format string. This
argument list is supposed to contain at least as much entries as
there are formatting options in the format string. If for a
numeric option, the entry is not a number an
IllegalArgumentException
is thrown.String
. An empty String
is only returned if the format
String
is empty. A null
value is never returned.java.lang.NullPointerException
- if the formatting string or any of the
argument values is null
.java.lang.IllegalArgumentException
- if the formatting string has wrong
format tags, if the formatting string has an incomplete
formatting pattern at the end of the string, if the argument
vector has not enough values to satisfy the formatting string
or if an argument's type does not match the requirements of the
format string.public static java.lang.String sprintf(java.lang.String format, java.lang.Object a0)
sprintf(String, Object[])
for details.format
- The format stringa0
- The single parametersprintf(format, new Object[]{ a0 })
.java.lang.IllegalArgumentException
- from sprintf(String, Object[])
.public static java.lang.String sprintf(java.lang.String format, java.lang.Object a0, java.lang.Object a1)
sprintf(String, Object[])
for details.format
- The format stringa0
- The first parametera1
- The second parametersprintf(format, new Object[]{ ... })
.java.lang.IllegalArgumentException
- from sprintf(String, Object[])
.public static java.lang.String sprintf(java.lang.String format, java.lang.Object a0, java.lang.Object a1, java.lang.Object a2)
sprintf(String, Object[])
for details.format
- The format stringa0
- The first parametera1
- The second parametera2
- The thrid parametersprintf(format, new Object[]{ ... })
.java.lang.IllegalArgumentException
- from sprintf(String, Object[])
.public static java.lang.String sprintf(java.lang.String format, java.lang.Object a0, java.lang.Object a1, java.lang.Object a2, java.lang.Object a3)
sprintf(String, Object[])
for details.format
- The format stringa0
- The first parametera1
- The second parametera2
- The thrid parametera3
- The fourth parametersprintf(format, new Object[]{ ... })
.java.lang.IllegalArgumentException
- from sprintf(String, Object[])
.public static java.lang.String sprintf(java.lang.String format, java.lang.Object a0, java.lang.Object a1, java.lang.Object a2, java.lang.Object a3, java.lang.Object a4)
sprintf(String, Object[])
for details.format
- The format stringa0
- The first parametera1
- The second parametera2
- The thrid parametera3
- The fourth parametera4
- The fifth parametersprintf(format, new Object[]{ ... })
.java.lang.IllegalArgumentException
- from sprintf(String, Object[])
.public static java.lang.String createValidLabel(java.lang.String labelhint)
labelhint
- the given label string that we will examine
and convert any illegal character if necessarypublic static void validateLabel(java.lang.String labelhint)
labelhint
- the labelhint to checkjava.lang.IllegalArgumentException
- if the label does not contain all valid
chars.public static java.lang.String joinFixSlash(java.lang.String first, java.lang.String second)
makeCanonicalPath(String)
public static java.lang.String replaceVariables(java.util.Properties variables, java.lang.String value, boolean ignoreMissing) throws java.lang.IllegalArgumentException
${...}
sequence within the given value is replaced
with the value of the named parser variable. If a variable is not found
in the properties an IllegalArgumentException is thrown unless
ignoreMissing
is true
. In the later case, the
missing variable is replaced by the empty string.value
- the original valueignoreMissing
- if true
, missing variables are replaced
by the empty string.java.lang.IllegalArgumentException
- if the replacement of a referenced
variable is not foundpublic static java.util.Calendar parseISO8601(java.lang.String text)
±YYYY-MM-DDThh:mm:ss.SSSTZDwhere:
±YYYY = four-digit year with optional sign where values <= 0 are denoting years BCE and values > 0 are denoting years CE, e.g. -0001 denotes the year 2 BCE, 0000 denotes the year 1 BCE, 0001 denotes the year 1 CE, and so on... MM = two-digit month (01=January, etc.) DD = two-digit day of month (01 through 31) hh = two digits of hour (00 through 23) (am/pm NOT allowed) mm = two digits of minute (00 through 59) ss = two digits of second (00 through 59) SSS = three digits of milliseconds (000 through 999) TZD = time zone designator, Z for Zulu (i.e. UTC) or an offset from UTC in the form of +hh:mm or -hh:mm
text
- the date/time string to be parsedCalendar
, or null
if the input could
not be parsedjava.lang.IllegalArgumentException
- if a null
argument is passedpublic static java.lang.String formatISO8601(java.util.Calendar cal)
Calendar
value into an ISO8601-compliant
date/time string.cal
- the time value to be formatted into a date/time string.java.lang.IllegalArgumentException
- if a null
argument is passed"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"