Tries to determine the type of an input stream based on the characters at the beginning of the input stream. This method can be used by subclasses that override the
getContentType
method.
Ideally, this routine would not be needed. But many http
servers return the incorrect content type; in addition, there are many nonstandard extensions. Direct inspection of the bytes to determine the content type is often more accurate than believing the content type claimed by the http
server.
@param is an input stream that supports marks.
@return a guess at the content type, or null
if nonecan be determined.
@exception IOException if an I/O error occurs while reading theinput stream.
@see java.io.InputStream#mark(int)
@see java.io.InputStream#markSupported()
@see java.net.URLConnection#getContentType()