• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get filename from FileOutputStream?

 
Mike Hogeboom
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a FileOutputStream and I need to get the location (or just the name of the file) from it.

I see that there are functions:

FileChannel getChannel()
FileDescriptor getFD()

But they don't seem to have the filename either. I would have thought that this is an easy task, but it doesn't seem so.

I need something like myFileOutputStream.getFilename();

Thanks,
Mike
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I can tell, you're stuck since a FileOutputStream doesn't imply the use of a File -- just a FileDescriptor as you saw. And the latter doesn't always point to a disk file.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!