ioutils.html

来自「网络爬虫开源代码」· HTML 代码 · 共 631 行 · 第 1/2 页

HTML
631
字号
IoUtils</H3><PRE>public <B>IoUtils</B>()</PRE><DL></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Method Detail</B></FONT></TH></TR></TABLE><A NAME="getClasspathPath(java.io.File)"><!-- --></A><H3>getClasspathPath</H3><PRE>public static java.lang.String <B>getClasspathPath</B>(java.io.File&nbsp;file)</PRE><DL><DD><DL><DT><B>Parameters:</B><DD><CODE>file</CODE> - File to operate on.<DT><B>Returns:</B><DD>Path suitable for use getting resources off the CLASSPATH (CLASSPATH resources always use '/' as path separator, even on windows).</DL></DD></DL><HR><A NAME="ensureWriteableDirectory(java.lang.String)"><!-- --></A><H3>ensureWriteableDirectory</H3><PRE>public static java.io.File <B>ensureWriteableDirectory</B>(java.lang.String&nbsp;dir)                                             throws java.io.IOException</PRE><DL><DD>Ensure writeable directory. If doesn't exist, we attempt creation.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>dir</CODE> - Directory to test for exitence and is writeable.<DT><B>Returns:</B><DD>The passed <code>dir</code>.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - If passed directory does not exist and is not createable, or directory is not writeable or is not a directory.</DL></DD></DL><HR><A NAME="ensureWriteableDirectory(java.util.List)"><!-- --></A><H3>ensureWriteableDirectory</H3><PRE>public static java.util.List <B>ensureWriteableDirectory</B>(java.util.List&lt;java.io.File&gt;&nbsp;dirs)                                               throws java.io.IOException</PRE><DL><DD>Ensure writeable directories. If doesn't exist, we attempt creation.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>dirs</CODE> - List of Files to test.<DT><B>Returns:</B><DD>The passed <code>dirs</code>.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - If passed directory does not exist and is not createable, or directory is not writeable or is not a directory.</DL></DD></DL><HR><A NAME="ensureWriteableDirectory(java.io.File)"><!-- --></A><H3>ensureWriteableDirectory</H3><PRE>public static java.io.File <B>ensureWriteableDirectory</B>(java.io.File&nbsp;dir)                                             throws java.io.IOException</PRE><DL><DD>Ensure writeable directory. If doesn't exist, we attempt creation.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>dir</CODE> - Directory to test for exitence and is writeable.<DT><B>Returns:</B><DD>The passed <code>dir</code>.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - If passed directory does not exist and is not createable, or directory is not writeable or is not a directory.</DL></DD></DL><HR><A NAME="readFullyAsString(java.io.InputStream)"><!-- --></A><H3>readFullyAsString</H3><PRE>public static java.lang.String <B>readFullyAsString</B>(java.io.InputStream&nbsp;inputStream)                                          throws java.io.IOException</PRE><DL><DD>Read the entire stream to EOF, returning what's read as a String.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>inputStream</CODE> - <DT><B>Returns:</B><DD>String of the whole inputStream's contents<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="readFullyToFile(java.io.InputStream, java.io.File)"><!-- --></A><H3>readFullyToFile</H3><PRE>public static void <B>readFullyToFile</B>(java.io.InputStream&nbsp;is,                                   java.io.File&nbsp;toFile)                            throws java.io.IOException</PRE><DL><DD>Read the entire stream to EOF into the passed file.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>is</CODE> - <DD><CODE>toFile</CODE> - File to read into .<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="readFullyToFile(java.io.InputStream, java.io.File, byte[])"><!-- --></A><H3>readFullyToFile</H3><PRE>public static long <B>readFullyToFile</B>(java.io.InputStream&nbsp;is,                                   java.io.File&nbsp;toFile,                                   byte[]&nbsp;buffer)                            throws java.io.IOException</PRE><DL><DD>Read the entire stream to EOF into the passed file. Closes <code>is</code> when done or if an exception.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>is</CODE> - Stream to read.<DD><CODE>toFile</CODE> - File to read into .<DD><CODE>buffer</CODE> - Buffer to use reading.<DT><B>Returns:</B><DD>Count of bytes read.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="wrapAsIOException(java.lang.Throwable)"><!-- --></A><H3>wrapAsIOException</H3><PRE>public static java.io.IOException <B>wrapAsIOException</B>(java.lang.Throwable&nbsp;e)</PRE><DL><DD>Wrap generic Throwable as a checked IOException<P><DD><DL><DT><B>Parameters:</B><DD><CODE>e</CODE> - wrapped exception<DT><B>Returns:</B><DD>IOException</DL></DD></DL><HR><A NAME="readFully(java.io.InputStream, byte[])"><!-- --></A><H3>readFully</H3><PRE>public static void <B>readFully</B>(java.io.InputStream&nbsp;input,                             byte[]&nbsp;buf)                      throws java.io.IOException</PRE><DL><DD><DL><DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="encodingMaxBytesPerChar(java.lang.String)"><!-- --></A><H3>encodingMaxBytesPerChar</H3><PRE>public static float <B>encodingMaxBytesPerChar</B>(java.lang.String&nbsp;encoding)</PRE><DL><DD>Return the maximum number of bytes per character in the named encoding, or 0 if encoding is invalid or unsupported.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>encoding</CODE> - Encoding to consider.  For now, should be java  canonical name for the encoding.<DT><B>Returns:</B><DD>True if multibyte encoding.</DL></DD></DL><HR><A NAME="serializeToFile(java.lang.Object, java.io.File)"><!-- --></A><H3>serializeToFile</H3><PRE>public static void <B>serializeToFile</B>(java.lang.Object&nbsp;object,                                   java.io.File&nbsp;file)                            throws java.io.IOException</PRE><DL><DD>Utility method to serialize an object to the given File.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>object</CODE> - Object to serialize<DD><CODE>file</CODE> - File to receive serialized copy<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="deserializeFromFile(java.io.File)"><!-- --></A><H3>deserializeFromFile</H3><PRE>public static java.lang.Object <B>deserializeFromFile</B>(java.io.File&nbsp;file)                                            throws java.io.IOException</PRE><DL><DD>Utility method to deserialize an Object from given File.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>file</CODE> - File source<DT><B>Returns:</B><DD>deserialized Object<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE></DL></DD></DL><HR><A NAME="serializeToByteArray(java.lang.Object)"><!-- --></A><H3>serializeToByteArray</H3><PRE>public static byte[] <B>serializeToByteArray</B>(java.lang.Object&nbsp;object)</PRE><DL><DD>Utility method to serialize Object to byte[].<P><DD><DL><DT><B>Parameters:</B><DD><CODE>object</CODE> - Object to be serialized<DT><B>Returns:</B><DD>byte[] serialized form</DL></DD></DL><HR><A NAME="deserializeFromByteArray(byte[])"><!-- --></A><H3>deserializeFromByteArray</H3><PRE>public static java.lang.Object <B>deserializeFromByteArray</B>(byte[]&nbsp;in)</PRE><DL><DD>Utility method to deserialize Object from  byte[].<P><DD><DL><DT><B>Parameters:</B><DD><CODE>in</CODE> - byte[] source<DT><B>Returns:</B><DD>Object deserialized</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/IoUtils.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/Inverter.html" title="class in org.archive.util"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../../org/archive/util/JavaLiterals.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/IoUtils.html" target="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="IoUtils.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;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR>Copyright &copy; 2003-2007 Internet Archive. All Rights Reserved.</BODY></HTML>

⌨️ 快捷键说明

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