3

When debugging, i'd like to, having come across a Writer, be able to tell where it is writing to.

A cursory inspection of the object yields little to work with on the file name/file path front.

Is there some way - either a method i can call on said Writer, or some field that i can inspect - that will let me know which file the Writer writes to?

bharal
  • 15,461
  • 36
  • 117
  • 195
  • ***Related Question:*** [Get file name from FileOutputStream](http://stackoverflow.com/q/4930111/597657) – Eng.Fouad Feb 27 '13 at 18:48

1 Answers1

2

On Linux, if you can dig down to a file descriptor number, you can examine /proc/pid/fd/fdnum to see what file or socket it references.

On Windows, if you can dig down to a file handle, you can use a tool like Sys Internals Process Explorer to trace the handle to a physical file.

On a Darwin/BSD system you would use opensnoop.

Devon_C_Miller
  • 16,248
  • 3
  • 45
  • 71