shankii
asked on
File name from file descriptor
Can I get the file name from file descriptor using reflection.
Thanks
Thanks
Do you mean java.io.FileDescriptor?
From the javadoc:
"Applications should not create their own file descriptors."
If you mean, can you get the name of a .class file that contains the code you are examining by reflection, then get the name of the Constructor and add ".class" to it.
From the javadoc:
"Applications should not create their own file descriptors."
If you mean, can you get the name of a .class file that contains the code you are examining by reflection, then get the name of the Constructor and add ".class" to it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi objects,
I was trying not to be so blunt with my first point ;-)
I was trying not to be so blunt with my first point ;-)
ASKER
Hi
What I meant is :
FileInputStream fis = new FileInputStream(filename);
fileDescriptor fd = fis.getFD();
I want to get the file name from this fd.
What I meant is :
FileInputStream fis = new FileInputStream(filename);
fileDescriptor fd = fis.getFD();
I want to get the file name from this fd.
I know what you meant :) The FileDescriptor instance knows nothing about the name of the file
Why would you want to do that? Why not just store filename?
Certainly a File object has a method (getName) which returns its name.