您是否需要明确关闭Java KeyStore输入流?

当使用FileInputStream在KeyStore中读取如下时,是否需要显式关闭input-steam以停止浪费系统资源?

FileInputStream fin = new FileInputStream("keystore.jks");
KeyStore keystore = KeyStore.getInstance("JKS");
keystore.load(fin,password);

//  Is this line needed ??
fin.close();

此FileInputStream是由load()方法自动关闭还是需要显式手动干预?

解决方法

Is this FileInputStream closed automatically by the load() method or is explicit manually intervention required?

是的,它需要接近结束不必要的泄漏.

KeyStore的java doc中给出的Checkout示例
http://docs.oracle.com/javase/7/docs/api/java/security/KeyStore.html

相关文章

HashMap是Java中最常用的集合类框架,也是Java语言中非常典型...
在EffectiveJava中的第 36条中建议 用 EnumSet 替代位字段,...
介绍 注解是JDK1.5版本开始引入的一个特性,用于对代码进行说...
介绍 LinkedList同时实现了List接口和Deque接口,也就是说它...
介绍 TreeSet和TreeMap在Java里有着相同的实现,前者仅仅是对...
HashMap为什么线程不安全 put的不安全 由于多线程对HashMap进...