Get file name from FileOutputStream

Ebbu Abraham picture Ebbu Abraham · Feb 8, 2011 · Viewed 49.1k times · Source

Is there a way to get the file name from a FileOutputStream or from FileInputStream?

Answer

Tom G picture Tom G · Feb 8, 2011

Looks like the answer is no:
http://download.oracle.com/javase/1.4.2/docs/api/java/io/FileOutputStream.html
http://docs.oracle.com/javase/7/docs/api/index.html?java/io/FileOutputStream.html

There are no public methods that return the File or String used in construction of the stream.

EDIT: The same holds for FileInputStream.