|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.tuberlin.cs.flp.jspwiki.util.WikiToolbox
Collection of tool functions used by package de.tuberlin.cs.flp.jspwiki.*.
Constructor Summary | |
WikiToolbox()
|
Method Summary | |
static java.lang.String |
capitalize(java.lang.String s)
Sets the first charcater in s to upper case. |
static int[] |
determineImageSize(java.io.InputStream in)
|
static java.lang.String |
escape(java.lang.String s,
char c)
Escapes all occurrences of c in s by a backslash. |
static Attachment |
findImageAttachment(WikiEngine engine,
java.lang.String pagename)
Returns first image-attachment, or null if no attachment is an image or no attachments at all exist. |
static Attachment |
findImageAttachment(WikiEngine engine,
java.lang.String pagename,
java.util.Collection attachments)
Returns first image-attachment, or null if no attachment is an image or no attachments at all exist. |
static java.lang.String |
format(java.util.Map m,
java.lang.String f)
Entries starting with % will be replaced by values in map. |
static java.lang.String |
getProperty(WikiEngine engine,
java.lang.String propertyName,
java.lang.String defaultPagename)
|
static boolean |
isImage(WikiEngine engine,
java.lang.String name)
|
static java.lang.String |
keyByValue(java.util.Properties p,
java.lang.String v)
Gets the key of a property entry by the given value. |
static java.lang.String |
makePagename(WikiEngine engine,
java.lang.String s)
Creates a valid wiki page name from s. |
static java.lang.String |
normalizeLF(java.lang.String s)
Makes sure only '\n' is used as linebreak, not '\r\n'. |
static java.lang.String |
normalizeName(java.lang.String name)
Makes sure that an entry's name can be used as a filename. |
static boolean |
parseBoolean(java.lang.String s)
|
static boolean |
parseBoolean(java.lang.String s,
boolean deflt)
|
static java.util.Collection |
parseList(java.lang.String s)
Parses a comma-seperated list of strings. |
static java.util.Collection |
parseMultiParameter(HttpServletRequest request,
java.lang.String name)
|
static java.util.Properties |
parseProperties(java.lang.String s,
java.lang.String entryDelim)
|
static java.util.Collection |
parseWikiLinks(java.lang.String pagedata)
Parses Wiki-markup and returns a collection of all links included in the page. |
static java.util.Collection |
parseWikiLinks(WikiEngine engine,
java.lang.String pagename)
Returns all Wiki-link targets included in a page. |
static byte[] |
readInputStream(java.io.InputStream in)
|
static java.lang.String |
repeat(int cnt,
char c)
Creates a string in which c is repeated cnt times. |
static java.lang.String |
replace(java.lang.String s,
java.lang.String search,
java.lang.String repl)
|
static java.util.Collection |
split(java.lang.String s)
Split at commas (','). |
static java.util.Collection |
split(java.lang.String s,
char c)
Splits a string at the specified character occurrences. |
static java.util.Collection |
split(java.lang.String s,
java.lang.String delim)
Splits a string at the specified substring occurrences. |
static java.util.List |
splitCamelCase(java.lang.String s)
|
static java.util.Collection |
splitLines(java.lang.String s)
Split at line-feed ('\n'). |
static java.util.Map |
subMap(java.util.Map map,
java.lang.String prefix)
|
static java.lang.String |
toCamelCase(java.lang.String s)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public WikiToolbox()
Method Detail |
public static java.util.Collection split(java.lang.String s, char c)
s
- The string to be split.c
- The character at the occurrences of which the splitting is performed.
c
.
Contains a single element (whole s
) if c
is not contained in s
.public static java.util.Collection split(java.lang.String s, java.lang.String delim)
s
- The string to be split.delim
- The substring at the occurrences of which the splitting is performed.
c
.
Contains a single element (whole s
) if c
is not contained in s
.public static java.util.Collection split(java.lang.String s)
s
-
public static java.util.Collection splitLines(java.lang.String s)
s
-
public static java.lang.String capitalize(java.lang.String s)
s
to upper case.
s
- The string to be capitalized.
public static java.lang.String repeat(int cnt, char c)
c
is repeated cnt
times.
cnt
- Number of repetitions.c
- The characater to be repeated.
public static java.lang.String escape(java.lang.String s, char c)
c
in s
by a backslash.
s
- The string to be escaped.c
- The character to be escaped.
public static java.lang.String replace(java.lang.String s, java.lang.String search, java.lang.String repl)
s
- search
- repl
-
public static java.util.Map subMap(java.util.Map map, java.lang.String prefix)
map
- prefix
-
public static java.lang.String keyByValue(java.util.Properties p, java.lang.String v)
p
- The properties.v
- The value string.
public static byte[] readInputStream(java.io.InputStream in) throws java.io.IOException
in
-
java.io.IOException
public static java.lang.String makePagename(WikiEngine engine, java.lang.String s)
engine
- s
-
public static java.util.List splitCamelCase(java.lang.String s)
s
-
public static java.lang.String toCamelCase(java.lang.String s)
s
-
public static java.util.Collection parseWikiLinks(java.lang.String pagedata)
pagedata
- The page text.
public static java.util.Collection parseWikiLinks(WikiEngine engine, java.lang.String pagename)
engine
- The WikiEnginepagename
- name of the page to retrieve links from.
public static java.util.Collection parseList(java.lang.String s)
s
- comma-seperated list of string
public static boolean parseBoolean(java.lang.String s)
s
-
public static boolean parseBoolean(java.lang.String s, boolean deflt)
s
- deflt
-
public static java.util.Collection parseMultiParameter(HttpServletRequest request, java.lang.String name)
request
- name
-
public static java.lang.String getProperty(WikiEngine engine, java.lang.String propertyName, java.lang.String defaultPagename)
engine
- propertyName
- defaultPagename
-
public static java.lang.String normalizeName(java.lang.String name)
name
- The entry name.
public static java.lang.String normalizeLF(java.lang.String s)
s
-
public static java.lang.String format(java.util.Map m, java.lang.String f)
m
- The map.f
- Template string including %xxx-substrings that will be replaced by map values.
public static java.util.Properties parseProperties(java.lang.String s, java.lang.String entryDelim)
s
- entryDelim
-
public static Attachment findImageAttachment(WikiEngine engine, java.lang.String pagename)
engine
- pagename
-
public static Attachment findImageAttachment(WikiEngine engine, java.lang.String pagename, java.util.Collection attachments)
engine
- pagename
- attachments
-
public static int[] determineImageSize(java.io.InputStream in)
in
-
public static boolean isImage(WikiEngine engine, java.lang.String name)
engine
- name
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |