1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
\r
5 <!-- Generated by javadoc (build 1.4.2_16) on Mon Mar 09 18:20:31 CET 2009 -->
\r
7 Utilities (FreeTTS 1.2)
\r
10 <META NAME="keywords" CONTENT="com.sun.speech.freetts.util.Utilities class">
\r
12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
\r
14 <SCRIPT type="text/javascript">
\r
15 function windowTitle()
\r
17 parent.document.title="Utilities (FreeTTS 1.2)";
\r
23 <BODY BGCOLOR="white" onload="windowTitle();">
\r
26 <!-- ========= START OF TOP NAVBAR ======= -->
\r
27 <A NAME="navbar_top"><!-- --></A>
28 <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
29 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
\r
31 <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
\r
32 <A NAME="navbar_top_firstrow"><!-- --></A>
33 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
\r
34 <TR ALIGN="center" VALIGN="top">
\r
35 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
\r
36 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
\r
37 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
\r
38 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
\r
39 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
\r
40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
\r
41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
\r
45 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
\r
51 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
\r
52 <A HREF="../../../../../com/sun/speech/freetts/util/Timer.html" title="class in com.sun.speech.freetts.util"><B>PREV CLASS</B></A>
\r
53 <A HREF="../../../../../com/sun/speech/freetts/util/WaveUtils.html" title="class in com.sun.speech.freetts.util"><B>NEXT CLASS</B></A></FONT></TD>
\r
54 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
\r
55 <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A>
\r
56 <A HREF="Utilities.html" target="_top"><B>NO FRAMES</B></A>
\r
57 <SCRIPT type="text/javascript">
\r
60 document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
\r
65 <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
\r
71 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
\r
72 SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
\r
73 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
\r
74 DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
\r
77 <A NAME="skip-navbar_top"></A>
78 <!-- ========= END OF TOP NAVBAR ========= -->
\r
81 <!-- ======== START OF CLASS DATA ======== -->
\r
84 com.sun.speech.freetts.util</FONT>
\r
86 Class Utilities</H2>
\r
89 <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by"><B>com.sun.speech.freetts.util.Utilities</B>
\r
93 <DT>public class <B>Utilities</B><DT>extends java.lang.Object</DL>
\r
96 Provides a set of generic utilities used by freetts.
\r
103 <!-- ======== NESTED CLASS SUMMARY ======== -->
\r
106 <!-- =========== FIELD SUMMARY =========== -->
\r
109 <!-- ======== CONSTRUCTOR SUMMARY ======== -->
\r
112 <!-- ========== METHOD SUMMARY =========== -->
\r
114 <A NAME="method_summary"><!-- --></A>
115 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
\r
116 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
\r
117 <TD COLSPAN=2><FONT SIZE="+2">
\r
118 <B>Method Summary</B></FONT></TD>
\r
120 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
121 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
122 <CODE>static java.lang.String</CODE></FONT></TD>
\r
123 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/util/Utilities.html#deleteChar(java.lang.String, char)">deleteChar</A></B>(java.lang.String fromString,
124 char charToDelete)</CODE>
\r
127 Removes all instances of the specified character from the given String.</TD>
\r
129 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
130 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
131 <CODE>static void</CODE></FONT></TD>
\r
132 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/util/Utilities.html#dump(java.io.PrintWriter, int, java.lang.String)">dump</A></B>(java.io.PrintWriter pw,
134 java.lang.String string)</CODE>
\r
137 Dumps padded text. </TD>
\r
139 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
140 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
141 <CODE>static boolean</CODE></FONT></TD>
\r
142 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/util/Utilities.html#getBoolean(java.lang.String)">getBoolean</A></B>(java.lang.String name)</CODE>
\r
145 Gets a boolean property by name.</TD>
\r
147 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
148 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
149 <CODE>static java.io.InputStream</CODE></FONT></TD>
\r
150 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/util/Utilities.html#getInputStream(java.net.URL)">getInputStream</A></B>(java.net.URL url)</CODE>
\r
153 Returns an input stream for the given URL. </TD>
\r
155 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
156 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
157 <CODE>static java.lang.Integer</CODE></FONT></TD>
\r
158 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/util/Utilities.html#getInteger(java.lang.String, int)">getInteger</A></B>(java.lang.String name,
159 int defaultValue)</CODE>
\r
162 Gets an Integer property by name.</TD>
\r
164 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
165 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
166 <CODE>static java.lang.Long</CODE></FONT></TD>
\r
167 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/util/Utilities.html#getLong(java.lang.String, long)">getLong</A></B>(java.lang.String name,
168 long defaultValue)</CODE>
\r
171 Gets a long property by name.</TD>
\r
173 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
174 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
175 <CODE>static java.lang.String</CODE></FONT></TD>
\r
176 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/util/Utilities.html#getProperty(java.lang.String, java.lang.String)">getProperty</A></B>(java.lang.String name,
177 java.lang.String defaultValue)</CODE>
\r
180 Gets a property by name and returns its value. </TD>
\r
182 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
183 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
184 <CODE>static java.lang.String</CODE></FONT></TD>
\r
185 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/util/Utilities.html#getString(java.nio.ByteBuffer)">getString</A></B>(java.nio.ByteBuffer bb)</CODE>
\r
188 Inputs a string from a ByteBuffer.</TD>
\r
190 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
191 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
192 <CODE>static java.lang.String</CODE></FONT></TD>
\r
193 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/util/Utilities.html#getString(java.io.DataInputStream)">getString</A></B>(java.io.DataInputStream dis)</CODE>
\r
196 Inputs a string from a DataInputStream.</TD>
\r
198 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
199 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
200 <CODE>static void</CODE></FONT></TD>
\r
201 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/util/Utilities.html#outString(java.io.DataOutputStream, java.lang.String)">outString</A></B>(java.io.DataOutputStream dos,
202 java.lang.String s)</CODE>
\r
205 Outputs a string to the given stream.</TD>
\r
207 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
208 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
209 <CODE>static java.lang.String</CODE></FONT></TD>
\r
210 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/util/Utilities.html#pad(int)">pad</A></B>(int padding)</CODE>
\r
213 Returns a string with the given number of
216 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
217 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
218 <CODE>static java.lang.String</CODE></FONT></TD>
\r
219 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/util/Utilities.html#pad(java.lang.String, int)">pad</A></B>(java.lang.String string,
220 int minLength)</CODE>
\r
223 Pads with spaces or truncates the given string to guarantee that it is
224 exactly the desired length.</TD>
\r
227 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
228 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
\r
229 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
\r
230 <TD><B>Methods inherited from class java.lang.Object</B></TD>
\r
232 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
233 <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
\r
239 <!-- ============ FIELD DETAIL =========== -->
\r
242 <!-- ========= CONSTRUCTOR DETAIL ======== -->
\r
245 <!-- ============ METHOD DETAIL ========== -->
\r
247 <A NAME="method_detail"><!-- --></A>
248 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
\r
249 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
\r
250 <TD COLSPAN=1><FONT SIZE="+2">
\r
251 <B>Method Detail</B></FONT></TD>
\r
255 <A NAME="pad(int)"><!-- --></A><H3>
\r
258 public static java.lang.String <B>pad</B>(int padding)</PRE>
\r
260 <DD>Returns a string with the given number of
264 <DT><B>Parameters:</B><DD><CODE>padding</CODE> - the number of spaces in the string
265 <DT><B>Returns:</B><DD>a string of length 'padding' containg only the SPACE
271 <A NAME="pad(java.lang.String, int)"><!-- --></A><H3>
\r
274 public static java.lang.String <B>pad</B>(java.lang.String string,
275 int minLength)</PRE>
\r
277 <DD>Pads with spaces or truncates the given string to guarantee that it is
278 exactly the desired length.
\r
281 <DT><B>Parameters:</B><DD><CODE>string</CODE> - the string to be padded<DD><CODE>minLength</CODE> - the desired length of the string
282 <DT><B>Returns:</B><DD>a string of length conntaining string
283 padded with whitespace or truncated</DL>
\r
288 <A NAME="deleteChar(java.lang.String, char)"><!-- --></A><H3>
\r
291 public static java.lang.String <B>deleteChar</B>(java.lang.String fromString,
292 char charToDelete)</PRE>
\r
294 <DD>Removes all instances of the specified character from the given String.
\r
297 <DT><B>Parameters:</B><DD><CODE>fromString</CODE> - the String to delete characters from<DD><CODE>charToDelete</CODE> - the character to delete from the given String
298 <DT><B>Returns:</B><DD>a String with all instances of the specified char deleted</DL>
\r
303 <A NAME="dump(java.io.PrintWriter, int, java.lang.String)"><!-- --></A><H3>
\r
306 public static void <B>dump</B>(java.io.PrintWriter pw,
308 java.lang.String string)</PRE>
\r
310 <DD>Dumps padded text. This is a simple tool for helping dump text
311 with padding to a Writer.
\r
314 <DT><B>Parameters:</B><DD><CODE>pw</CODE> - the stream to send the output<DD><CODE>padding</CODE> - the number of spaces in the string<DD><CODE>string</CODE> - the string to output</DL>
\r
319 <A NAME="getInputStream(java.net.URL)"><!-- --></A><H3>
\r
320 getInputStream</H3>
\r
322 public static java.io.InputStream <B>getInputStream</B>(java.net.URL url)
323 throws java.io.IOException</PRE>
\r
325 <DD>Returns an input stream for the given URL. If the URL
326 is pointing to a local file, returns a file input stream
327 suitable for MemoryMapped IO, otherwise, returns a buffered
331 <DT><B>Parameters:</B><DD><CODE>url</CODE> - the url to open as a stream
332 <DT><B>Returns:</B><DD>the stream associated with the URL
334 <DD><CODE>java.io.IOException</CODE> - if there is trouble creating the stream</DL>
\r
339 <A NAME="outString(java.io.DataOutputStream, java.lang.String)"><!-- --></A><H3>
\r
342 public static void <B>outString</B>(java.io.DataOutputStream dos,
343 java.lang.String s)
344 throws java.io.IOException</PRE>
\r
346 <DD>Outputs a string to the given stream.
\r
349 <DT><B>Parameters:</B><DD><CODE>dos</CODE> - the stream<DD><CODE>s</CODE> - the string to output
351 <DD><CODE>java.io.IOException</CODE> - if an I/O error occurs</DL>
\r
356 <A NAME="getString(java.io.DataInputStream)"><!-- --></A><H3>
\r
359 public static java.lang.String <B>getString</B>(java.io.DataInputStream dis)
360 throws java.io.IOException</PRE>
\r
362 <DD>Inputs a string from a DataInputStream.
\r
365 <DT><B>Parameters:</B><DD><CODE>dis</CODE> - the stream
366 <DT><B>Returns:</B><DD>the string
368 <DD><CODE>java.io.IOException</CODE> - if an I/O error occurs</DL>
\r
373 <A NAME="getString(java.nio.ByteBuffer)"><!-- --></A><H3>
\r
376 public static java.lang.String <B>getString</B>(java.nio.ByteBuffer bb)
377 throws java.io.IOException</PRE>
\r
379 <DD>Inputs a string from a ByteBuffer.
\r
382 <DT><B>Parameters:</B><DD><CODE>bb</CODE> - the input byte buffer
383 <DT><B>Returns:</B><DD>the string
385 <DD><CODE>java.io.IOException</CODE> - if an I/O error occurs</DL>
\r
390 <A NAME="getProperty(java.lang.String, java.lang.String)"><!-- --></A><H3>
\r
393 public static java.lang.String <B>getProperty</B>(java.lang.String name,
394 java.lang.String defaultValue)</PRE>
\r
396 <DD>Gets a property by name and returns its value. If the property
397 cannot be found, the default is returned
\r
400 <DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the property<DD><CODE>defaultValue</CODE> - the default value to use if the property
402 <DT><B>Returns:</B><DD>the string value for the property, or the defaultValue if
403 the property cannot be found</DL>
\r
408 <A NAME="getBoolean(java.lang.String)"><!-- --></A><H3>
\r
411 public static boolean <B>getBoolean</B>(java.lang.String name)</PRE>
\r
413 <DD>Gets a boolean property by name.
\r
416 <DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the property
417 <DT><B>Returns:</B><DD>If there is no property with the specified name, or
418 if the specified name is empty or null, then false is returned.
419 otherwise the boolean value of the property is returned</DL>
\r
424 <A NAME="getLong(java.lang.String, long)"><!-- --></A><H3>
\r
427 public static java.lang.Long <B>getLong</B>(java.lang.String name,
428 long defaultValue)</PRE>
\r
430 <DD>Gets a long property by name.
\r
433 <DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the property<DD><CODE>defaultValue</CODE> - the default value to use if the property
435 <DT><B>Returns:</B><DD>the long value for the property, or the defaultValue if
436 the property cannot be found</DL>
\r
441 <A NAME="getInteger(java.lang.String, int)"><!-- --></A><H3>
\r
444 public static java.lang.Integer <B>getInteger</B>(java.lang.String name,
445 int defaultValue)</PRE>
\r
447 <DD>Gets an Integer property by name.
\r
450 <DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the property<DD><CODE>defaultValue</CODE> - the default value to use if the property
452 <DT><B>Returns:</B><DD>the Integer value for the property, or the defaultValue if
453 the property cannot be found</DL>
\r
456 <!-- ========= END OF CLASS DATA ========= -->
\r
460 <!-- ======= START OF BOTTOM NAVBAR ====== -->
\r
461 <A NAME="navbar_bottom"><!-- --></A>
462 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
463 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
\r
465 <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
\r
466 <A NAME="navbar_bottom_firstrow"><!-- --></A>
467 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
\r
468 <TR ALIGN="center" VALIGN="top">
\r
469 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
\r
470 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
\r
471 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
\r
472 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
\r
473 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
\r
474 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
\r
475 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
\r
479 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
\r
485 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
\r
486 <A HREF="../../../../../com/sun/speech/freetts/util/Timer.html" title="class in com.sun.speech.freetts.util"><B>PREV CLASS</B></A>
\r
487 <A HREF="../../../../../com/sun/speech/freetts/util/WaveUtils.html" title="class in com.sun.speech.freetts.util"><B>NEXT CLASS</B></A></FONT></TD>
\r
488 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
\r
489 <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A>
\r
490 <A HREF="Utilities.html" target="_top"><B>NO FRAMES</B></A>
\r
491 <SCRIPT type="text/javascript">
\r
494 document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
\r
499 <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
\r
505 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
\r
506 SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
\r
507 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
\r
508 DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
\r
511 <A NAME="skip-navbar_bottom"></A>
512 <!-- ======== END OF BOTTOM NAVBAR ======= -->
\r