org.eigenbase.resgen
Modifier and Type | Class and Description |
---|---|
(package private) static class |
Util.DummyPrintStream
So we know to avoid recursively calling
printStackTrace(Throwable,PrintStream) . |
(package private) static class |
Util.DummyPrintWriter
So we know to avoid recursively calling
printStackTrace(Throwable,java.io.PrintWriter) . |
Modifier and Type | Field and Description |
---|---|
(package private) static char |
fileSep |
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
(package private) static URL |
convertPathToURL(File file)
Creates a file-protocol URL for the given filename.
|
(package private) static String |
fileNameSansLocale(String fileName,
String suffix)
Given "happy/BirthdayResource_fr_FR.properties" and ".properties",
returns "happy/BirthdayResource".
|
(package private) static String |
fileNameToClassName(String fileName,
String suffix) |
(package private) static String |
fileNameToCppClassName(String fileName,
String suffix) |
(package private) static Locale |
fileNameToLocale(String fileName,
String suffix)
Given
happy/BirthdayResource_en_US.xml ,
returns the locale "en_US". |
(package private) static void |
fillText(PrintWriter pw,
String text,
String linePrefix,
String lineSuffix,
int maxTextPerLine)
Left-justify a block of text.
|
(package private) static String |
formatError(String template,
Object[] args) |
(package private) static void |
generateCommentBlock(PrintWriter pw,
String name,
String text,
String comment) |
(package private) static String |
getClassNameSansPackage(String className,
Locale locale)
Returns the class name without its package name but with a locale
extension, if applicable.
|
(package private) static ResourceDef.ResourceBundle |
load(InputStream inStream)
loads InputStream and returns set of resources
|
(package private) static ResourceDef.ResourceBundle |
load(URL url)
loads URL into Document and returns set of resources
|
(package private) static Locale |
parseLocale(String localeName)
Parses 'localeName' into a locale.
|
(package private) static void |
printStackTrace(Throwable throwable,
PrintStream s) |
(package private) static void |
printStackTrace(Throwable throwable,
PrintWriter s) |
(package private) static String |
quoteForJava(String val) |
(package private) static String |
quoteForJava(String val,
boolean nullMeansNull)
Return
val in double-quotes, suitable as a string in a
Java or JScript program. |
(package private) static String |
quoteForProperties(String val)
Returns a string quoted so that it can appear in a resource file.
|
protected static String |
removePackage(String s) |
(package private) static String |
removeSuffix(String s,
String suffix) |
(package private) static String |
replace(String s,
String find,
String replace)
Returns
s with every instance of find
converted to replace . |
(package private) static URL |
stringToUrl(String strFile) |
(package private) static Throwable[] |
toArray(Throwable err)
Converts a chain of
Throwable s into an array. |
(package private) static String |
toString(Throwable err)
Formats an error, which may have chained errors, as a string.
|
static final char fileSep
Util()
static ResourceDef.ResourceBundle load(URL url) throws IOException
IOException
static ResourceDef.ResourceBundle load(InputStream inStream) throws IOException
IOException
static void fillText(PrintWriter pw, String text, String linePrefix, String lineSuffix, int maxTextPerLine)
pw
- where to output the formatted texttext
- the text to be writtenlinePrefix
- a string to prepend to each output linelineSuffix
- a string to append to each output linemaxTextPerLine
- the maximum number of characters to place on
each line, not counting the prefix and suffix. If this is -1,
never break lines.static URL stringToUrl(String strFile) throws IOException
IOException
static URL convertPathToURL(File file)
static String formatError(String template, Object[] args)
static String replace(String s, String find, String replace)
s
with every instance of find
converted to replace
.static String quoteForJava(String val, boolean nullMeansNull)
val
in double-quotes, suitable as a string in a
Java or JScript program.val
- the valuenullMeansNull
- whether to print a null value as null
(the default), as opposed to ""
static String quoteForJava(String val)
static String quoteForProperties(String val)
static String fileNameToClassName(String fileName, String suffix)
static String fileNameToCppClassName(String fileName, String suffix)
static String removeSuffix(String s, String suffix)
static Locale fileNameToLocale(String fileName, String suffix)
happy/BirthdayResource_en_US.xml
,
returns the locale "en_US".static Locale parseLocale(String localeName)
static String fileNameSansLocale(String fileName, String suffix)
static String toString(Throwable err)
static void printStackTrace(Throwable throwable, PrintWriter s)
static void printStackTrace(Throwable throwable, PrintStream s)
static void generateCommentBlock(PrintWriter pw, String name, String text, String comment)
static String getClassNameSansPackage(String className, Locale locale)
happy.BirthdayResource
,
and locale is en_US
,
returns BirthdayResource_en_US
.protected static String removePackage(String s)