Class HostsFileParser
java.lang.Object
io.netty.resolver.HostsFileParser
A parser for hosts files.
The produced mappings contain only the first entry per hostname.
Consider using
HostsFileEntriesProvider when mappings with all entries per hostname are needed.-
Method Summary
Modifier and TypeMethodDescriptionstatic HostsFileEntriesparse()Parse hosts file at standard OS location using the system defaultCharsetfor decoding.static HostsFileEntriesParse a hosts file using the system defaultCharsetfor decoding.static HostsFileEntriesParse a hosts file.static HostsFileEntriesParse a reader of hosts file format.static HostsFileEntriesParse hosts file at standard OS location using the systems defaultCharsetfor decoding.static HostsFileEntriesparseSilently(Charset... charsets) Parse hosts file at standard OS location using the givenCharsets one after each other until we were able to parse something or none is left.
-
Method Details
-
parseSilently
Parse hosts file at standard OS location using the systems defaultCharsetfor decoding.- Returns:
- a
HostsFileEntries
-
parseSilently
Parse hosts file at standard OS location using the givenCharsets one after each other until we were able to parse something or none is left.- Parameters:
charsets- theCharsets to try as file encodings when parsing.- Returns:
- a
HostsFileEntries
-
parse
Parse hosts file at standard OS location using the system defaultCharsetfor decoding.- Returns:
- a
HostsFileEntries - Throws:
IOException- file could not be read
-
parse
Parse a hosts file using the system defaultCharsetfor decoding.- Parameters:
file- the file to be parsed- Returns:
- a
HostsFileEntries - Throws:
IOException- file could not be read
-
parse
Parse a hosts file.- Parameters:
file- the file to be parsedcharsets- theCharsets to try as file encodings when parsing.- Returns:
- a
HostsFileEntries - Throws:
IOException- file could not be read
-
parse
Parse a reader of hosts file format.- Parameters:
reader- the file to be parsed- Returns:
- a
HostsFileEntries - Throws:
IOException- file could not be read
-