Search code examples
javaiofileoutputstream

Get file name from FileOutputStream


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


Solution

  • 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.