|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.northwestern.at.utils.swing.styledtext.StyledStringUtils
public class StyledStringUtils
Styled text utilities.
This static class provides various utility methods for manipulating styled strings, including reading and writing styled strings to files.
| Constructor Summary | |
|---|---|
StyledStringUtils()
|
|
| Method Summary | |
|---|---|
static StyledString |
emboldenText(java.lang.String s)
Create bold string. |
static StyledString |
getStyledStringFromRTFTransferable(java.awt.datatransfer.Transferable transferable)
Get styled string from transferable containing RTF. |
static StyledString |
italicizeText(java.lang.String s)
Create italicized string. |
static StyledString |
makeStyledText(java.lang.String s,
int styleType)
Create styled text string. |
static StyledString |
makeStyledText(java.lang.String s,
int[][] styleTypes)
Create multiply styled text string. |
static StyledString |
readFile(java.io.File file)
Reads styled text from a file. |
static StyledString |
readFile(java.lang.String fileName)
Reads styled text from a file. |
static java.lang.String |
toHTML(StyledString styledString)
Convert string containing styled text to HTML. |
static java.lang.String |
toRTF(StyledString styledString)
Convert string containing styled text to RTF. |
static StyledString |
underlineText(java.lang.String s)
Create underline string. |
static boolean |
writeFile(java.io.File file,
StyledString styledString)
Writes styled text to a file. |
static boolean |
writeFile(java.lang.String fileName,
StyledString styledString)
Writes styled text to a file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StyledStringUtils()
| Method Detail |
|---|
public static StyledString makeStyledText(java.lang.String s,
int styleType)
s - Text to which to apply style.styleType - Type of style to apply.
The available style types are
defined in StyleRun.
public static StyledString makeStyledText(java.lang.String s,
int[][] styleTypes)
s - Text to which to apply style.styleTypes - Integer array of styles to apply.
The available style types are
defined in StyleRun.
public static StyledString emboldenText(java.lang.String s)
s - Text to embolden.
public static StyledString italicizeText(java.lang.String s)
s - Text to italicize.
public static StyledString underlineText(java.lang.String s)
s - Text to underline
public static StyledString getStyledStringFromRTFTransferable(java.awt.datatransfer.Transferable transferable)
transferable - The transferable with RTF text.
public static java.lang.String toRTF(StyledString styledString)
styledString - The styled string.
public static java.lang.String toHTML(StyledString styledString)
styledString - The styled string.
public static boolean writeFile(java.io.File file,
StyledString styledString)
file - The file to which to write the styled text.
The styled string is written as a series of
bytes to the specified file.styledString - The styled string.
The file format is a byte stream with the following consecutive entries.
| Header marker | Four bytes containing "s", "t", "x", "t". |
| Version number | Integer containing version number of Styled String file format. |
| Plain text in UTF-8 format | String containing the plain unstyled text. |
| Style Information | StyleInfo encoded as series of StyleRun
entries, preceded by the number of entries. |
public static boolean writeFile(java.lang.String fileName,
StyledString styledString)
fileName - The file to which to write the styled text.
The styled string is written as an object stream
to the specified file.
public static StyledString readFile(java.lang.String fileName)
fileName - The file to read from.
public static StyledString readFile(java.io.File file)
file - The file to read from.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||