@@ -108,31 +108,48 @@ public static Connection newSession() {
108
108
/**
109
109
Parse the contents of a file as HTML.
110
110
111
- @param in file to load HTML from
111
+ @param file file to load HTML from. Supports gzipped files (ending in .z or .gz).
112
112
@param charsetName (optional) character set of file contents. Set to {@code null} to determine from {@code http-equiv} meta tag, if
113
113
present, or fall back to {@code UTF-8} (which is often safe to do).
114
114
@param baseUri The URL where the HTML was retrieved from, to resolve relative links against.
115
115
@return sane HTML
116
116
117
117
@throws IOException if the file could not be found, or read, or if the charsetName is invalid.
118
118
*/
119
- public static Document parse (File in , @ Nullable String charsetName , String baseUri ) throws IOException {
120
- return DataUtil .load (in , charsetName , baseUri );
119
+ public static Document parse (File file , @ Nullable String charsetName , String baseUri ) throws IOException {
120
+ return DataUtil .load (file , charsetName , baseUri );
121
121
}
122
122
123
123
/**
124
124
Parse the contents of a file as HTML. The location of the file is used as the base URI to qualify relative URLs.
125
125
126
- @param in file to load HTML from
126
+ @param file file to load HTML from. Supports gzipped files (ending in .z or .gz).
127
127
@param charsetName (optional) character set of file contents. Set to {@code null} to determine from {@code http-equiv} meta tag, if
128
128
present, or fall back to {@code UTF-8} (which is often safe to do).
129
129
@return sane HTML
130
130
131
131
@throws IOException if the file could not be found, or read, or if the charsetName is invalid.
132
132
@see #parse(File, String, String)
133
133
*/
134
- public static Document parse (File in , @ Nullable String charsetName ) throws IOException {
135
- return DataUtil .load (in , charsetName , in .getAbsolutePath ());
134
+ public static Document parse (File file , @ Nullable String charsetName ) throws IOException {
135
+ return DataUtil .load (file , charsetName , file .getAbsolutePath ());
136
+ }
137
+
138
+ /**
139
+ Parse the contents of a file as HTML.
140
+
141
+ @param file file to load HTML from. Supports gzipped files (ending in .z or .gz).
142
+ @param charsetName (optional) character set of file contents. Set to {@code null} to determine from {@code http-equiv} meta tag, if
143
+ present, or fall back to {@code UTF-8} (which is often safe to do).
144
+ @param baseUri The URL where the HTML was retrieved from, to resolve relative links against.
145
+ @param parser alternate {@link Parser#xmlParser() parser} to use.
146
+ @return sane HTML
147
+
148
+ @throws IOException if the file could not be found, or read, or if the charsetName is invalid.
149
+ @since 1.14.2
150
+ */
151
+ public static Document parse (File file , @ Nullable String charsetName , String baseUri , Parser parser ) throws IOException {
152
+ return DataUtil .load (file , charsetName , baseUri , parser );
136
153
}
137
154
138
155
/**
0 commit comments