⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fileutils.html

📁 用JAVA编写的,在做实验的时候留下来的,本来想删的,但是传上来,大家分享吧
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="copyFiles(java.io.File, java.io.File)"><!-- --></A><H3>copyFiles</H3><PRE>public static void <B>copyFiles</B>(java.io.File&nbsp;src,                             java.io.File&nbsp;dest)                      throws java.io.IOException</PRE><DL><DD>Recursively copy all files from one directory to another.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>src</CODE> - file or directory to copy from.<DD><CODE>dest</CODE> - file or directory to copy to.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="getSortedDirContent(java.io.File, java.io.FilenameFilter)"><!-- --></A><H3>getSortedDirContent</H3><PRE>public static java.lang.String[] <B>getSortedDirContent</B>(java.io.File&nbsp;src,                                                     java.io.FilenameFilter&nbsp;filter)</PRE><DL><DD><DL><DT><B>Parameters:</B><DD><CODE>src</CODE> - Directory of files to fetch.<DD><CODE>filter</CODE> - Filter to apply to filenames.<DT><B>Returns:</B><DD>Files in directory sorted.</DL></DD></DL><HR><A NAME="copyFiles(java.io.File, java.io.FilenameFilter, java.io.File, boolean, boolean)"><!-- --></A><H3>copyFiles</H3><PRE>public static void <B>copyFiles</B>(java.io.File&nbsp;src,                             java.io.FilenameFilter&nbsp;filter,                             java.io.File&nbsp;dest,                             boolean&nbsp;inSortedOrder,                             boolean&nbsp;overwrite)                      throws java.io.IOException</PRE><DL><DD>Recursively copy all files from one directory to another.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>src</CODE> - File or directory to copy from.<DD><CODE>filter</CODE> - Filename filter to apply to src. May be null if no filtering wanted.<DD><CODE>dest</CODE> - File or directory to copy to.<DD><CODE>inSortedOrder</CODE> - Copy in order of natural sort.<DD><CODE>overwrite</CODE> - If target file already exits, and this parameter is true, overwrite target file (We do this by first deleting the target file before we begin the copy).<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="copyFile(java.io.File, java.io.File)"><!-- --></A><H3>copyFile</H3><PRE>public static boolean <B>copyFile</B>(java.io.File&nbsp;src,                               java.io.File&nbsp;dest)                        throws java.io.FileNotFoundException,                               java.io.IOException</PRE><DL><DD>Copy the src file to the destination.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>src</CODE> - <DD><CODE>dest</CODE> - <DT><B>Returns:</B><DD>True if the extent was greater than actual bytes copied.<DT><B>Throws:</B><DD><CODE>java.io.FileNotFoundException</CODE><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="copyFile(java.io.File, java.io.File, boolean)"><!-- --></A><H3>copyFile</H3><PRE>public static boolean <B>copyFile</B>(java.io.File&nbsp;src,                               java.io.File&nbsp;dest,                               boolean&nbsp;overwrite)                        throws java.io.FileNotFoundException,                               java.io.IOException</PRE><DL><DD>Copy the src file to the destination.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>src</CODE> - <DD><CODE>dest</CODE> - <DD><CODE>overwrite</CODE> - If target file already exits, and this parameter is true, overwrite target file (We do this by first deleting the target file before we begin the copy).<DT><B>Returns:</B><DD>True if the extent was greater than actual bytes copied.<DT><B>Throws:</B><DD><CODE>java.io.FileNotFoundException</CODE><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="copyFile(java.io.File, java.io.File, long)"><!-- --></A><H3>copyFile</H3><PRE>public static boolean <B>copyFile</B>(java.io.File&nbsp;src,                               java.io.File&nbsp;dest,                               long&nbsp;extent)                        throws java.io.FileNotFoundException,                               java.io.IOException</PRE><DL><DD>Copy up to extent bytes of the source file to the destination<P><DD><DL><DT><B>Parameters:</B><DD><CODE>src</CODE> - <DD><CODE>dest</CODE> - <DD><CODE>extent</CODE> - Maximum number of bytes to copy<DT><B>Returns:</B><DD>True if the extent was greater than actual bytes copied.<DT><B>Throws:</B><DD><CODE>java.io.FileNotFoundException</CODE><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="copyFile(java.io.File, java.io.File, long, boolean)"><!-- --></A><H3>copyFile</H3><PRE>public static boolean <B>copyFile</B>(java.io.File&nbsp;src,                               java.io.File&nbsp;dest,                               long&nbsp;extent,                               boolean&nbsp;overwrite)                        throws java.io.FileNotFoundException,                               java.io.IOException</PRE><DL><DD>Copy up to extent bytes of the source file to the destination<P><DD><DL><DT><B>Parameters:</B><DD><CODE>src</CODE> - <DD><CODE>dest</CODE> - <DD><CODE>extent</CODE> - Maximum number of bytes to copy<DD><CODE>overwrite</CODE> - If target file already exits, and this parameter is true, overwrite target file (We do this by first deleting the target file before we begin the copy).<DT><B>Returns:</B><DD>True if the extent was greater than actual bytes copied.<DT><B>Throws:</B><DD><CODE>java.io.FileNotFoundException</CODE><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="workaroundCopyFile(java.io.File, java.io.File)"><!-- --></A><H3>workaroundCopyFile</H3><PRE>protected static void <B>workaroundCopyFile</B>(java.io.File&nbsp;src,                                         java.io.File&nbsp;dest)                                  throws java.io.IOException</PRE><DL><DD><DL><DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="deleteDir(java.io.File)"><!-- --></A><H3>deleteDir</H3><PRE>public static boolean <B>deleteDir</B>(java.io.File&nbsp;dir)</PRE><DL><DD>Deletes all files and subdirectories under dir.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>dir</CODE> - <DT><B>Returns:</B><DD>true if all deletions were successful. If a deletion fails, the          method stops attempting to delete and returns false.</DL></DD></DL><HR><A NAME="readFileAsString(java.io.File)"><!-- --></A><H3>readFileAsString</H3><PRE>public static java.lang.String <B>readFileAsString</B>(java.io.File&nbsp;file)                                         throws java.io.IOException</PRE><DL><DD>Utility method to read an entire file as a String.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>file</CODE> - <DT><B>Returns:</B><DD>File as String.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="getFilesWithPrefix(java.io.File, java.lang.String)"><!-- --></A><H3>getFilesWithPrefix</H3><PRE>public static java.io.File[] <B>getFilesWithPrefix</B>(java.io.File&nbsp;dir,                                                java.lang.String&nbsp;prefix)</PRE><DL><DD>Get a list of all files in directory that have passed prefix.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>dir</CODE> - Dir to look in.<DD><CODE>prefix</CODE> - Basename of files to look for. Compare is case insensitive.<DT><B>Returns:</B><DD>List of files in dir that start w/ passed basename.</DL></DD></DL><HR><A NAME="getRegexpFileFilter(java.lang.String)"><!-- --></A><H3>getRegexpFileFilter</H3><PRE>public static java.io.FileFilter <B>getRegexpFileFilter</B>(java.lang.String&nbsp;regexp)</PRE><DL><DD>Get a @link java.io.FileFilter that filters files based on a regular expression.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>regexp</CODE> - the regular expression the files must match.<DT><B>Returns:</B><DD>the newly created filter.</DL></DD></DL><HR><A NAME="syncDirectories(java.io.File, java.io.FilenameFilter, java.io.File)"><!-- --></A><H3>syncDirectories</H3><PRE>public static void <B>syncDirectories</B>(java.io.File&nbsp;src,                                   java.io.FilenameFilter&nbsp;filter,                                   java.io.File&nbsp;tgt)                            throws java.io.IOException</PRE><DL><DD>Use for case where files are being added to src.  Will break off copy when tgt is same as src.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>src</CODE> - Source directory to copy from.<DD><CODE>tgt</CODE> - Target to copy to.<DD><CODE>filter</CODE> - Filter to apply to files to copy.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="isReadable(java.io.File)"><!-- --></A><H3>isReadable</H3><PRE>public static java.io.File <B>isReadable</B>(java.io.File&nbsp;f)                               throws java.io.IOException</PRE><DL><DD>Test file exists and is readable.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>f</CODE> - File to test.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - If file does not exist or is not unreadable.</DL></DD></DL><HR><A NAME="isReadableWithExtensionAndMagic(java.io.File, java.lang.String, java.lang.String)"><!-- --></A><H3>isReadableWithExtensionAndMagic</H3><PRE>public static boolean <B>isReadableWithExtensionAndMagic</B>(java.io.File&nbsp;f,                                                      java.lang.String&nbsp;uncompressedExtension,                                                      java.lang.String&nbsp;magic)                                               throws java.io.IOException</PRE><DL><DD><DL><DT><B>Parameters:</B><DD><CODE>f</CODE> - File to test.<DT><B>Returns:</B><DD>True if file is readable, has uncompressed extension, and magic string at file start.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - If file does not exist or is not readable.</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/FileUtils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../../org/archive/util/DNSJavaUtil.html" title="class in org.archive.util"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../../org/archive/util/Histotable.html" title="class in org.archive.util"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../../index.html?org/archive/util/FileUtils.html" target="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="FileUtils.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;&nbsp;<SCRIPT type="text/javascript">  <!--  if(window==top) {    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');  }  //--></SCRIPT><NOSCRIPT>  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR>Copyright &copy; 2003-2006 Internet Archive. All Rights Reserved.</BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -