• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I/O unhandle Streams

 
kajal mukergi
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

There is problem for deleting file from my temperary folder , i keeping file.exists check and then i try to delete.. file.delete
But 100 time i think only 2 or 3 times it deleted

it gives me false as response every time.

but problem is here , when i searched for this solution every one says.. you have close all the streams.. , and some say System.gc() is good solution , for me really it helped
but i don't want to use

Could any one tell me solution or any tool available for see the streams..not for memory leak. please.

TOOL or plugin for eclipse really helpful now i am using

Regards
KVA
 
Rob Spoor
Sheriff
Pie
Posts: 20396
47
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
System.gc() isn't a good option. It may help, but it doesn't take away the cause of the problem.

Usually you put all your streams in a try-finally block, with optional catch blocks. For instance:
No matter what happens inside the try block, the input stream will be closed.
 
kajal mukergi
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I will do that , out of interest i want to know IS THERE ANY TOOL EXISTING FOR SEEING THE OPEN STREAMS
 
Rob Spoor
Sheriff
Pie
Posts: 20396
47
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No need to shout; KeepItDown.

On Windows you can use Process Explorer. It can do a lot more, but finding open "handles" is one of its functionalities. On Linux / UNIX you can try lsof. Both will just say that java.exe has the lock though.
 
kajal mukergi
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friend,

Sorry if the above message is interpreted as "Shout" , I only wanted to highlight it.

It is really sad to hear that we don't have any tool yet.. after these many years of JAVA arrival..

Ok Bad but really sad.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic