public class CloseUtil extends Object
IO流关闭工具
该工具主要目的是优雅地关闭掉各种IO流,从而屏蔽掉因为关闭IO时强制异常捕获代码造成代码优雅性的降低该工具是一个线程安全类的工具
Constructor and Description |
---|
CloseUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
close(Closeable... closeables)
批量关闭IO流
|
static void |
close(InputStream inputStream)
关闭输入流
|
static void |
close(OutputStream outputStream)
关闭输出流
|
static void |
close(Reader reader)
关闭一个字符流读取器
|
static void |
close(Writer writer)
关闭一个字符流写入器
|
public static void close(Closeable... closeables)
closeables
- 需要关闭的IO流public static void close(InputStream inputStream)
inputStream
- 输入流public static void close(OutputStream outputStream)
outputStream
- 输出流public static void close(Reader reader)
reader
- 字符流读取器public static void close(Writer writer)
writer
- 字符流写入器Copyright © 2021. All rights reserved.