Assuming I am given a URI, and I want to find the file extension of the file that is returned, what do I have to do in Java.
For example the file at http://www.daml.
URLConnection.guessContentTypeFromName(url) would deliver the mime type as in the first answer.
Maybe you simply wanted:
String extension = url.getPath().replaceFirst("^.*/[^/]*(\\.[^\\./]*|)$", "$1");
The regular expression consuming all upto the last slash, then upto a period and either returns an extension like ".owl" or "". (If not mistaken)