<!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.6.0-google-internal) on Mon Jan 04 20:47:59 PST 2010 --> <TITLE> Files (Guava Libraries 2010.01.04) </TITLE> <META NAME="date" CONTENT="2010-01-04"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Files (Guava Libraries 2010.01.04)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= 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> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Files.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../com/google/common/io/FileBackedOutputStream.html" title="class in com.google.common.io"><B>PREV CLASS</B></A> <A HREF="../../../../com/google/common/io/Flushables.html" title="class in com.google.common.io"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?com/google/common/io/Files.html" target="_top"><B>FRAMES</B></A> <A HREF="Files.html" target="_top"><B>NO FRAMES</B></A> <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: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | CONSTR | <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"> com.google.common.io</FONT> <BR> Class Files</H2> <PRE> <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> <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.google.common.io.Files</B> </PRE> <HR> <DL> <DT><PRE>public final class <B>Files</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> </PRE> <P> Provides utility methods for working with files. <p>All method parameters must be non-null unless documented otherwise. <P> <P> <DL> <DT><B>Since:</B></DT> <DD>2009.09.15 <b>tentative</b></DD> <DT><B>Author:</B></DT> <DD>Chris Nokleberg</DD> </DL> <HR> <P> <!-- ========== 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 void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#append(java.lang.CharSequence, java.io.File, java.nio.charset.Charset)">append</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> from, <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> to, <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> charset)</CODE> <BR> Appends a character sequence (such as a string) to a file using the given character set.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#copy(java.io.File, java.nio.charset.Charset, java.lang.Appendable)">copy</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> from, <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> charset, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Appendable.html?is-external=true" title="class or interface in java.lang">Appendable</A> to)</CODE> <BR> Copies all characters from a file to an appendable object, using the given character set.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><W extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Appendable.html?is-external=true" title="class or interface in java.lang">Appendable</A> & <A HREF="http://java.sun.com/javase/6/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</A>> <BR> void</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#copy(java.io.File, java.nio.charset.Charset, com.google.common.io.OutputSupplier)">copy</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> from, <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> charset, <A HREF="../../../../com/google/common/io/OutputSupplier.html" title="interface in com.google.common.io">OutputSupplier</A><W> to)</CODE> <BR> Copies all characters from a file to a <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Appendable.html?is-external=true" title="class or interface in java.lang"><CODE>Appendable</CODE></A> & <A HREF="http://java.sun.com/javase/6/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io"><CODE>Closeable</CODE></A> object supplied by a factory, using the given character set.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#copy(java.io.File, java.io.File)">copy</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> from, <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> to)</CODE> <BR> Copies all the bytes from one file to another.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#copy(java.io.File, java.io.OutputStream)">copy</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> from, <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> to)</CODE> <BR> Copies all bytes from a file to an output stream.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#copy(java.io.File, com.google.common.io.OutputSupplier)">copy</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> from, <A HREF="../../../../com/google/common/io/OutputSupplier.html" title="interface in com.google.common.io">OutputSupplier</A><? extends <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>> to)</CODE> <BR> Copies all bytes from a file to an <A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io"><CODE>OutputStream</CODE></A> supplied by a factory.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#copy(com.google.common.io.InputSupplier, java.io.File)">copy</A></B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <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>> from, <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> to)</CODE> <BR> Copies to a file all bytes from an <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> supplied by a factory.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><R extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Readable.html?is-external=true" title="class or interface in java.lang">Readable</A> & <A HREF="http://java.sun.com/javase/6/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</A>> <BR> void</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#copy(com.google.common.io.InputSupplier, java.io.File, java.nio.charset.Charset)">copy</A></B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><R> from, <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> to, <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> charset)</CODE> <BR> Copies to a file all characters from a <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Readable.html?is-external=true" title="class or interface in java.lang"><CODE>Readable</CODE></A> and <A HREF="http://java.sun.com/javase/6/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io"><CODE>Closeable</CODE></A> object supplied by a factory, using the given character set.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#createTempDir()">createTempDir</A></B>()</CODE> <BR> Atomically creates a new directory somewhere beneath the system's temporary directory (as defined by the <code>java.io.tmpdir</code> system property), and returns its name.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#deleteDirectoryContents(java.io.File)">deleteDirectoryContents</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> directory)</CODE> <BR> Deletes all the files within a directory.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#deleteRecursively(java.io.File)">deleteRecursively</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file)</CODE> <BR> Deletes a file or directory and all contents recursively.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#equal(java.io.File, java.io.File)">equal</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file1, <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file2)</CODE> <BR> Returns true if the files contains the same bytes.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static long</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#getChecksum(java.io.File, java.util.zip.Checksum)">getChecksum</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <A HREF="http://java.sun.com/javase/6/docs/api/java/util/zip/Checksum.html?is-external=true" title="class or interface in java.util.zip">Checksum</A> checksum)</CODE> <BR> Computes and returns the checksum value for a file.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static byte[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#getDigest(java.io.File, java.security.MessageDigest)">getDigest</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <A HREF="http://java.sun.com/javase/6/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security">MessageDigest</A> md)</CODE> <BR> Computes and returns the digest value for a file.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/MappedByteBuffer.html?is-external=true" title="class or interface in java.nio">MappedByteBuffer</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#map(java.io.File)">map</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file)</CODE> <BR> Fully maps a file read-only in to memory as per <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.html?is-external=true#map(java.nio.channels.FileChannel.MapMode, long, long)" title="class or interface in java.nio.channels"><CODE>FileChannel.map(java.nio.channels.FileChannel.MapMode, long, long)</CODE></A>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/MappedByteBuffer.html?is-external=true" title="class or interface in java.nio">MappedByteBuffer</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#map(java.io.File, java.nio.channels.FileChannel.MapMode)">map</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.MapMode.html?is-external=true" title="class or interface in java.nio.channels">FileChannel.MapMode</A> mode)</CODE> <BR> Fully maps a file in to memory as per <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.html?is-external=true#map(java.nio.channels.FileChannel.MapMode, long, long)" title="class or interface in java.nio.channels"><CODE>FileChannel.map(java.nio.channels.FileChannel.MapMode, long, long)</CODE></A> using the requested <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.MapMode.html?is-external=true" title="class or interface in java.nio.channels"><CODE>FileChannel.MapMode</CODE></A>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/MappedByteBuffer.html?is-external=true" title="class or interface in java.nio">MappedByteBuffer</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#map(java.io.File, java.nio.channels.FileChannel.MapMode, long)">map</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.MapMode.html?is-external=true" title="class or interface in java.nio.channels">FileChannel.MapMode</A> mode, long size)</CODE> <BR> Maps a file in to memory as per <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.html?is-external=true#map(java.nio.channels.FileChannel.MapMode, long, long)" title="class or interface in java.nio.channels"><CODE>FileChannel.map(java.nio.channels.FileChannel.MapMode, long, long)</CODE></A> using the requested <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.MapMode.html?is-external=true" title="class or interface in java.nio.channels"><CODE>FileChannel.MapMode</CODE></A>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#move(java.io.File, java.io.File)">move</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> from, <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> to)</CODE> <BR> Moves the file from one path to another.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileInputStream.html?is-external=true" title="class or interface in java.io">FileInputStream</A>></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#newInputStreamSupplier(java.io.File)">newInputStreamSupplier</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file)</CODE> <BR> Returns a factory that will supply instances of <A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileInputStream.html?is-external=true" title="class or interface in java.io"><CODE>FileInputStream</CODE></A> that read from a file.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../../../../com/google/common/io/OutputSupplier.html" title="interface in com.google.common.io">OutputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileOutputStream.html?is-external=true" title="class or interface in java.io">FileOutputStream</A>></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#newOutputStreamSupplier(java.io.File)">newOutputStreamSupplier</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file)</CODE> <BR> Returns a factory that will supply instances of <A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileOutputStream.html?is-external=true" title="class or interface in java.io"><CODE>FileOutputStream</CODE></A> that write to a file.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../../../../com/google/common/io/OutputSupplier.html" title="interface in com.google.common.io">OutputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileOutputStream.html?is-external=true" title="class or interface in java.io">FileOutputStream</A>></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#newOutputStreamSupplier(java.io.File, boolean)">newOutputStreamSupplier</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, boolean append)</CODE> <BR> Returns a factory that will supply instances of <A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileOutputStream.html?is-external=true" title="class or interface in java.io"><CODE>FileOutputStream</CODE></A> that write to or append to a file.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="http://java.sun.com/javase/6/docs/api/java/io/BufferedReader.html?is-external=true" title="class or interface in java.io">BufferedReader</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#newReader(java.io.File, java.nio.charset.Charset)">newReader</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <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> charset)</CODE> <BR> Returns a buffered reader that reads from a file using the given character set.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><<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>></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#newReaderSupplier(java.io.File, java.nio.charset.Charset)">newReaderSupplier</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <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> charset)</CODE> <BR> Returns a factory that will supply instances of <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 file using the given character set.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="http://java.sun.com/javase/6/docs/api/java/io/BufferedWriter.html?is-external=true" title="class or interface in java.io">BufferedWriter</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#newWriter(java.io.File, java.nio.charset.Charset)">newWriter</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <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> charset)</CODE> <BR> Returns a buffered writer that writes to a file using the given character set.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../../../../com/google/common/io/OutputSupplier.html" title="interface in com.google.common.io">OutputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStreamWriter.html?is-external=true" title="class or interface in java.io">OutputStreamWriter</A>></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#newWriterSupplier(java.io.File, java.nio.charset.Charset)">newWriterSupplier</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <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> charset)</CODE> <BR> Returns a factory that will supply instances of <A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStreamWriter.html?is-external=true" title="class or interface in java.io"><CODE>OutputStreamWriter</CODE></A> that write to a file using the given character set.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../../../../com/google/common/io/OutputSupplier.html" title="interface in com.google.common.io">OutputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStreamWriter.html?is-external=true" title="class or interface in java.io">OutputStreamWriter</A>></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#newWriterSupplier(java.io.File, java.nio.charset.Charset, boolean)">newWriterSupplier</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <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> charset, boolean append)</CODE> <BR> Returns a factory that will supply instances of <A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStreamWriter.html?is-external=true" title="class or interface in java.io"><CODE>OutputStreamWriter</CODE></A> that write to or append to a file using the given character set.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> T</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#readBytes(java.io.File, com.google.common.io.ByteProcessor)">readBytes</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <A HREF="../../../../com/google/common/io/ByteProcessor.html" title="interface in com.google.common.io">ByteProcessor</A><T> processor)</CODE> <BR> Process the bytes of a file.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>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></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#readFirstLine(java.io.File, java.nio.charset.Charset)">readFirstLine</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <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> charset)</CODE> <BR> Reads the first line from a file.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>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><<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> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#readLines(java.io.File, java.nio.charset.Charset)">readLines</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <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> charset)</CODE> <BR> Reads all of the lines from a file.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE><T> T</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#readLines(java.io.File, java.nio.charset.Charset, com.google.common.io.LineProcessor)">readLines</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <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> charset, <A HREF="../../../../com/google/common/io/LineProcessor.html" title="interface in com.google.common.io">LineProcessor</A><T> callback)</CODE> <BR> Streams lines from a <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io"><CODE>File</CODE></A>, stopping when our callback returns false, or we have read all of the lines.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static byte[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#toByteArray(java.io.File)">toByteArray</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file)</CODE> <BR> Reads all bytes from a file into a byte array.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>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></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#toString(java.io.File, java.nio.charset.Charset)">toString</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <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> charset)</CODE> <BR> Reads all characters from a file 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 character set.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#touch(java.io.File)">touch</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file)</CODE> <BR> Creates an empty file or updates the last updated timestamp on the same as the unix command of the same name.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#write(byte[], java.io.File)">write</A></B>(byte[] from, <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> to)</CODE> <BR> Overwrites a file with the contents of a byte array.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../com/google/common/io/Files.html#write(java.lang.CharSequence, java.io.File, java.nio.charset.Charset)">write</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> from, <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> to, <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> charset)</CODE> <BR> Writes a character sequence (such as a string) to a file using the given character set.</TD> </TR> </TABLE> <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.<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> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <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> </TR> </TABLE> <P> <!-- ============ 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="newReader(java.io.File, java.nio.charset.Charset)"><!-- --></A><H3> newReader</H3> <PRE> public static <A HREF="http://java.sun.com/javase/6/docs/api/java/io/BufferedReader.html?is-external=true" title="class or interface in java.io">BufferedReader</A> <B>newReader</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <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> charset) throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileNotFoundException.html?is-external=true" title="class or interface in java.io">FileNotFoundException</A></PRE> <DL> <DD>Returns a buffered reader that reads from a file using the given character set. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to read from<DD><CODE>charset</CODE> - the character set used when writing the file <DT><B>Returns:</B><DD>the buffered reader <DT><B>Throws:</B> <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileNotFoundException.html?is-external=true" title="class or interface in java.io">FileNotFoundException</A></CODE></DL> </DD> </DL> <HR> <A NAME="newWriter(java.io.File, java.nio.charset.Charset)"><!-- --></A><H3> newWriter</H3> <PRE> public static <A HREF="http://java.sun.com/javase/6/docs/api/java/io/BufferedWriter.html?is-external=true" title="class or interface in java.io">BufferedWriter</A> <B>newWriter</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <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> charset) throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileNotFoundException.html?is-external=true" title="class or interface in java.io">FileNotFoundException</A></PRE> <DL> <DD>Returns a buffered writer that writes to a file using the given character set. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to write to<DD><CODE>charset</CODE> - the character set used when writing the file <DT><B>Returns:</B><DD>the buffered writer <DT><B>Throws:</B> <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileNotFoundException.html?is-external=true" title="class or interface in java.io">FileNotFoundException</A></CODE></DL> </DD> </DL> <HR> <A NAME="newInputStreamSupplier(java.io.File)"><!-- --></A><H3> newInputStreamSupplier</H3> <PRE> public static <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileInputStream.html?is-external=true" title="class or interface in java.io">FileInputStream</A>> <B>newInputStreamSupplier</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file)</PRE> <DL> <DD>Returns a factory that will supply instances of <A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileInputStream.html?is-external=true" title="class or interface in java.io"><CODE>FileInputStream</CODE></A> that read from a file. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to read from <DT><B>Returns:</B><DD>the factory</DL> </DD> </DL> <HR> <A NAME="newOutputStreamSupplier(java.io.File)"><!-- --></A><H3> newOutputStreamSupplier</H3> <PRE> public static <A HREF="../../../../com/google/common/io/OutputSupplier.html" title="interface in com.google.common.io">OutputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileOutputStream.html?is-external=true" title="class or interface in java.io">FileOutputStream</A>> <B>newOutputStreamSupplier</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file)</PRE> <DL> <DD>Returns a factory that will supply instances of <A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileOutputStream.html?is-external=true" title="class or interface in java.io"><CODE>FileOutputStream</CODE></A> that write to a file. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to write to <DT><B>Returns:</B><DD>the factory</DL> </DD> </DL> <HR> <A NAME="newOutputStreamSupplier(java.io.File, boolean)"><!-- --></A><H3> newOutputStreamSupplier</H3> <PRE> public static <A HREF="../../../../com/google/common/io/OutputSupplier.html" title="interface in com.google.common.io">OutputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileOutputStream.html?is-external=true" title="class or interface in java.io">FileOutputStream</A>> <B>newOutputStreamSupplier</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, boolean append)</PRE> <DL> <DD>Returns a factory that will supply instances of <A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileOutputStream.html?is-external=true" title="class or interface in java.io"><CODE>FileOutputStream</CODE></A> that write to or append to a file. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to write to<DD><CODE>append</CODE> - if true, the encoded characters will be appended to the file; otherwise the file is overwritten <DT><B>Returns:</B><DD>the factory</DL> </DD> </DL> <HR> <A NAME="newReaderSupplier(java.io.File, java.nio.charset.Charset)"><!-- --></A><H3> newReaderSupplier</H3> <PRE> public static <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><<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>> <B>newReaderSupplier</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <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> charset)</PRE> <DL> <DD>Returns a factory that will supply instances of <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 file using the given character set. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to read from<DD><CODE>charset</CODE> - the character set used when reading the file <DT><B>Returns:</B><DD>the factory</DL> </DD> </DL> <HR> <A NAME="newWriterSupplier(java.io.File, java.nio.charset.Charset)"><!-- --></A><H3> newWriterSupplier</H3> <PRE> public static <A HREF="../../../../com/google/common/io/OutputSupplier.html" title="interface in com.google.common.io">OutputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStreamWriter.html?is-external=true" title="class or interface in java.io">OutputStreamWriter</A>> <B>newWriterSupplier</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <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> charset)</PRE> <DL> <DD>Returns a factory that will supply instances of <A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStreamWriter.html?is-external=true" title="class or interface in java.io"><CODE>OutputStreamWriter</CODE></A> that write to a file using the given character set. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to write to<DD><CODE>charset</CODE> - the character set used when writing the file <DT><B>Returns:</B><DD>the factory</DL> </DD> </DL> <HR> <A NAME="newWriterSupplier(java.io.File, java.nio.charset.Charset, boolean)"><!-- --></A><H3> newWriterSupplier</H3> <PRE> public static <A HREF="../../../../com/google/common/io/OutputSupplier.html" title="interface in com.google.common.io">OutputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStreamWriter.html?is-external=true" title="class or interface in java.io">OutputStreamWriter</A>> <B>newWriterSupplier</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <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> charset, boolean append)</PRE> <DL> <DD>Returns a factory that will supply instances of <A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStreamWriter.html?is-external=true" title="class or interface in java.io"><CODE>OutputStreamWriter</CODE></A> that write to or append to a file using the given character set. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to write to<DD><CODE>charset</CODE> - the character set used when writing the file<DD><CODE>append</CODE> - if true, the encoded characters will be appended to the file; otherwise the file is overwritten <DT><B>Returns:</B><DD>the factory</DL> </DD> </DL> <HR> <A NAME="toByteArray(java.io.File)"><!-- --></A><H3> toByteArray</H3> <PRE> public static byte[] <B>toByteArray</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file) 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> <DL> <DD>Reads all bytes from a file into a byte array. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to read from <DT><B>Returns:</B><DD>a byte array containing all the bytes from file <DT><B>Throws:</B> <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 the file is bigger than the largest possible byte array (2^31 - 1) <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> </DD> </DL> <HR> <A NAME="toString(java.io.File, java.nio.charset.Charset)"><!-- --></A><H3> toString</H3> <PRE> 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/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <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> charset) 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> <DL> <DD>Reads all characters from a file 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 character set. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to read from<DD><CODE>charset</CODE> - the character set used when reading the file <DT><B>Returns:</B><DD>a string containing all the characters from the file <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="copy(com.google.common.io.InputSupplier, java.io.File)"><!-- --></A><H3> copy</H3> <PRE> public static void <B>copy</B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <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>> from, <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> to) 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> <DL> <DD>Copies to a file all bytes from an <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> supplied by a factory. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>from</CODE> - the input factory<DD><CODE>to</CODE> - the destination file <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="write(byte[], java.io.File)"><!-- --></A><H3> write</H3> <PRE> public static void <B>write</B>(byte[] from, <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> to) 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> <DL> <DD>Overwrites a file with the contents of a byte array. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>from</CODE> - the bytes to write<DD><CODE>to</CODE> - the destination file <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="copy(java.io.File, com.google.common.io.OutputSupplier)"><!-- --></A><H3> copy</H3> <PRE> public static void <B>copy</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> from, <A HREF="../../../../com/google/common/io/OutputSupplier.html" title="interface in com.google.common.io">OutputSupplier</A><? extends <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>> to) 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> <DL> <DD>Copies all bytes from a file to an <A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io"><CODE>OutputStream</CODE></A> supplied by a factory. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>from</CODE> - the source file<DD><CODE>to</CODE> - the output factory <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="copy(java.io.File, java.io.OutputStream)"><!-- --></A><H3> copy</H3> <PRE> public static void <B>copy</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> from, <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> to) 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> <DL> <DD>Copies all bytes from a file to an output stream. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>from</CODE> - the source file<DD><CODE>to</CODE> - the output stream <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="copy(java.io.File, java.io.File)"><!-- --></A><H3> copy</H3> <PRE> public static void <B>copy</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> from, <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> to) 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> <DL> <DD>Copies all the bytes from one file to another. . <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>from</CODE> - the source file<DD><CODE>to</CODE> - the destination file <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="copy(com.google.common.io.InputSupplier, java.io.File, java.nio.charset.Charset)"><!-- --></A><H3> copy</H3> <PRE> public static <R extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Readable.html?is-external=true" title="class or interface in java.lang">Readable</A> & <A HREF="http://java.sun.com/javase/6/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</A>> void <B>copy</B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><R> from, <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> to, <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> charset) 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> <DL> <DD>Copies to a file all characters from a <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Readable.html?is-external=true" title="class or interface in java.lang"><CODE>Readable</CODE></A> and <A HREF="http://java.sun.com/javase/6/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io"><CODE>Closeable</CODE></A> object supplied by a factory, using the given character set. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>from</CODE> - the readable supplier<DD><CODE>to</CODE> - the destination file<DD><CODE>charset</CODE> - the character set used when writing the file <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="write(java.lang.CharSequence, java.io.File, java.nio.charset.Charset)"><!-- --></A><H3> write</H3> <PRE> public static void <B>write</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> from, <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> to, <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> charset) 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> <DL> <DD>Writes a character sequence (such as a string) to a file using the given character set. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>from</CODE> - the character sequence to write<DD><CODE>to</CODE> - the destination file<DD><CODE>charset</CODE> - the character set used when writing the file <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="append(java.lang.CharSequence, java.io.File, java.nio.charset.Charset)"><!-- --></A><H3> append</H3> <PRE> public static void <B>append</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/CharSequence.html?is-external=true" title="class or interface in java.lang">CharSequence</A> from, <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> to, <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> charset) 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> <DL> <DD>Appends a character sequence (such as a string) to a file using the given character set. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>from</CODE> - the character sequence to append<DD><CODE>to</CODE> - the destination file<DD><CODE>charset</CODE> - the character set used when writing the file <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="copy(java.io.File, java.nio.charset.Charset, com.google.common.io.OutputSupplier)"><!-- --></A><H3> copy</H3> <PRE> public static <W extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Appendable.html?is-external=true" title="class or interface in java.lang">Appendable</A> & <A HREF="http://java.sun.com/javase/6/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io">Closeable</A>> void <B>copy</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> from, <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> charset, <A HREF="../../../../com/google/common/io/OutputSupplier.html" title="interface in com.google.common.io">OutputSupplier</A><W> to) 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> <DL> <DD>Copies all characters from a file to a <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Appendable.html?is-external=true" title="class or interface in java.lang"><CODE>Appendable</CODE></A> & <A HREF="http://java.sun.com/javase/6/docs/api/java/io/Closeable.html?is-external=true" title="class or interface in java.io"><CODE>Closeable</CODE></A> object supplied by a factory, using the given character set. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>from</CODE> - the source file<DD><CODE>charset</CODE> - the character set used when reading the file<DD><CODE>to</CODE> - the appendable supplier <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="copy(java.io.File, java.nio.charset.Charset, java.lang.Appendable)"><!-- --></A><H3> copy</H3> <PRE> public static void <B>copy</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> from, <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> charset, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Appendable.html?is-external=true" title="class or interface in java.lang">Appendable</A> to) 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> <DL> <DD>Copies all characters from a file to an appendable object, using the given character set. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>from</CODE> - the source file<DD><CODE>charset</CODE> - the character set used when reading the file<DD><CODE>to</CODE> - the appendable object <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="equal(java.io.File, java.io.File)"><!-- --></A><H3> equal</H3> <PRE> public static boolean <B>equal</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file1, <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file2) 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> <DL> <DD>Returns true if the files contains the same bytes. <P> <DD><DL> <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="createTempDir()"><!-- --></A><H3> createTempDir</H3> <PRE> public static <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> <B>createTempDir</B>()</PRE> <DL> <DD>Atomically creates a new directory somewhere beneath the system's temporary directory (as defined by the <code>java.io.tmpdir</code> system property), and returns its name. <p>Use this method instead of <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true#createTempFile(java.lang.String, java.lang.String)" title="class or interface in java.io"><CODE>File.createTempFile(String, String)</CODE></A> when you wish to create a directory, not a regular file. A common pitfall is to call <code>createTempFile</code>, delete the file and create a directory in its place, but this leads a race condition which can be exploited to create security vulnerabilities, especially when executable files are to be written into the directory. <p>This method assumes that the temporary volume is writable, has free inodes and free blocks, and that it will not be called thousands of times per second. <P> <DD><DL> <DT><B>Returns:</B><DD>the newly-created directory <DT><B>Throws:</B> <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</A></CODE> - if the directory could not be created</DL> </DD> </DL> <HR> <A NAME="touch(java.io.File)"><!-- --></A><H3> touch</H3> <PRE> public static void <B>touch</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file) 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> <DL> <DD>Creates an empty file or updates the last updated timestamp on the same as the unix command of the same name. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to create or update <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="move(java.io.File, java.io.File)"><!-- --></A><H3> move</H3> <PRE> public static void <B>move</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> from, <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> to) 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> <DL> <DD>Moves the file from one path to another. This method can rename a file or move it to a different directory, like the Unix <code>mv</code> command. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>from</CODE> - the source file<DD><CODE>to</CODE> - the destination file <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="deleteDirectoryContents(java.io.File)"><!-- --></A><H3> deleteDirectoryContents</H3> <PRE> public static void <B>deleteDirectoryContents</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> directory) 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> <DL> <DD>Deletes all the files within a directory. Does not delete the directory itself. <p>If the file argument is a symbolic link or there is a symbolic link in the path leading to the directory, this method will do nothing. Symbolic links within the directory are not followed. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>directory</CODE> - the directory to delete the contents of <DT><B>Throws:</B> <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 the argument is not a directory <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<DT><B>See Also:</B><DD><A HREF="../../../../com/google/common/io/Files.html#deleteRecursively(java.io.File)"><CODE>deleteRecursively(java.io.File)</CODE></A></DL> </DD> </DL> <HR> <A NAME="deleteRecursively(java.io.File)"><!-- --></A><H3> deleteRecursively</H3> <PRE> public static void <B>deleteRecursively</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file) 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> <DL> <DD>Deletes a file or directory and all contents recursively. <p>If the file argument is a symbolic link the link will be deleted but not the target of the link. If the argument is a directory, symbolic links within the directory will not be followed. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to delete <DT><B>Throws:</B> <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<DT><B>See Also:</B><DD><A HREF="../../../../com/google/common/io/Files.html#deleteDirectoryContents(java.io.File)"><CODE>deleteDirectoryContents(java.io.File)</CODE></A></DL> </DD> </DL> <HR> <A NAME="readFirstLine(java.io.File, java.nio.charset.Charset)"><!-- --></A><H3> readFirstLine</H3> <PRE> 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>readFirstLine</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <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> charset) 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> <DL> <DD>Reads the first line from a file. The line does not include line-termination characters, but does include other leading and trailing whitespace. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to read from<DD><CODE>charset</CODE> - the character set used when writing the file <DT><B>Returns:</B><DD>the first line, or null if the file is empty <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="readLines(java.io.File, java.nio.charset.Charset)"><!-- --></A><H3> readLines</H3> <PRE> 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><<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>readLines</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <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> charset) 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> <DL> <DD>Reads all of the lines from a file. The lines do not include line-termination characters, but do include other leading and trailing whitespace. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to read from<DD><CODE>charset</CODE> - the character set used when writing the file <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 <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="readLines(java.io.File, java.nio.charset.Charset, com.google.common.io.LineProcessor)"><!-- --></A><H3> readLines</H3> <PRE> public static <T> T <B>readLines</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <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> charset, <A HREF="../../../../com/google/common/io/LineProcessor.html" title="interface in com.google.common.io">LineProcessor</A><T> callback) 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> <DL> <DD>Streams lines from a <A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io"><CODE>File</CODE></A>, stopping when our callback returns false, or we have read all of the lines. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to read from<DD><CODE>charset</CODE> - the character set used when writing the file<DD><CODE>callback</CODE> - the <A HREF="../../../../com/google/common/io/LineProcessor.html" title="interface in com.google.common.io"><CODE>LineProcessor</CODE></A> to use to handle the lines <DT><B>Returns:</B><DD>the output of processing the lines <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="readBytes(java.io.File, com.google.common.io.ByteProcessor)"><!-- --></A><H3> readBytes</H3> <PRE> public static <T> T <B>readBytes</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <A HREF="../../../../com/google/common/io/ByteProcessor.html" title="interface in com.google.common.io">ByteProcessor</A><T> processor) 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> <DL> <DD>Process the bytes of a file. <p>(If this seems too complicated, maybe you're looking for <A HREF="../../../../com/google/common/io/Files.html#toByteArray(java.io.File)"><CODE>toByteArray(java.io.File)</CODE></A>.) <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to read<DD><CODE>processor</CODE> - the object to which the bytes of the file are passed. <DT><B>Returns:</B><DD>the result of the byte processor <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="getChecksum(java.io.File, java.util.zip.Checksum)"><!-- --></A><H3> getChecksum</H3> <PRE> public static long <B>getChecksum</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <A HREF="http://java.sun.com/javase/6/docs/api/java/util/zip/Checksum.html?is-external=true" title="class or interface in java.util.zip">Checksum</A> checksum) 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> <DL> <DD>Computes and returns the checksum value for a file. The checksum object is reset when this method returns successfully. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to read<DD><CODE>checksum</CODE> - the checksum object <DT><B>Returns:</B><DD>the result of <A HREF="http://java.sun.com/javase/6/docs/api/java/util/zip/Checksum.html?is-external=true#getValue()" title="class or interface in java.util.zip"><CODE>Checksum.getValue()</CODE></A> after updating the checksum object with all of the bytes in the file <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="getDigest(java.io.File, java.security.MessageDigest)"><!-- --></A><H3> getDigest</H3> <PRE> public static byte[] <B>getDigest</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <A HREF="http://java.sun.com/javase/6/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security">MessageDigest</A> md) 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> <DL> <DD>Computes and returns the digest value for a file. The digest object is reset when this method returns successfully. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to read<DD><CODE>md</CODE> - the digest object <DT><B>Returns:</B><DD>the result of <A HREF="http://java.sun.com/javase/6/docs/api/java/security/MessageDigest.html?is-external=true#digest()" title="class or interface in java.security"><CODE>MessageDigest.digest()</CODE></A> after updating the digest object with all of the bytes in this file <DT><B>Throws:</B> <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> </DD> </DL> <HR> <A NAME="map(java.io.File)"><!-- --></A><H3> map</H3> <PRE> public static <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/MappedByteBuffer.html?is-external=true" title="class or interface in java.nio">MappedByteBuffer</A> <B>map</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file) 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> <DL> <DD>Fully maps a file read-only in to memory as per <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.html?is-external=true#map(java.nio.channels.FileChannel.MapMode, long, long)" title="class or interface in java.nio.channels"><CODE>FileChannel.map(java.nio.channels.FileChannel.MapMode, long, long)</CODE></A>. <p>Files are mapped from offset 0 to its length. <p>This only works for files <= <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Integer.html?is-external=true#MAX_VALUE" title="class or interface in java.lang"><CODE>Integer.MAX_VALUE</CODE></A> bytes. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to map <DT><B>Returns:</B><DD>a read-only buffer reflecting <code>file</code> <DT><B>Throws:</B> <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileNotFoundException.html?is-external=true" title="class or interface in java.io">FileNotFoundException</A></CODE> - if the <code>file</code> does not exist <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<DT><B>Since:</B></DT> <DD>2010.01.04 <b>tentative</b></DD> <DT><B>See Also:</B><DD><A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.html?is-external=true#map(java.nio.channels.FileChannel.MapMode, long, long)" title="class or interface in java.nio.channels"><CODE>FileChannel.map(MapMode, long, long)</CODE></A></DL> </DD> </DL> <HR> <A NAME="map(java.io.File, java.nio.channels.FileChannel.MapMode)"><!-- --></A><H3> map</H3> <PRE> public static <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/MappedByteBuffer.html?is-external=true" title="class or interface in java.nio">MappedByteBuffer</A> <B>map</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.MapMode.html?is-external=true" title="class or interface in java.nio.channels">FileChannel.MapMode</A> mode) 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> <DL> <DD>Fully maps a file in to memory as per <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.html?is-external=true#map(java.nio.channels.FileChannel.MapMode, long, long)" title="class or interface in java.nio.channels"><CODE>FileChannel.map(java.nio.channels.FileChannel.MapMode, long, long)</CODE></A> using the requested <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.MapMode.html?is-external=true" title="class or interface in java.nio.channels"><CODE>FileChannel.MapMode</CODE></A>. <p>Files are mapped from offset 0 to its length. <p>This only works for files <= <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Integer.html?is-external=true#MAX_VALUE" title="class or interface in java.lang"><CODE>Integer.MAX_VALUE</CODE></A> bytes. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to map<DD><CODE>mode</CODE> - the mode to use when mapping <code>file</code> <DT><B>Returns:</B><DD>a buffer reflecting <code>file</code> <DT><B>Throws:</B> <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileNotFoundException.html?is-external=true" title="class or interface in java.io">FileNotFoundException</A></CODE> - if the <code>file</code> does not exist <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<DT><B>Since:</B></DT> <DD>2010.01.04 <b>tentative</b></DD> <DT><B>See Also:</B><DD><A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.html?is-external=true#map(java.nio.channels.FileChannel.MapMode, long, long)" title="class or interface in java.nio.channels"><CODE>FileChannel.map(MapMode, long, long)</CODE></A></DL> </DD> </DL> <HR> <A NAME="map(java.io.File, java.nio.channels.FileChannel.MapMode, long)"><!-- --></A><H3> map</H3> <PRE> public static <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/MappedByteBuffer.html?is-external=true" title="class or interface in java.nio">MappedByteBuffer</A> <B>map</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</A> file, <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.MapMode.html?is-external=true" title="class or interface in java.nio.channels">FileChannel.MapMode</A> mode, long size) throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileNotFoundException.html?is-external=true" title="class or interface in java.io">FileNotFoundException</A>, <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> <DL> <DD>Maps a file in to memory as per <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.html?is-external=true#map(java.nio.channels.FileChannel.MapMode, long, long)" title="class or interface in java.nio.channels"><CODE>FileChannel.map(java.nio.channels.FileChannel.MapMode, long, long)</CODE></A> using the requested <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.MapMode.html?is-external=true" title="class or interface in java.nio.channels"><CODE>FileChannel.MapMode</CODE></A>. <p>Files are mapped from offset 0 to <code>size</code>. <p>If the mode is <A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.MapMode.html?is-external=true#READ_WRITE" title="class or interface in java.nio.channels"><CODE>FileChannel.MapMode.READ_WRITE</CODE></A> and the file does not exist, it will be created with the requested <code>size</code>. Thus this method is useful for creating memory mapped files which do not yet exist. <p>This only works for files <= <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Integer.html?is-external=true#MAX_VALUE" title="class or interface in java.lang"><CODE>Integer.MAX_VALUE</CODE></A> bytes. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>file</CODE> - the file to map<DD><CODE>mode</CODE> - the mode to use when mapping <code>file</code> <DT><B>Returns:</B><DD>a buffer reflecting <code>file</code> <DT><B>Throws:</B> <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 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/FileNotFoundException.html?is-external=true" title="class or interface in java.io">FileNotFoundException</A></CODE><DT><B>Since:</B></DT> <DD>2010.01.04 <b>tentative</b></DD> <DT><B>See Also:</B><DD><A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.html?is-external=true#map(java.nio.channels.FileChannel.MapMode, long, long)" title="class or interface in java.nio.channels"><CODE>FileChannel.map(MapMode, long, long)</CODE></A></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> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Files.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../com/google/common/io/FileBackedOutputStream.html" title="class in com.google.common.io"><B>PREV CLASS</B></A> <A HREF="../../../../com/google/common/io/Flushables.html" title="class in com.google.common.io"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?com/google/common/io/Files.html" target="_top"><B>FRAMES</B></A> <A HREF="Files.html" target="_top"><B>NO FRAMES</B></A> <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: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>