Do you need to explicitly close the Java keystore input stream?
•
Java
When using FileInputStream to read the following in keystore, do you need to explicitly close the input stream to stop wasting system resources?
FileInputStream fin = new FileInputStream("keystore.jks"); KeyStore keystore = KeyStore.getInstance("JKS"); keystore.load(fin,password); // Is this line needed ?? fin.close();
Is this FileInputStream automatically closed by the load() method or does it require explicit manual intervention?
Solution
Yes, it needs to be close to the end of unnecessary leakage
The checkout example given in the Java DOC of keystore http://docs.oracle.com/javase/7/docs/api/java/security/KeyStore.html
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码