JDK1.7 开始使用
关闭流使用try-catch-finally 是jdk1.7 之前的语法
try (FileInputStream fis = new FileInputStream(srcFile)){
			fis.read(fileContent);
			fis.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
                
如何优雅的关闭流
阅读 23
2023-10-02
关闭流使用try-catch-finally 是jdk1.7 之前的语法
try (FileInputStream fis = new FileInputStream(srcFile)){
			fis.read(fileContent);
			fis.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
                
相关推荐
精彩评论(0)