Getting the file used by a FileInputStream [duplicate]
问题 This question already has answers here : Get file name from FileOutputStream (5 answers) Closed 3 years ago . Is it possible to obtain the File being used by a FileInputStream ? FileInputStream does not appear to have any methods for retrieving it. 回答1: There are no direct methods in FileInputStream API, but if you really wanted, you can use java reflection API to get the path (actual file name with full path) as shown below: FileInputStream fis = new FileInputStream(inputFile); Field field =