Solved

File name from file descriptor

Posted on 2003-10-31
9
415 Views
Last Modified: 2008-03-06
Can I get the file name from  file descriptor using reflection.

Thanks
0
Comment
Question by:shankii
9 Comments
 
LVL 16

Expert Comment

by:imladris
ID: 9659842
What do you mean by a "file descriptor" exactly?

Certainly a File object has a method (getName) which returns its name.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9660951
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.
0
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
ID: 9661403
You can't.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 15

Expert Comment

by:jimmack
ID: 9661463
Hi objects,

   I was trying not to be so blunt with my first point ;-)
0
 

Author Comment

by:shankii
ID: 9661477
Hi
What I meant is :

  FileInputStream fis = new FileInputStream(filename);
  fileDescriptor fd = fis.getFD();

 I want to get the file name from this fd.

0
 
LVL 92

Expert Comment

by:objects
ID: 9661479
I know what you meant :)  The FileDescriptor instance knows nothing about the name of the file
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9661489
Why would you want to do that?  Why not just store filename?
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now