closeable

Should Closeable be used as the Java equivalent for .NET's IDisposable?

The Closeable interface introduced in Java 1.5 is tightly tied to streams, and even has an exception specifier for IOException. This suggests that it should only be used for streams or other IO related activities, rather than general purpose cleanup logic. Certainly the description for the close() method would make absolutely no sense o...

Java resource management: please help to understand Findbugs results.

Hello, everyone! Findbugs bugs me about a method which opens two Closeable instances, but I can't understand why. Source public static void sourceXmlToBeautifiedXml(File input, File output) throws TransformerException, IOException, JAXBException { FileReader fileReader = new FileReader(input); FileWriter fileWriter = ...

Java: What sense could it make not to close an InputStream after it ended?

InputStream implements Closeable. I understand, that closing an InputStream which not ended yet, could make sense to free some underlying resources, and, leaving it open, could make sense to let other methods continue to read from it. But, what sense could it have not to close an InputStream after it ended? And if it doesn't make sense...