• Post Reply Bookmark Topic Watch Topic
  • New Topic

what operation does inputStream.close() does?  RSS feed

 
saran sadaiyappan
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Recently I was coding for streaming a file from a location .I stored the stream as byte array to pass it to the calling method. But I later found tht, even if you pass the stream as such, it works well though u close your stream in the called method.

Does nt closing the stream closes the data? what it does? I went through the java file and found that it was an empty method? Does it has something to do with JVM related stuff?

Answers would be appreciated.
 
Garrett Rowe
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I went through the java file and found that it was an empty method?
In which Java class did you find a close() operation with no implementation? The documentation of the Closeable interface which defines the contract for the close() method reads:


/**
* Closes this stream and releases any system resources associated
* with it. If the stream is already closed then invoking this
* method has no effect.
*
* @throws IOException if an I/O error occurs
*/

[ April 07, 2006: Message edited by: Garrett Rowe ]
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OP was probably looking at the InputStream class which does have an empty close() method but is abstract. Implementing classes will override it if they need to release any resources.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!