|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinfo.bliki.wiki.filter.Encoder
public class Encoder
Some helper methods for encoding strings to HTML, URL or local files system names
Constructor Summary | |
---|---|
Encoder()
|
Method Summary | |
---|---|
static java.lang.String |
encodeDotUrl(java.lang.String s)
Encode a string to the "x-www-form-urlencoded" form, enhanced with the UTF-8-in-URL proposal. |
static java.lang.String |
encodeHtml(java.lang.String text)
|
static void |
encodeHtml(java.lang.String text,
java.lang.StringBuilder buffer)
copy the text in the resulting buffer and escape special html characters (< > " ( " ) & ') |
static java.lang.String |
encodeTitleDotUrl(java.lang.String wikiTitle,
boolean firstCharacterAsUpperCase)
|
static java.lang.String |
encodeTitleLocalUrl(java.lang.String wikiTitle)
Encode name for local file system |
static java.lang.String |
encodeTitleToUrl(java.lang.String wikiTitle,
boolean firstCharacterAsUpperCase)
Encode the wiki links title into a URL for HTML hyperlinks (i.e. |
static java.lang.String |
encodeUrl(java.lang.String s)
Encode a string to the "x-www-form-urlencoded" form, enhanced with the UTF-8-in-URL proposal. |
static boolean |
isUrlIdentifierPart(char ch)
Determines if the specified character may be part of a url |
static boolean |
isWikiPluginIdentifierPart(char ch)
Determines if the specified character may be part of a wiki plugin identifier as other than the first character |
static boolean |
isWikiPluginIdentifierStart(char ch)
Determines if the specified character may be part the first character of a wiki plugin identifier |
static char |
toChar(java.lang.String number)
|
static java.lang.String |
toEntity(int c)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Encoder()
Method Detail |
---|
public static java.lang.String toEntity(int c)
public static char toChar(java.lang.String number)
public static java.lang.String encodeUrl(java.lang.String s)
The ASCII characters 'a' through 'z', 'A' through 'Z', and '0' through '9' remain the same.
The unreserved characters - _ . ! ~ * ' ( ) / remain the same.
The '#' character remains the same.
The space character ' ' is converted into a underscore sign '_' (not a plus sign '+'!).
All other ASCII characters are converted into the 3-character string "%xy", where xy is the two-digit hexadecimal representation of the character code
All non-ASCII characters are encoded in two steps: first to a sequence of 2 or 3 bytes, using the UTF-8 algorithm; secondly each of these bytes is encoded as ".xx".
s
- The string to be encoded
public static java.lang.String encodeDotUrl(java.lang.String s)
The ASCII characters 'a' through 'z', 'A' through 'Z', and '0' through '9' remain the same.
The unreserved characters - _ . ! ~ * ' ( ) / remain the same.
The space character ' ' is converted into a underscore sign '_' (not a plus sign '+').
All other ASCII characters are converted into the 3-character string "%xy", where xy is the two-digit hexadecimal representation of the character code
All non-ASCII characters are encoded in two steps: first to a sequence of 2 or 3 bytes, using the UTF-8 algorithm; secondly each of these bytes is encoded as ".xx".
s
- The string to be encoded
public static java.lang.String encodeTitleToUrl(java.lang.String wikiTitle, boolean firstCharacterAsUpperCase)
firstCharacterAsUpperCase
parameters must be set to true
.
wikiTitle
- the raw wiki titlefirstCharacterAsUpperCase
- if true
convert the first of the title to upper case
public static java.lang.String encodeTitleDotUrl(java.lang.String wikiTitle, boolean firstCharacterAsUpperCase)
public static java.lang.String encodeTitleLocalUrl(java.lang.String wikiTitle)
public static void encodeHtml(java.lang.String text, java.lang.StringBuilder buffer)
buffer
- add converted text into the resulting bufferpublic static java.lang.String encodeHtml(java.lang.String text)
public static boolean isUrlIdentifierPart(char ch)
public static boolean isWikiPluginIdentifierPart(char ch)
public static boolean isWikiPluginIdentifierStart(char ch)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |