首页 > 编程 > Java > 正文

java关闭流连接IO工具类

2019-11-26 10:09:46
字体:
来源:转载
供稿:网友

本文实例为大家分享了java关闭流连接IO工具类的具体代码,供大家参考,具体内容如下

package com.demo.utils;import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.io.Reader;import java.io.Writer;/** * 关闭流连接IO工具类 * @author dongyangyang * @Date 2016/12/28 23:12 * @Version 1.0 * */public class IOUtils { public static void close(InputStream in) {  if (in != null) {   try {    in.close();   } catch (IOException e) {   }  } } public static void close(OutputStream out){  if (out != null) {   try {    out.close();   } catch (IOException e) {   }  } } public static void close(Reader r) {  if (r != null) {   try {    r.close();   } catch (IOException e) {   }  } } public static void close(Writer w){  if (w != null) {   try {    w.close();   } catch (IOException e) {   }  } }}

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持武林网。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表