Hey. Does anyone know if there is a way to test if a file is open (by another application)? Currently I just get a FileNotFoundException when I try to open a FileInputStream to one. Is there a more suitable Exception, perhaps? Thanks.
posted 16 years ago
Right now in the API's this is the Exception that gets thrown if the file does not exist, or for any reason you can not write to it. Locked, Read Only permissions on the file. If you want, you can in your catch determine what the cause of the exception is. If you want more information, you'll have to create your own Exception classes and then extend FileInputStream to do the assessment and throw the appropriate exception.