Package com.wen;
Import java.io. *;
/ ** * Provide IO operation tool class * @version 1.0 * @Author experar * / public final class streamutil {/ ** * copy the input stream to the output stream * @Param is * @Param OS * @Throws oException * / public final static void write (InputStream is, OutputStream os) throws IOException {BufferedInputStream bis = new BufferedInputStream (is, 1024); int c = bis.read (); while (! c = -1) {os.write (c) ; C = bis.read ();} Os.flush ();
/ ** * input stream specified transfer encoding a string * @param is * @param encoding * @return * @throws IOException * / public final static String toString (InputStream is, String encoding) throws IOException {ByteArrayOutputStream bos = New ByteArrayOutputStream (); Write (IS, BOS); if (Encoding == Null) {Return New String (bos.tobyteaRray ());} else {return new string (bos.tobyteaRray (), eNCoding;
}
/ ** * Press the default encoded to string * @param is * @return * @Throws @ ket @Throws ooException * / public final static string toString (InputStream IS) throws ooException {Return Tostring (IS, null);}
/ ** * Close the input stream, ignore the exception * @Param is * / public final static void closequitely (IOExce ()}} catch (ooException e) {is.close ()}} catch }
}
/ ** * Close the output stream, ignore the exception * @Param OS * / public final static void closequitely (OutputStream OS) {Try {if (os! = Null) {os.close ();}} catch (ooException e) { }