Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

1package org.jsoup.helper;
2
3import org.jsoup.nodes.Document;
4import org.jsoup.nodes.Element;
5import org.jsoup.parser.Parser;
6
7import java.io.*;
8import java.nio.ByteBuffer;
9import java.nio.charset.Charset;
10import java.util.regex.Matcher;
11import java.util.regex.Pattern;
12import java.util.Locale;
13
14/**
15 * Internal static utilities for handling data.
16 *
17 */
18public class DataUtil {
19 private static final Pattern charsetPattern = Pattern.compile("(?i)\\bcharset=\\s*\"?([^\\s;\"]*)");
20 static final String defaultCharset = "UTF-8"; // used if not found in header or meta charset
21 private static final int bufferSize = 0x20000; // ~130K.
22
23 private DataUtil() {}
24
25 /**
…lines 26–80 unchanged (55 lines)
81 Element meta = doc.select("meta[http-equiv=content-type], meta[charset]").first();
82 if (meta != null) { // if not found, will keep utf-8 as best attempt
83
84 String foundCharset;
85 if (meta.hasAttr("http-equiv")) {
86 foundCharset = getCharsetFromContentType(meta.attr("content"));
87 } else {
88 foundCharset = meta.attr("charset");
89 }
90
91 if (foundCharset != null && foundCharset.length() != 0 && !foundCharset.equals(defaultCharset)) { // need to re-decode
92 charsetName = foundCharset;
93 byteData.rewind();
94 docData = Charset.forName(foundCharset).decode(byteData).toString();
95 doc = null;
96 }
97 }
98 } else { // specified by content type header (or by user on file load)
…lines 99–154 unchanged (56 lines)
155 */
156 static String getCharsetFromContentType(String contentType) {
157 if (contentType == null) return null;
158 Matcher m = charsetPattern.matcher(contentType);
159 if (m.find()) {
160 String charset = m.group(1).trim();
161 if (Charset.isSupported(charset)) return charset;
162 charset = charset.toUpperCase(Locale.ENGLISH);
163 if (Charset.isSupported(charset)) return charset;
164 // if our advanced charset matching fails.... we just take the default
165 }
166 return null;
167 }
168
169
170}
171

After

1package org.jsoup.helper;
2
3import org.jsoup.nodes.Document;
4import org.jsoup.nodes.Element;
5import org.jsoup.parser.Parser;
6
7import java.io.*;
8import java.nio.ByteBuffer;
9import java.nio.charset.Charset;
10import java.nio.charset.IllegalCharsetNameException;
11import java.util.regex.Matcher;
12import java.util.regex.Pattern;
13import java.util.Locale;
14
15/**
16 * Internal static utilities for handling data.
17 *
18 */
19public class DataUtil {
20 private static final Pattern charsetPattern = Pattern.compile("(?i)\\bcharset=\\s*(?:\"|')?([^\\s,;\"']*)");
21 static final String defaultCharset = "UTF-8"; // used if not found in header or meta charset
22 private static final int bufferSize = 0x20000; // ~130K.
23
24 private DataUtil() {}
25
26 /**
…lines 27–81 unchanged (55 lines)
82 Element meta = doc.select("meta[http-equiv=content-type], meta[charset]").first();
83 if (meta != null) { // if not found, will keep utf-8 as best attempt
84
85 String foundCharset;
86 if (meta.hasAttr("http-equiv")) {
87 foundCharset = getCharsetFromContentType(meta.attr("content"));
88 if (foundCharset == null && meta.hasAttr("charset")) {
89 try {
90 if (Charset.isSupported(meta.attr("charset"))) {
91 foundCharset = meta.attr("charset");
92 }
93 } catch (IllegalCharsetNameException e) {
94 foundCharset = null;
95 }
96 }
97 } else {
98 foundCharset = meta.attr("charset");
99 }
100
101 if (foundCharset != null && foundCharset.length() != 0 && !foundCharset.equals(defaultCharset)) { // need to re-decode
102 foundCharset = foundCharset.trim().replaceAll("[\"']", "");
103 charsetName = foundCharset;
104 byteData.rewind();
105 docData = Charset.forName(foundCharset).decode(byteData).toString();
106 doc = null;
107 }
108 }
…lines 109–165 unchanged (57 lines)
166 */
167 static String getCharsetFromContentType(String contentType) {
168 if (contentType == null) return null;
169 Matcher m = charsetPattern.matcher(contentType);
170 if (m.find()) {
171 String charset = m.group(1).trim();
172 charset = charset.replace("charset=", "");
173 if (charset.isEmpty()) return null;
174 try {
175 if (Charset.isSupported(charset)) return charset;
176 charset = charset.toUpperCase(Locale.ENGLISH);
177 if (Charset.isSupported(charset)) return charset;
178 } catch (IllegalCharsetNameException e) {
179 // if our advanced charset matching fails.... we just take the default
180 return null;
181 }
182 }
183 return null;
184 }
185
186
187}
188

Before

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "helper"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
identifier "Document"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
identifier "Element"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "parser"
. "."
identifier "Parser"
; ";"
import_declaration
import "import"
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
asterisk
* "*"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "nio"
. "."
identifier "ByteBuffer"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "nio"
. "."
identifier "charset"
. "."
identifier "Charset"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "regex"
. "."
identifier "Matcher"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "regex"
. "."
identifier "Pattern"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Locale"
; ";"
block_comment "/**\n * Internal static utilities for handling data.\n *\n */"
class_declaration
modifiers
public "public"
class "class"
identifier "DataUtil"
class_body
{ "{"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "Pattern"
variable_declarator
identifier "charsetPattern"
= "="
method_invocation
identifier "Pattern"
. "."
identifier "compile"
argument_list
( "("
string_literal
" "\""
string_fragment "(?i)"
escape_sequence "\\\\"
string_fragment "bcharset="
escape_sequence "\\\\"
string_fragment "s*"
escape_sequence "\\\""
string_fragment "?([^"
escape_sequence "\\\\"
string_fragment "s;"
escape_sequence "\\\""
string_fragment "]*)"
" "\""
) ")"
; ";"
field_declaration
modifiers
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "defaultCharset"
= "="
string_literal
" "\""
string_fragment "UTF-8"
" "\""
; ";"
line_comment "// used if not found in header or meta charset"
field_declaration
modifiers
private "private"
static "static"
final "final"
integral_type
int "int"
variable_declarator
identifier "bufferSize"
= "="
hex_integer_literal "0x20000"
; ";"
line_comment "// ~130K."
constructor_declaration
modifiers
private "private"
identifier "DataUtil"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
} "}"
block_comment "/**\n * Loads a file to a Document.\n * @param in file"...
method_declaration (+106 nodes collapsed)
block_comment "/**\n * Parses a Document from an input steam.\n * @pa"...
method_declaration (+59 nodes collapsed)
block_comment "/**\n * Parses a Document from an input steam, using the "...
method_declaration (+57 nodes collapsed)
line_comment "// reads bytes first into a buffer, then decodes with the ap"...
line_comment "// switching the chartset midstream when a meta http-equiv t"...
method_declaration
modifiers
static "static"
type_identifier "Document"
identifier "parseByteData"
formal_parameters
( "("
formal_parameter
type_identifier "ByteBuffer"
identifier "byteData"
, ","
formal_parameter
type_identifier "String"
identifier "charsetName"
, ","
formal_parameter
type_identifier "String"
identifier "baseUri"
, ","
formal_parameter
type_identifier "Parser"
identifier "parser"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "docData"
; ";"
local_variable_declaration
type_identifier "Document"
variable_declarator
identifier "doc"
= "="
null_literal "null"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "charsetName"
== "=="
null_literal "null"
) ")"
block
{ "{"
line_comment "// determine from meta. safe parse as UTF-8"
line_comment "// look for <meta http-equiv=\"Content-Type\" content=\"text/ht"...
expression_statement (+26 nodes collapsed)
expression_statement
assignment_expression
identifier "doc"
= "="
method_invocation
identifier "parser"
. "."
identifier "parseInput"
argument_list
( "("
identifier "docData"
, ","
identifier "baseUri"
) ")"
; ";"
local_variable_declaration (+23 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "meta"
!= "!="
null_literal "null"
) ")"
block
{ "{"
line_comment "// if not found, will keep utf-8 as best attempt"
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "foundCharset"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "meta"
. "."
identifier "hasAttr"
argument_list
( "("
string_literal
" "\""
string_fragment "http-equiv"
" "\""
) ")"
) ")"
block
{ "{"
expression_statement (+21 nodes collapsed)
} "}"
else "else"
block
{ "{"
expression_statement
assignment_expression
identifier "foundCharset"
= "="
method_invocation
identifier "meta"
. "."
identifier "attr"
argument_list
( "("
string_literal
" "\""
string_fragment "charset"
" "\""
) ")"
; ";"
} "}"
if_statement
if "if"
parenthesized_expression (+31 nodes collapsed)
block
{ "{"
line_comment "// need to re-decode"
expression_statement
assignment_expression
identifier "charsetName"
= "="
identifier "foundCharset"
; ";"
expression_statement
method_invocation
identifier "byteData"
. "."
identifier "rewind"
argument_list
( "("
) ")"
; ";"
expression_statement (+26 nodes collapsed)
expression_statement
assignment_expression
identifier "doc"
= "="
null_literal "null"
; ";"
} "}"
} "}"
} "}"
else "else"
block (+45 nodes collapsed)
if_statement (+87 nodes collapsed)
return_statement
return "return"
identifier "doc"
; ";"
} "}"
block_comment "/**\n * Read the input stream into a byte buffer.\n * "...
method_declaration (+216 nodes collapsed)
method_declaration (+28 nodes collapsed)
block_comment "/**\n * Parse out a charset from a content type header. I"...
method_declaration
modifiers
static "static"
type_identifier "String"
identifier "getCharsetFromContentType"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "contentType"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "contentType"
== "=="
null_literal "null"
) ")"
return_statement
return "return"
null_literal "null"
; ";"
local_variable_declaration
type_identifier "Matcher"
variable_declarator
identifier "m"
= "="
method_invocation
identifier "charsetPattern"
. "."
identifier "matcher"
argument_list
( "("
identifier "contentType"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "m"
. "."
identifier "find"
argument_list
( "("
) ")"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "charset"
= "="
method_invocation
method_invocation
identifier "m"
. "."
identifier "group"
argument_list
( "("
decimal_integer_literal "1"
) ")"
. "."
identifier "trim"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "Charset"
. "."
identifier "isSupported"
argument_list
( "("
identifier "charset"
) ")"
) ")"
return_statement
return "return"
identifier "charset"
; ";"
expression_statement
assignment_expression
identifier "charset"
= "="
method_invocation
identifier "charset"
. "."
identifier "toUpperCase"
argument_list
( "("
field_access
identifier "Locale"
. "."
identifier "ENGLISH"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "Charset"
. "."
identifier "isSupported"
argument_list
( "("
identifier "charset"
) ")"
) ")"
return_statement
return "return"
identifier "charset"
; ";"
line_comment "// if our advanced charset matching fails.... we just take t"...
} "}"
return_statement
return "return"
null_literal "null"
; ";"
} "}"
} "}"

After

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "helper"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
identifier "Document"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "nodes"
. "."
identifier "Element"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "jsoup"
. "."
identifier "parser"
. "."
identifier "Parser"
; ";"
import_declaration
import "import"
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
asterisk
* "*"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "nio"
. "."
identifier "ByteBuffer"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "nio"
. "."
identifier "charset"
. "."
identifier "Charset"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "nio"
. "."
identifier "charset"
. "."
identifier "IllegalCharsetNameException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "regex"
. "."
identifier "Matcher"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "regex"
. "."
identifier "Pattern"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Locale"
; ";"
block_comment "/**\n * Internal static utilities for handling data.\n *\n */"
class_declaration
modifiers
public "public"
class "class"
identifier "DataUtil"
class_body
{ "{"
field_declaration
modifiers
private "private"
static "static"
final "final"
type_identifier "Pattern"
variable_declarator
identifier "charsetPattern"
= "="
method_invocation
identifier "Pattern"
. "."
identifier "compile"
argument_list
( "("
string_literal
" "\""
string_fragment "(?i)"
escape_sequence "\\\\"
string_fragment "bcharset="
escape_sequence "\\\\"
string_fragment "s*(?:"
escape_sequence "\\\""
string_fragment "|')?([^"
escape_sequence "\\\\"
string_fragment "s,;"
escape_sequence "\\\""
string_fragment "']*)"
" "\""
) ")"
; ";"
field_declaration
modifiers
static "static"
final "final"
type_identifier "String"
variable_declarator
identifier "defaultCharset"
= "="
string_literal
" "\""
string_fragment "UTF-8"
" "\""
; ";"
line_comment "// used if not found in header or meta charset"
field_declaration
modifiers
private "private"
static "static"
final "final"
integral_type
int "int"
variable_declarator
identifier "bufferSize"
= "="
hex_integer_literal "0x20000"
; ";"
line_comment "// ~130K."
constructor_declaration
modifiers
private "private"
identifier "DataUtil"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
} "}"
block_comment "/**\n * Loads a file to a Document.\n * @param in file"...
method_declaration (+106 nodes collapsed)
block_comment "/**\n * Parses a Document from an input steam.\n * @pa"...
method_declaration (+59 nodes collapsed)
block_comment "/**\n * Parses a Document from an input steam, using the "...
method_declaration (+57 nodes collapsed)
line_comment "// reads bytes first into a buffer, then decodes with the ap"...
line_comment "// switching the chartset midstream when a meta http-equiv t"...
method_declaration
modifiers
static "static"
type_identifier "Document"
identifier "parseByteData"
formal_parameters
( "("
formal_parameter
type_identifier "ByteBuffer"
identifier "byteData"
, ","
formal_parameter
type_identifier "String"
identifier "charsetName"
, ","
formal_parameter
type_identifier "String"
identifier "baseUri"
, ","
formal_parameter
type_identifier "Parser"
identifier "parser"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "docData"
; ";"
local_variable_declaration
type_identifier "Document"
variable_declarator
identifier "doc"
= "="
null_literal "null"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "charsetName"
== "=="
null_literal "null"
) ")"
block
{ "{"
line_comment "// determine from meta. safe parse as UTF-8"
line_comment "// look for <meta http-equiv=\"Content-Type\" content=\"text/ht"...
expression_statement (+26 nodes collapsed)
expression_statement
assignment_expression
identifier "doc"
= "="
method_invocation
identifier "parser"
. "."
identifier "parseInput"
argument_list
( "("
identifier "docData"
, ","
identifier "baseUri"
) ")"
; ";"
local_variable_declaration (+23 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "meta"
!= "!="
null_literal "null"
) ")"
block
{ "{"
line_comment "// if not found, will keep utf-8 as best attempt"
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "foundCharset"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "meta"
. "."
identifier "hasAttr"
argument_list
( "("
string_literal
" "\""
string_fragment "http-equiv"
" "\""
) ")"
) ")"
block
{ "{"
expression_statement (+21 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
binary_expression
identifier "foundCharset"
== "=="
null_literal "null"
&& "&&"
method_invocation
identifier "meta"
. "."
identifier "hasAttr"
argument_list
( "("
string_literal
" "\""
string_fragment "charset"
" "\""
) ")"
) ")"
block
{ "{"
try_statement
try "try"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "Charset"
. "."
identifier "isSupported"
argument_list
( "("
method_invocation
identifier "meta"
. "."
identifier "attr"
argument_list
( "("
string_literal
" "\""
string_fragment "charset"
" "\""
) ")"
) ")"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "foundCharset"
= "="
method_invocation
identifier "meta"
. "."
identifier "attr"
argument_list
( "("
string_literal
" "\""
string_fragment "charset"
" "\""
) ")"
; ";"
} "}"
} "}"
catch_clause
catch "catch"
( "("
catch_formal_parameter
catch_type
type_identifier "IllegalCharsetNameException"
identifier "e"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "foundCharset"
= "="
null_literal "null"
; ";"
} "}"
} "}"
} "}"
else "else"
block
{ "{"
expression_statement
assignment_expression
identifier "foundCharset"
= "="
method_invocation
identifier "meta"
. "."
identifier "attr"
argument_list
( "("
string_literal
" "\""
string_fragment "charset"
" "\""
) ")"
; ";"
} "}"
if_statement
if "if"
parenthesized_expression (+31 nodes collapsed)
block
{ "{"
line_comment "// need to re-decode"
expression_statement
assignment_expression
identifier "foundCharset"
= "="
method_invocation
method_invocation
identifier "foundCharset"
. "."
identifier "trim"
argument_list
( "("
) ")"
. "."
identifier "replaceAll"
argument_list
( "("
string_literal
" "\""
string_fragment "["
escape_sequence "\\\""
string_fragment "']"
" "\""
, ","
string_literal
" "\""
" "\""
) ")"
; ";"
expression_statement
assignment_expression
identifier "charsetName"
= "="
identifier "foundCharset"
; ";"
expression_statement
method_invocation
identifier "byteData"
. "."
identifier "rewind"
argument_list
( "("
) ")"
; ";"
expression_statement (+26 nodes collapsed)
expression_statement
assignment_expression
identifier "doc"
= "="
null_literal "null"
; ";"
} "}"
} "}"
} "}"
else "else"
block (+45 nodes collapsed)
if_statement (+87 nodes collapsed)
return_statement
return "return"
identifier "doc"
; ";"
} "}"
block_comment "/**\n * Read the input stream into a byte buffer.\n * "...
method_declaration (+216 nodes collapsed)
method_declaration (+28 nodes collapsed)
block_comment "/**\n * Parse out a charset from a content type header. I"...
method_declaration
modifiers
static "static"
type_identifier "String"
identifier "getCharsetFromContentType"
formal_parameters
( "("
formal_parameter
type_identifier "String"
identifier "contentType"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "contentType"
== "=="
null_literal "null"
) ")"
return_statement
return "return"
null_literal "null"
; ";"
local_variable_declaration
type_identifier "Matcher"
variable_declarator
identifier "m"
= "="
method_invocation
identifier "charsetPattern"
. "."
identifier "matcher"
argument_list
( "("
identifier "contentType"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "m"
. "."
identifier "find"
argument_list
( "("
) ")"
) ")"
block
{ "{"
local_variable_declaration
type_identifier "String"
variable_declarator
identifier "charset"
= "="
method_invocation
method_invocation
identifier "m"
. "."
identifier "group"
argument_list
( "("
decimal_integer_literal "1"
) ")"
. "."
identifier "trim"
argument_list
( "("
) ")"
; ";"
expression_statement
assignment_expression
identifier "charset"
= "="
method_invocation
identifier "charset"
. "."
identifier "replace"
argument_list
( "("
string_literal
" "\""
string_fragment "charset="
" "\""
, ","
string_literal
" "\""
" "\""
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "charset"
. "."
identifier "isEmpty"
argument_list
( "("
) ")"
) ")"
return_statement
return "return"
null_literal "null"
; ";"
try_statement
try "try"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "Charset"
. "."
identifier "isSupported"
argument_list
( "("
identifier "charset"
) ")"
) ")"
return_statement
return "return"
identifier "charset"
; ";"
expression_statement
assignment_expression
identifier "charset"
= "="
method_invocation
identifier "charset"
. "."
identifier "toUpperCase"
argument_list
( "("
field_access
identifier "Locale"
. "."
identifier "ENGLISH"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
method_invocation
identifier "Charset"
. "."
identifier "isSupported"
argument_list
( "("
identifier "charset"
) ")"
) ")"
return_statement
return "return"
identifier "charset"
; ";"
} "}"
catch_clause
catch "catch"
( "("
catch_formal_parameter
catch_type
type_identifier "IllegalCharsetNameException"
identifier "e"
) ")"
block
{ "{"
line_comment "// if our advanced charset matching fails.... we just take t"...
return_statement
return "return"
null_literal "null"
; ";"
} "}"
} "}"
return_statement
return "return"
null_literal "null"
; ";"
} "}"
} "}"