Home | History | Annotate | Download | only in io
      1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      2 <!--NewPage-->
      3 <HTML>
      4 <HEAD>
      5 <!-- Generated by javadoc (build 1.6.0-google-internal) on Mon Jan 04 20:47:59 PST 2010 -->
      6 <TITLE>
      7 Resources (Guava Libraries 2010.01.04)
      8 </TITLE>
      9 
     10 <META NAME="date" CONTENT="2010-01-04">
     11 
     12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
     13 
     14 <SCRIPT type="text/javascript">
     15 function windowTitle()
     16 {
     17     if (location.href.indexOf('is-external=true') == -1) {
     18         parent.document.title="Resources (Guava Libraries 2010.01.04)";
     19     }
     20 }
     21 </SCRIPT>
     22 <NOSCRIPT>
     23 </NOSCRIPT>
     24 
     25 </HEAD>
     26 
     27 <BODY BGCOLOR="white" onload="windowTitle();">
     28 <HR>
     29 
     30 
     31 <!-- ========= START OF TOP NAVBAR ======= -->
     32 <A NAME="navbar_top"><!-- --></A>
     33 <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
     34 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
     35 <TR>
     36 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
     37 <A NAME="navbar_top_firstrow"><!-- --></A>
     38 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
     39   <TR ALIGN="center" VALIGN="top">
     40   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
     41   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
     42   <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
     43   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Resources.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
     44   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
     45   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
     46   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
     47   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
     48   </TR>
     49 </TABLE>
     50 </TD>
     51 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
     52 </EM>
     53 </TD>
     54 </TR>
     55 
     56 <TR>
     57 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
     58 &nbsp;<A HREF="../../../../com/google/common/io/PatternFilenameFilter.html" title="class in com.google.common.io"><B>PREV CLASS</B></A>&nbsp;
     59 &nbsp;NEXT CLASS</FONT></TD>
     60 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
     61   <A HREF="../../../../index.html?com/google/common/io/Resources.html" target="_top"><B>FRAMES</B></A>  &nbsp;
     62 &nbsp;<A HREF="Resources.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
     63 &nbsp;<SCRIPT type="text/javascript">
     64   <!--
     65   if(window==top) {
     66     document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
     67   }
     68   //-->
     69 </SCRIPT>
     70 <NOSCRIPT>
     71   <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
     72 </NOSCRIPT>
     73 
     74 
     75 </FONT></TD>
     76 </TR>
     77 <TR>
     78 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
     79   SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
     80 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
     81 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
     82 </TR>
     83 </TABLE>
     84 <A NAME="skip-navbar_top"></A>
     85 <!-- ========= END OF TOP NAVBAR ========= -->
     86 
     87 <HR>
     88 <!-- ======== START OF CLASS DATA ======== -->
     89 <H2>
     90 <FONT SIZE="-1">
     91 com.google.common.io</FONT>
     92 <BR>
     93 Class Resources</H2>
     94 <PRE>
     95 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
     96   <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.google.common.io.Resources</B>
     97 </PRE>
     98 <HR>
     99 <DL>
    100 <DT><PRE>public final class <B>Resources</B><DT>extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL>
    101 </PRE>
    102 
    103 <P>
    104 Provides utility methods for working with resources in the classpath.
    105  Note that even those these methods use <A HREF="http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net"><CODE>URL</CODE></A> parameters, they
    106  are usually not appropriate for HTTP or other non-classpath resources.
    107 
    108  <p>All method parameters must be non-null unless documented otherwise.
    109 <P>
    110 
    111 <P>
    112 <DL>
    113 <DT><B>Since:</B></DT>
    114   <DD>2009.09.15 <b>tentative</b></DD>
    115 <DT><B>Author:</B></DT>
    116   <DD>Chris Nokleberg, Ben Yu</DD>
    117 </DL>
    118 <HR>
    119 
    120 <P>
    121 
    122 <!-- ======== CONSTRUCTOR SUMMARY ======== -->
    123 
    124 <A NAME="constructor_summary"><!-- --></A>
    125 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    126 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
    127 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
    128 <B>Constructor Summary</B></FONT></TH>
    129 </TR>
    130 <TR BGCOLOR="white" CLASS="TableRowColor">
    131 <TD><CODE><B><A HREF="../../../../com/google/common/io/Resources.html#Resources()">Resources</A></B>()</CODE>
    132 
    133 <BR>
    134 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
    135 </TR>
    136 </TABLE>
    137 &nbsp;
    138 <!-- ========== METHOD SUMMARY =========== -->
    139 
    140 <A NAME="method_summary"><!-- --></A>
    141 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    142 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
    143 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
    144 <B>Method Summary</B></FONT></TH>
    145 </TR>
    146 <TR BGCOLOR="white" CLASS="TableRowColor">
    147 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    148 <CODE>static&nbsp;void</CODE></FONT></TD>
    149 <TD><CODE><B><A HREF="../../../../com/google/common/io/Resources.html#copy(java.net.URL, java.io.OutputStream)">copy</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A>&nbsp;from,
    150      <A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A>&nbsp;to)</CODE>
    151 
    152 <BR>
    153 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Copies all bytes from a URL to an output stream.</TD>
    154 </TR>
    155 <TR BGCOLOR="white" CLASS="TableRowColor">
    156 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    157 <CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A></CODE></FONT></TD>
    158 <TD><CODE><B><A HREF="../../../../com/google/common/io/Resources.html#getResource(java.lang.Class, java.lang.String)">getResource</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A>&lt;?&gt;&nbsp;contextClass,
    159             <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;resourceName)</CODE>
    160 
    161 <BR>
    162 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a <code>URL</code> pointing to <code>resourceName</code> that is relative to
    163  <code>contextClass</code>, if the resource is found in the class path.</TD>
    164 </TR>
    165 <TR BGCOLOR="white" CLASS="TableRowColor">
    166 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    167 <CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A></CODE></FONT></TD>
    168 <TD><CODE><B><A HREF="../../../../com/google/common/io/Resources.html#getResource(java.lang.String)">getResource</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;resourceName)</CODE>
    169 
    170 <BR>
    171 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a <code>URL</code> pointing to <code>resourceName</code> if the resource is
    172  found in the class path.</TD>
    173 </TR>
    174 <TR BGCOLOR="white" CLASS="TableRowColor">
    175 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    176 <CODE>static&nbsp;<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>&gt;</CODE></FONT></TD>
    177 <TD><CODE><B><A HREF="../../../../com/google/common/io/Resources.html#newInputStreamSupplier(java.net.URL)">newInputStreamSupplier</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A>&nbsp;url)</CODE>
    178 
    179 <BR>
    180 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a factory that will supply instances of <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io"><CODE>InputStream</CODE></A> that
    181  read from the given URL.</TD>
    182 </TR>
    183 <TR BGCOLOR="white" CLASS="TableRowColor">
    184 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    185 <CODE>static&nbsp;<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStreamReader.html?is-external=true" title="class or interface in java.io">InputStreamReader</A>&gt;</CODE></FONT></TD>
    186 <TD><CODE><B><A HREF="../../../../com/google/common/io/Resources.html#newReaderSupplier(java.net.URL, java.nio.charset.Charset)">newReaderSupplier</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A>&nbsp;url,
    187                   <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</A>&nbsp;charset)</CODE>
    188 
    189 <BR>
    190 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a factory that will supply instances of
    191  <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStreamReader.html?is-external=true" title="class or interface in java.io"><CODE>InputStreamReader</CODE></A> that read a URL using the given character set.</TD>
    192 </TR>
    193 <TR BGCOLOR="white" CLASS="TableRowColor">
    194 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    195 <CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&gt;</CODE></FONT></TD>
    196 <TD><CODE><B><A HREF="../../../../com/google/common/io/Resources.html#readLines(java.net.URL, java.nio.charset.Charset)">readLines</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A>&nbsp;url,
    197           <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</A>&nbsp;charset)</CODE>
    198 
    199 <BR>
    200 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads all of the lines from a URL.</TD>
    201 </TR>
    202 <TR BGCOLOR="white" CLASS="TableRowColor">
    203 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    204 <CODE>static
    205 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
    206 <TR ALIGN="right" VALIGN="">
    207 <TD NOWRAP><FONT SIZE="-1">
    208 <CODE>&lt;T&gt; T</CODE></FONT></TD>
    209 </TR>
    210 </TABLE>
    211 </CODE></FONT></TD>
    212 <TD><CODE><B><A HREF="../../../../com/google/common/io/Resources.html#readLines(java.net.URL, java.nio.charset.Charset, com.google.common.io.LineProcessor)">readLines</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A>&nbsp;url,
    213           <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</A>&nbsp;charset,
    214           <A HREF="../../../../com/google/common/io/LineProcessor.html" title="interface in com.google.common.io">LineProcessor</A>&lt;T&gt;&nbsp;callback)</CODE>
    215 
    216 <BR>
    217 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Streams lines from a URL, stopping when our callback returns false, or we
    218  have read all of the lines.</TD>
    219 </TR>
    220 <TR BGCOLOR="white" CLASS="TableRowColor">
    221 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    222 <CODE>static&nbsp;byte[]</CODE></FONT></TD>
    223 <TD><CODE><B><A HREF="../../../../com/google/common/io/Resources.html#toByteArray(java.net.URL)">toByteArray</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A>&nbsp;url)</CODE>
    224 
    225 <BR>
    226 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads all bytes from a URL into a byte array.</TD>
    227 </TR>
    228 <TR BGCOLOR="white" CLASS="TableRowColor">
    229 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    230 <CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
    231 <TD><CODE><B><A HREF="../../../../com/google/common/io/Resources.html#toString(java.net.URL, java.nio.charset.Charset)">toString</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A>&nbsp;url,
    232          <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</A>&nbsp;charset)</CODE>
    233 
    234 <BR>
    235 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads all characters from a URL into a <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang"><CODE>String</CODE></A>, using the given
    236  character set.</TD>
    237 </TR>
    238 </TABLE>
    239 &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
    240 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    241 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
    242 <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
    243 </TR>
    244 <TR BGCOLOR="white" CLASS="TableRowColor">
    245 <TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
    246 </TR>
    247 </TABLE>
    248 &nbsp;
    249 <P>
    250 
    251 <!-- ========= CONSTRUCTOR DETAIL ======== -->
    252 
    253 <A NAME="constructor_detail"><!-- --></A>
    254 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    255 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
    256 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
    257 <B>Constructor Detail</B></FONT></TH>
    258 </TR>
    259 </TABLE>
    260 
    261 <A NAME="Resources()"><!-- --></A><H3>
    262 Resources</H3>
    263 <PRE>
    264 public <B>Resources</B>()</PRE>
    265 <DL>
    266 </DL>
    267 
    268 <!-- ============ METHOD DETAIL ========== -->
    269 
    270 <A NAME="method_detail"><!-- --></A>
    271 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    272 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
    273 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
    274 <B>Method Detail</B></FONT></TH>
    275 </TR>
    276 </TABLE>
    277 
    278 <A NAME="newInputStreamSupplier(java.net.URL)"><!-- --></A><H3>
    279 newInputStreamSupplier</H3>
    280 <PRE>
    281 public static <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>&gt; <B>newInputStreamSupplier</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A>&nbsp;url)</PRE>
    282 <DL>
    283 <DD>Returns a factory that will supply instances of <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io"><CODE>InputStream</CODE></A> that
    284  read from the given URL.
    285 <P>
    286 <DD><DL>
    287 <DT><B>Parameters:</B><DD><CODE>url</CODE> - the URL to read from
    288 <DT><B>Returns:</B><DD>the factory</DL>
    289 </DD>
    290 </DL>
    291 <HR>
    292 
    293 <A NAME="newReaderSupplier(java.net.URL, java.nio.charset.Charset)"><!-- --></A><H3>
    294 newReaderSupplier</H3>
    295 <PRE>
    296 public static <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStreamReader.html?is-external=true" title="class or interface in java.io">InputStreamReader</A>&gt; <B>newReaderSupplier</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A>&nbsp;url,
    297                                                                  <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</A>&nbsp;charset)</PRE>
    298 <DL>
    299 <DD>Returns a factory that will supply instances of
    300  <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStreamReader.html?is-external=true" title="class or interface in java.io"><CODE>InputStreamReader</CODE></A> that read a URL using the given character set.
    301 <P>
    302 <DD><DL>
    303 <DT><B>Parameters:</B><DD><CODE>url</CODE> - the URL to read from<DD><CODE>charset</CODE> - the character set used when reading the URL contents
    304 <DT><B>Returns:</B><DD>the factory</DL>
    305 </DD>
    306 </DL>
    307 <HR>
    308 
    309 <A NAME="toByteArray(java.net.URL)"><!-- --></A><H3>
    310 toByteArray</H3>
    311 <PRE>
    312 public static byte[] <B>toByteArray</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A>&nbsp;url)
    313                           throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
    314 <DL>
    315 <DD>Reads all bytes from a URL into a byte array.
    316 <P>
    317 <DD><DL>
    318 <DT><B>Parameters:</B><DD><CODE>url</CODE> - the URL to read from
    319 <DT><B>Returns:</B><DD>a byte array containing all the bytes from the URL
    320 <DT><B>Throws:</B>
    321 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE> - if an I/O error occurs</DL>
    322 </DD>
    323 </DL>
    324 <HR>
    325 
    326 <A NAME="toString(java.net.URL, java.nio.charset.Charset)"><!-- --></A><H3>
    327 toString</H3>
    328 <PRE>
    329 public static <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>toString</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A>&nbsp;url,
    330                               <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</A>&nbsp;charset)
    331                        throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
    332 <DL>
    333 <DD>Reads all characters from a URL into a <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang"><CODE>String</CODE></A>, using the given
    334  character set.
    335 <P>
    336 <DD><DL>
    337 <DT><B>Parameters:</B><DD><CODE>url</CODE> - the URL to read from<DD><CODE>charset</CODE> - the character set used when reading the URL
    338 <DT><B>Returns:</B><DD>a string containing all the characters from the URL
    339 <DT><B>Throws:</B>
    340 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE> - if an I/O error occurs.</DL>
    341 </DD>
    342 </DL>
    343 <HR>
    344 
    345 <A NAME="readLines(java.net.URL, java.nio.charset.Charset, com.google.common.io.LineProcessor)"><!-- --></A><H3>
    346 readLines</H3>
    347 <PRE>
    348 public static &lt;T&gt; T <B>readLines</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A>&nbsp;url,
    349                               <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</A>&nbsp;charset,
    350                               <A HREF="../../../../com/google/common/io/LineProcessor.html" title="interface in com.google.common.io">LineProcessor</A>&lt;T&gt;&nbsp;callback)
    351                    throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
    352 <DL>
    353 <DD>Streams lines from a URL, stopping when our callback returns false, or we
    354  have read all of the lines.
    355 <P>
    356 <DD><DL>
    357 <DT><B>Parameters:</B><DD><CODE>url</CODE> - the URL to read from<DD><CODE>charset</CODE> - the character set used when reading the URL<DD><CODE>callback</CODE> - the LineProcessor to use to handle the lines
    358 <DT><B>Returns:</B><DD>the output of processing the lines
    359 <DT><B>Throws:</B>
    360 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE> - if an I/O error occurs</DL>
    361 </DD>
    362 </DL>
    363 <HR>
    364 
    365 <A NAME="readLines(java.net.URL, java.nio.charset.Charset)"><!-- --></A><H3>
    366 readLines</H3>
    367 <PRE>
    368 public static <A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&gt; <B>readLines</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A>&nbsp;url,
    369                                      <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset">Charset</A>&nbsp;charset)
    370                               throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
    371 <DL>
    372 <DD>Reads all of the lines from a URL. The lines do not include
    373  line-termination characters, but do include other leading and trailing
    374  whitespace.
    375 <P>
    376 <DD><DL>
    377 <DT><B>Parameters:</B><DD><CODE>url</CODE> - the URL to read from<DD><CODE>charset</CODE> - the character set used when writing the file
    378 <DT><B>Returns:</B><DD>a mutable <A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util"><CODE>List</CODE></A> containing all the lines
    379 <DT><B>Throws:</B>
    380 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE> - if an I/O error occurs</DL>
    381 </DD>
    382 </DL>
    383 <HR>
    384 
    385 <A NAME="copy(java.net.URL, java.io.OutputStream)"><!-- --></A><H3>
    386 copy</H3>
    387 <PRE>
    388 public static void <B>copy</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A>&nbsp;from,
    389                         <A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A>&nbsp;to)
    390                  throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
    391 <DL>
    392 <DD>Copies all bytes from a URL to an output stream.
    393 <P>
    394 <DD><DL>
    395 <DT><B>Parameters:</B><DD><CODE>from</CODE> - the URL to read from<DD><CODE>to</CODE> - the output stream
    396 <DT><B>Throws:</B>
    397 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE> - if an I/O error occurs</DL>
    398 </DD>
    399 </DL>
    400 <HR>
    401 
    402 <A NAME="getResource(java.lang.String)"><!-- --></A><H3>
    403 getResource</H3>
    404 <PRE>
    405 public static <A HREF="http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A> <B>getResource</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;resourceName)</PRE>
    406 <DL>
    407 <DD>Returns a <code>URL</code> pointing to <code>resourceName</code> if the resource is
    408  found in the class path. <code>Resources.class.getClassLoader()</code> is used
    409  to locate the resource.
    410 <P>
    411 <DD><DL>
    412 
    413 <DT><B>Throws:</B>
    414 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if resource is not found</DL>
    415 </DD>
    416 </DL>
    417 <HR>
    418 
    419 <A NAME="getResource(java.lang.Class, java.lang.String)"><!-- --></A><H3>
    420 getResource</H3>
    421 <PRE>
    422 public static <A HREF="http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true" title="class or interface in java.net">URL</A> <B>getResource</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A>&lt;?&gt;&nbsp;contextClass,
    423                               <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;resourceName)</PRE>
    424 <DL>
    425 <DD>Returns a <code>URL</code> pointing to <code>resourceName</code> that is relative to
    426  <code>contextClass</code>, if the resource is found in the class path.
    427 <P>
    428 <DD><DL>
    429 
    430 <DT><B>Throws:</B>
    431 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if resource is not found</DL>
    432 </DD>
    433 </DL>
    434 <!-- ========= END OF CLASS DATA ========= -->
    435 <HR>
    436 
    437 
    438 <!-- ======= START OF BOTTOM NAVBAR ====== -->
    439 <A NAME="navbar_bottom"><!-- --></A>
    440 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
    441 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
    442 <TR>
    443 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
    444 <A NAME="navbar_bottom_firstrow"><!-- --></A>
    445 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
    446   <TR ALIGN="center" VALIGN="top">
    447   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
    448   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
    449   <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
    450   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Resources.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
    451   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
    452   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
    453   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
    454   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
    455   </TR>
    456 </TABLE>
    457 </TD>
    458 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
    459 </EM>
    460 </TD>
    461 </TR>
    462 
    463 <TR>
    464 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
    465 &nbsp;<A HREF="../../../../com/google/common/io/PatternFilenameFilter.html" title="class in com.google.common.io"><B>PREV CLASS</B></A>&nbsp;
    466 &nbsp;NEXT CLASS</FONT></TD>
    467 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
    468   <A HREF="../../../../index.html?com/google/common/io/Resources.html" target="_top"><B>FRAMES</B></A>  &nbsp;
    469 &nbsp;<A HREF="Resources.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
    470 &nbsp;<SCRIPT type="text/javascript">
    471   <!--
    472   if(window==top) {
    473     document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
    474   }
    475   //-->
    476 </SCRIPT>
    477 <NOSCRIPT>
    478   <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
    479 </NOSCRIPT>
    480 
    481 
    482 </FONT></TD>
    483 </TR>
    484 <TR>
    485 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
    486   SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
    487 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
    488 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
    489 </TR>
    490 </TABLE>
    491 <A NAME="skip-navbar_bottom"></A>
    492 <!-- ======== END OF BOTTOM NAVBAR ======= -->
    493 
    494 <HR>
    495 
    496 </BODY>
    497 </HTML>
    498