• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to get filename from FileOutputStream?

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic