Code example for HttpURLConnection

Methods: getContentType

        return conn.getContentLength();
    public String getCharSet() throws IOException {
        String contentType = conn.getContentType();
        // TODO: Parse contentType to get the actual value. 
        String charset = "ISO-8859-1";
        return charset;
    public String[][] getResponseHeaders() throws IOException {
        // TODO Auto-generated method stub 
        return null; 
    public InputStream getResponseStream() throws IOException {
Connect your IDE to all the code out there  Get Codota for Java