URLConnection.guessContentTypeFromStream() does not support UTF8 and UTF32 with BOM

Alan Bateman Alan.Bateman at oracle.com
Wed Mar 2 08:48:56 PST 2011


Charles Lee wrote:
> Hi guys,
>
> With test case[1] below, you can see guessContent does not support 
> UTF8/32 BOM. 
I don't see a problem with this proposal but I just wonder if this 
method is even used these days. It is a legacy method and I don't think 
anyone can rely on it to reliably detect any content type. I'm curious 
how you ran into this, was it a test or custom protocol handler that 
overrides getContentType and uses guessContentTypeFromStream as a fallback?

-Alan.



More information about the net-dev mailing list