Is java – bytearrayoutputstream secure without flush() and close()?
•
Java
So, will bytearrayoutputstream cause memory overflow if it is not refreshed and closed correctly? I mean, is it necessary for them to put code into Java or garbage collect it?
Solution
No, it collects garbage after the last reference is lost
Press Javadoc:
In addition, if you look at the code, both refresh and close are no operations in the bytearrayoutputstream class (although flush inherits from OutputStream, it is no operation in OutputStream unless overridden in a specific implementation)
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
二维码