blob: 8adc3b99d5b7e77d828ccc0e15717c29de220d1f [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_06) on Wed Jul 19 14:45:54 EDT 2006 -->
<TITLE>
Util (Apache Cayenne API Documentation - v.2.0-incubating-SNAPSHOT)
</TITLE>
<META NAME="keywords" CONTENT="org.apache.cayenne.util.Util class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../apache-javadoc.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="Util (Apache Cayenne API Documentation - v.2.0-incubating-SNAPSHOT)";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../org/apache/cayenne/util/ResourceLocator.PredicateLogger.html" title="class in org.apache.cayenne.util"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../org/apache/cayenne/util/WebApplicationResourceLocator.html" title="class in org.apache.cayenne.util"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/apache/cayenne/util/Util.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="Util.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.cayenne.util</FONT>
<BR>
Class Util</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.cayenne.util.Util</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>Util</B><DT>extends java.lang.Object</DL>
</PRE>
<P>
Contains various unorganized static utility methods used across Cayenne.
<P>
<P>
<DL>
<DT><B>Author:</B></DT>
<DD>Andrei Adamchik</DD>
</DL>
<HR>
<P>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#Util()">Util</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.Object</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#cloneViaSerialization(java.io.Serializable)">cloneViaSerialization</A></B>(java.io.Serializable&nbsp;obj)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates Serializable object copy using serialization/deserialization.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#copy(java.io.File, java.io.File)">copy</A></B>(java.io.File&nbsp;source,
java.io.File&nbsp;destination)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Copies file contents from source to destination.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#copy(java.net.URL, java.io.File)">copy</A></B>(java.net.URL&nbsp;from,
java.io.File&nbsp;to)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Save URL contents to a file.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#copyPipe(java.io.InputStream, java.io.OutputStream, int)">copyPipe</A></B>(java.io.InputStream&nbsp;in,
java.io.OutputStream&nbsp;out,
int&nbsp;bufSizeHint)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads data from the input and writes it to the output, until the end of the input
stream.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;org.xml.sax.XMLReader</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#createXmlReader()">createXmlReader</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates an XMLReader with default feature set.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#delete(java.lang.String, boolean)">delete</A></B>(java.lang.String&nbsp;filePath,
boolean&nbsp;recursive)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Deletes a file or directory, allowing recursive directory deletion.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#encodeXmlAttribute(java.lang.String)">encodeXmlAttribute</A></B>(java.lang.String&nbsp;str)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Encodes a string so that it can be used as an attribute value in an XML document.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#extractFileExtension(java.lang.String)">extractFileExtension</A></B>(java.lang.String&nbsp;fileName)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Extracts extension from the file name.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.Class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#getJavaClass(java.lang.String)">getJavaClass</A></B>(java.lang.String&nbsp;className)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a Java class, handling regular class names as well as single-dimensional
arrays and primitive types.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#getPackagePath(java.lang.String)">getPackagePath</A></B>(java.lang.String&nbsp;className)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns package name for the Java class as a path separated with forward slash
("/").</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#hashCode(java.util.Collection)">hashCode</A></B>(java.util.Collection&nbsp;c)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Builds a hashCode of Collection.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#isAccessible(java.lang.reflect.Member)">isAccessible</A></B>(java.lang.reflect.Member&nbsp;member)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns true if a Member is accessible via reflection under normal Java access
controls.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#isEmptyString(java.lang.String)">isEmptyString</A></B>(java.lang.String&nbsp;string)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns true, if the String is null or an empty string.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#nullSafeCompare(boolean, java.lang.Comparable, java.lang.Object)">nullSafeCompare</A></B>(boolean&nbsp;nullsFirst,
java.lang.Comparable&nbsp;o1,
java.lang.Object&nbsp;o2)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compares two objects similar to "Comparable.compareTo(Object)".</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#nullSafeEquals(java.lang.Object, java.lang.Object)">nullSafeEquals</A></B>(java.lang.Object&nbsp;o1,
java.lang.Object&nbsp;o2)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compares two objects similar to "Object.equals(Object)".</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#prettyTrim(java.lang.String, int)">prettyTrim</A></B>(java.lang.String&nbsp;str,
int&nbsp;maxLength)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Trims long strings substituting middle part with "...".</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.util.Iterator</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#sortedIterator(java.util.Iterator, java.util.Comparator)">sortedIterator</A></B>(java.util.Iterator&nbsp;it,
java.util.Comparator&nbsp;comparator)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a sorted iterator from an unsorted one.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.util.regex.Pattern</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#sqlPatternToPattern(java.lang.String, boolean)">sqlPatternToPattern</A></B>(java.lang.String&nbsp;pattern,
boolean&nbsp;ignoreCase)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#sqlPatternToRegex(java.lang.String, boolean)">sqlPatternToRegex</A></B>(java.lang.String&nbsp;pattern,
boolean&nbsp;ignoreCase)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>since 1.2 use "sqlPatternToPattern".</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#stringFromFile(java.io.File)">stringFromFile</A></B>(java.io.File&nbsp;file)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads file contents, returning it as a String, using System default line separator.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#stringFromFile(java.io.File, java.lang.String)">stringFromFile</A></B>(java.io.File&nbsp;file,
java.lang.String&nbsp;joinWith)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads file contents, returning it as a String, joining lines with provided
separator.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#stripFileExtension(java.lang.String)">stripFileExtension</A></B>(java.lang.String&nbsp;fileName)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Strips extension from the file name.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#stripLineBreaks(java.lang.String, java.lang.String)">stripLineBreaks</A></B>(java.lang.String&nbsp;string,
java.lang.String&nbsp;replaceWith)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Strips "\n", "\r\n", "\r" from the argument string.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#substBackslashes(java.lang.String)">substBackslashes</A></B>(java.lang.String&nbsp;string)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Replaces all backslashes "\" with forward slashes "/".</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.util.Map</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#toMap(java.lang.Object[], java.lang.Object[])">toMap</A></B>(java.lang.Object[]&nbsp;keys,
java.lang.Object[]&nbsp;values)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a mutable map out of two arrays with keys and values.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;java.lang.Throwable</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/apache/cayenne/util/Util.html#unwindException(java.lang.Throwable)">unwindException</A></B>(java.lang.Throwable&nbsp;th)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Looks up and returns the root cause of an exception.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="Util()"><!-- --></A><H3>
Util</H3>
<PRE>
public <B>Util</B>()</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="stringFromFile(java.io.File)"><!-- --></A><H3>
stringFromFile</H3>
<PRE>
public static java.lang.String <B>stringFromFile</B>(java.io.File&nbsp;file)
throws java.io.IOException</PRE>
<DL>
<DD>Reads file contents, returning it as a String, using System default line separator.
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="stringFromFile(java.io.File, java.lang.String)"><!-- --></A><H3>
stringFromFile</H3>
<PRE>
public static java.lang.String <B>stringFromFile</B>(java.io.File&nbsp;file,
java.lang.String&nbsp;joinWith)
throws java.io.IOException</PRE>
<DL>
<DD>Reads file contents, returning it as a String, joining lines with provided
separator.
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="copy(java.io.File, java.io.File)"><!-- --></A><H3>
copy</H3>
<PRE>
public static boolean <B>copy</B>(java.io.File&nbsp;source,
java.io.File&nbsp;destination)</PRE>
<DL>
<DD>Copies file contents from source to destination. Makes up for the lack of file
copying utilities in Java
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="copy(java.net.URL, java.io.File)"><!-- --></A><H3>
copy</H3>
<PRE>
public static boolean <B>copy</B>(java.net.URL&nbsp;from,
java.io.File&nbsp;to)</PRE>
<DL>
<DD>Save URL contents to a file.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="copyPipe(java.io.InputStream, java.io.OutputStream, int)"><!-- --></A><H3>
copyPipe</H3>
<PRE>
public static void <B>copyPipe</B>(java.io.InputStream&nbsp;in,
java.io.OutputStream&nbsp;out,
int&nbsp;bufSizeHint)
throws java.io.IOException</PRE>
<DL>
<DD>Reads data from the input and writes it to the output, until the end of the input
stream.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>in</CODE> - <DD><CODE>out</CODE> - <DD><CODE>bufSizeHint</CODE> -
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="delete(java.lang.String, boolean)"><!-- --></A><H3>
delete</H3>
<PRE>
public static boolean <B>delete</B>(java.lang.String&nbsp;filePath,
boolean&nbsp;recursive)</PRE>
<DL>
<DD>Deletes a file or directory, allowing recursive directory deletion. This is an
improved version of File.delete() method.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="substBackslashes(java.lang.String)"><!-- --></A><H3>
substBackslashes</H3>
<PRE>
public static java.lang.String <B>substBackslashes</B>(java.lang.String&nbsp;string)</PRE>
<DL>
<DD>Replaces all backslashes "\" with forward slashes "/". Convenience method to
convert path Strings to URI format.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="unwindException(java.lang.Throwable)"><!-- --></A><H3>
unwindException</H3>
<PRE>
public static java.lang.Throwable <B>unwindException</B>(java.lang.Throwable&nbsp;th)</PRE>
<DL>
<DD>Looks up and returns the root cause of an exception. If none is found, returns
supplied Throwable object unchanged. If root is found, recursively "unwraps" it,
and returns the result to the user.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="nullSafeEquals(java.lang.Object, java.lang.Object)"><!-- --></A><H3>
nullSafeEquals</H3>
<PRE>
public static boolean <B>nullSafeEquals</B>(java.lang.Object&nbsp;o1,
java.lang.Object&nbsp;o2)</PRE>
<DL>
<DD>Compares two objects similar to "Object.equals(Object)". Unlike Object.equals(..),
this method doesn't throw an exception if any of the two objects is null.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="nullSafeCompare(boolean, java.lang.Comparable, java.lang.Object)"><!-- --></A><H3>
nullSafeCompare</H3>
<PRE>
public static int <B>nullSafeCompare</B>(boolean&nbsp;nullsFirst,
java.lang.Comparable&nbsp;o1,
java.lang.Object&nbsp;o2)</PRE>
<DL>
<DD>Compares two objects similar to "Comparable.compareTo(Object)". Unlike
Comparable.compareTo(..), this method doesn't throw an exception if any of the two
objects is null.
<P>
<DD><DL>
<DT><B>Since:</B></DT>
<DD>1.1</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="isEmptyString(java.lang.String)"><!-- --></A><H3>
isEmptyString</H3>
<PRE>
public static boolean <B>isEmptyString</B>(java.lang.String&nbsp;string)</PRE>
<DL>
<DD>Returns true, if the String is null or an empty string.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="cloneViaSerialization(java.io.Serializable)"><!-- --></A><H3>
cloneViaSerialization</H3>
<PRE>
public static java.lang.Object <B>cloneViaSerialization</B>(java.io.Serializable&nbsp;obj)
throws java.lang.Exception</PRE>
<DL>
<DD>Creates Serializable object copy using serialization/deserialization.
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE>java.lang.Exception</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="createXmlReader()"><!-- --></A><H3>
createXmlReader</H3>
<PRE>
public static org.xml.sax.XMLReader <B>createXmlReader</B>()
throws org.xml.sax.SAXException,
javax.xml.parsers.ParserConfigurationException</PRE>
<DL>
<DD>Creates an XMLReader with default feature set. Note that all Cayenne internal XML
parsers should probably use XMLReader obtained via this method for consistency
sake, and can customize feature sets as needed.
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE>org.xml.sax.SAXException</CODE>
<DD><CODE>javax.xml.parsers.ParserConfigurationException</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="getPackagePath(java.lang.String)"><!-- --></A><H3>
getPackagePath</H3>
<PRE>
public static java.lang.String <B>getPackagePath</B>(java.lang.String&nbsp;className)</PRE>
<DL>
<DD>Returns package name for the Java class as a path separated with forward slash
("/"). Method is used to lookup resources that are located in package
subdirectories. For example, a String "a/b/c" will be returned for class name
"a.b.c.ClassName".
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="toMap(java.lang.Object[], java.lang.Object[])"><!-- --></A><H3>
toMap</H3>
<PRE>
public static java.util.Map <B>toMap</B>(java.lang.Object[]&nbsp;keys,
java.lang.Object[]&nbsp;values)</PRE>
<DL>
<DD>Creates a mutable map out of two arrays with keys and values.
<P>
<DD><DL>
<DT><B>Since:</B></DT>
<DD>1.2</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="extractFileExtension(java.lang.String)"><!-- --></A><H3>
extractFileExtension</H3>
<PRE>
public static java.lang.String <B>extractFileExtension</B>(java.lang.String&nbsp;fileName)</PRE>
<DL>
<DD>Extracts extension from the file name. Dot is not included in the returned string.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="stripFileExtension(java.lang.String)"><!-- --></A><H3>
stripFileExtension</H3>
<PRE>
public static java.lang.String <B>stripFileExtension</B>(java.lang.String&nbsp;fileName)</PRE>
<DL>
<DD>Strips extension from the file name.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="stripLineBreaks(java.lang.String, java.lang.String)"><!-- --></A><H3>
stripLineBreaks</H3>
<PRE>
public static java.lang.String <B>stripLineBreaks</B>(java.lang.String&nbsp;string,
java.lang.String&nbsp;replaceWith)</PRE>
<DL>
<DD>Strips "\n", "\r\n", "\r" from the argument string.
<P>
<DD><DL>
<DT><B>Since:</B></DT>
<DD>1.2</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="encodeXmlAttribute(java.lang.String)"><!-- --></A><H3>
encodeXmlAttribute</H3>
<PRE>
public static java.lang.String <B>encodeXmlAttribute</B>(java.lang.String&nbsp;str)</PRE>
<DL>
<DD>Encodes a string so that it can be used as an attribute value in an XML document.
Will do conversion of the greater/less signs, quotes and ampersands.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="prettyTrim(java.lang.String, int)"><!-- --></A><H3>
prettyTrim</H3>
<PRE>
public static java.lang.String <B>prettyTrim</B>(java.lang.String&nbsp;str,
int&nbsp;maxLength)</PRE>
<DL>
<DD>Trims long strings substituting middle part with "...".
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>str</CODE> - String to trim.<DD><CODE>maxLength</CODE> - maximum allowable length. Must be at least 5, or an
IllegalArgumentException is thrown.
<DT><B>Returns:</B><DD>String</DL>
</DD>
</DL>
<HR>
<A NAME="sortedIterator(java.util.Iterator, java.util.Comparator)"><!-- --></A><H3>
sortedIterator</H3>
<PRE>
public static java.util.Iterator <B>sortedIterator</B>(java.util.Iterator&nbsp;it,
java.util.Comparator&nbsp;comparator)</PRE>
<DL>
<DD>Returns a sorted iterator from an unsorted one. Use this method as a last resort,
since it is much less efficient then just sorting a collection that backs the
original iterator.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="hashCode(java.util.Collection)"><!-- --></A><H3>
hashCode</H3>
<PRE>
public static int <B>hashCode</B>(java.util.Collection&nbsp;c)</PRE>
<DL>
<DD>Builds a hashCode of Collection.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="sqlPatternToRegex(java.lang.String, boolean)"><!-- --></A><H3>
sqlPatternToRegex</H3>
<PRE>
public static java.lang.String <B>sqlPatternToRegex</B>(java.lang.String&nbsp;pattern,
boolean&nbsp;ignoreCase)</PRE>
<DL>
<DD><B>Deprecated.</B>&nbsp;<I>since 1.2 use "sqlPatternToPattern".</I>
<P>
<DD>Converts a SQL-style pattern to a valid Perl regular expression. E.g.:
<p>
<code>"billing_%"</code> will become <code>/^billing_.*$/</code>
<p>
<code>"user?"</code> will become <code>/^user.?$/</code>
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="sqlPatternToPattern(java.lang.String, boolean)"><!-- --></A><H3>
sqlPatternToPattern</H3>
<PRE>
public static java.util.regex.Pattern <B>sqlPatternToPattern</B>(java.lang.String&nbsp;pattern,
boolean&nbsp;ignoreCase)</PRE>
<DL>
<DD><DL>
<DT><B>Since:</B></DT>
<DD>1.2</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="isAccessible(java.lang.reflect.Member)"><!-- --></A><H3>
isAccessible</H3>
<PRE>
public static boolean <B>isAccessible</B>(java.lang.reflect.Member&nbsp;member)</PRE>
<DL>
<DD>Returns true if a Member is accessible via reflection under normal Java access
controls.
<P>
<DD><DL>
<DT><B>Since:</B></DT>
<DD>1.2</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="getJavaClass(java.lang.String)"><!-- --></A><H3>
getJavaClass</H3>
<PRE>
public static java.lang.Class <B>getJavaClass</B>(java.lang.String&nbsp;className)
throws java.lang.ClassNotFoundException</PRE>
<DL>
<DD>Creates a Java class, handling regular class names as well as single-dimensional
arrays and primitive types.
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE>java.lang.ClassNotFoundException</CODE><DT><B>Since:</B></DT>
<DD>1.2</DD>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../org/apache/cayenne/util/ResourceLocator.PredicateLogger.html" title="class in org.apache.cayenne.util"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../org/apache/cayenne/util/WebApplicationResourceLocator.html" title="class in org.apache.cayenne.util"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/apache/cayenne/util/Util.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="Util.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
<i>Copyright &#169; 2001-2006 <a href=
"http://apache.org" target="_top">Apache.org</a> All Rights Reserved.</i>
</BODY>
</HTML>