Top Description Fields Constructors Methods
net.fortuna.ical4j.util

public final Class Strings

extends Object
Class Inheritance
Imports
net.fortuna.ical4j.model.PropertyCodec, org.apache.commons.codec.DecoderException, .EncoderException, java.net.URI, java.util.regex.Pattern

$Id$ [23-Apr-2004] Utility methods for working with parameters.
Author
Ben Fortuna
4.3.11 Text

   Value Name: TEXT

   Purpose This value type is used to identify values that contain human
   readable text.

   Formal Definition: The character sets supported by this revision of
   iCalendar are UTF-8 and US ASCII thereof. The applicability to other
   character sets is for future work. The value type is defined by the
   following notation.

     text       = *(TSAFE-CHAR / ":" / DQUOTE / ESCAPED-CHAR)
     ; Folded according to description above

     ESCAPED-CHAR = "\\" / "\;" / "\," / "\N" / "\n")
        ; \\ encodes \, \N or \n encodes newline
        ; \; encodes ;, \, encodes ,

     TSAFE-CHAR = %x20-21 / %x23-2B / %x2D-39 / %x3C-5B
                  %x5D-7E / NON-US-ASCII
        ; Any character except CTLs not needed by the current
        ; character set, DQUOTE, ";", ":", "\", ","

     Note: Certain other character sets may require modification of the
     above definitions, but this is beyond the scope of this document.

   Description: If the property permits, multiple "text" values are
   specified by a COMMA character (US-ASCII decimal 44) separated list
   of values.

   The language in which the text is represented can be controlled by
   the "LANGUAGE" property parameter.

   An intentional formatted text line break MUST only be included in a
   "TEXT" property value by representing the line break with the
   character sequence of BACKSLASH (US-ASCII decimal 92), followed by a
   LATIN SMALL LETTER N (US-ASCII decimal 110) or a LATIN CAPITAL LETTER
   N (US-ASCII decimal 78), that is "\n" or "\N".

   The "TEXT" property values may also contain special characters that
   are used to signify delimiters, such as a COMMA character for lists
   of values or a SEMICOLON character for structured values. In order to
   support the inclusion of these special characters in "TEXT" property
   values, they MUST be escaped with a BACKSLASH character. A BACKSLASH
   character (US-ASCII decimal 92) in a "TEXT" property value MUST be
   escaped with another BACKSLASH character. A COMMA character in a
   "TEXT" property value MUST be escaped with a BACKSLASH character
   (US-ASCII decimal 92). A SEMICOLON character in a "TEXT" property
   value MUST be escaped with a BACKSLASH character (US-ASCII decimal
   92).  However, a COLON character in a "TEXT" property value SHALL NOT
   be escaped with a BACKSLASH character.Example: A multiple line value
   of:

     Project XYZ Final Review
     Conference Room - 3B
     Come Prepared.

   would be represented as:

     Project XYZ Final Review\nConference Room - 3B\nCome Prepared.

Field Summary

Modifier and TypeField and Description
public static final String
LINE_SEPARATOR

A string used to denote the start (and end) of iCalendar content lines.

public static final Pattern
PARAM_QUOTE_PATTERN

Defines a regular expression representing all parameter strings that should be quoted.

Constructor Summary

AccessConstructor and Description
private
Strings()

Constructor made private to prevent instantiation.

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

an escaped representation of the specified string
escape
(final String
a string value to escape
aValue
)

Convenience method for escaping special characters.

public static String

Returns:

a quoted string
quote
(final Object
an object to quote
aValue
)

Convenience method for adding quotes.

public static String
quote(URI uri)

public static String

Returns:

a string representation of the specified string with escaped characters replaced with their original form
unescape
(final String
a string value to unescape
aValue
)

Convenience method for replacing escaped special characters with their original form.

public static String

Returns:

an un-quoted string
unquote
(final String
a string to remove quotes from
aValue
)

Convenience method for removing surrounding quotes from a string value.

public static String

Returns:

a string representation of the object
valueOf
(final Object
an object instance
object
)

Wraps java.lang.String.valueOf() to return an empty string where the specified object is null.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LINE_SEPARATORback to summary
public static final String LINE_SEPARATOR

A string used to denote the start (and end) of iCalendar content lines.

PARAM_QUOTE_PATTERNback to summary
public static final Pattern PARAM_QUOTE_PATTERN

Defines a regular expression representing all parameter strings that should be quoted.

Constructor Detail

Stringsback to summary
private Strings()

Constructor made private to prevent instantiation.

Method Detail

escapeback to summary
public static String escape(final String aValue)

Convenience method for escaping special characters.

Parameters
aValue:String

a string value to escape

Returns:String

an escaped representation of the specified string

quoteback to summary
public static String quote(final Object aValue)

Convenience method for adding quotes. The specified object is converted to a string representation by calling its toString() method.

Parameters
aValue:Object

an object to quote

Returns:String

a quoted string

quoteback to summary
public static String quote(URI uri)
unescapeback to summary
public static String unescape(final String aValue)

Convenience method for replacing escaped special characters with their original form.

Parameters
aValue:String

a string value to unescape

Returns:String

a string representation of the specified string with escaped characters replaced with their original form

unquoteback to summary
public static String unquote(final String aValue)

Convenience method for removing surrounding quotes from a string value.

Parameters
aValue:String

a string to remove quotes from

Returns:String

an un-quoted string

valueOfback to summary
public static String valueOf(final Object object)

Wraps java.lang.String.valueOf() to return an empty string where the specified object is null.

Parameters
object:Object

an object instance

Returns:String

a string representation of the object