Is there any way to programmatically differentiate between what caused an IOException? For example Java will throw an IOException, if there was an error during writing. How can I tell, if it's something like access violation, if the Disk is out of free space, if someone disconnected the the network drive, or other things?
I can't really parse the Message since, there does not seem to be any standardized message format, Sun (or Oracle now I guess) doesn't seem to have any sort of standardized format.
(I need to use Java to fix a very broken system at work.)
Unfortunately Java has no equivalent of .NET's System.Runtime.InteropServices.Marshal.GetHRForException()
. You tell what kind of I/O error it was only if the exception is an instance of a subclass, e.g. FileNotFoundException
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With