Package io.netty.resolver
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.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static HostsFileEntries
hostsFileEntries
(HostsFileEntriesProvider provider) static HostsFileEntries
parse()
Parse hosts file at standard OS location using the system defaultCharset
for decoding.static HostsFileEntries
Parse a hosts file using the system defaultCharset
for decoding.static HostsFileEntries
Parse a hosts file.static HostsFileEntries
Parse a reader of hosts file format.static HostsFileEntries
Parse hosts file at standard OS location using the systems defaultCharset
for decoding.static HostsFileEntries
parseSilently
(Charset... charsets) Parse hosts file at standard OS location using the givenCharset
s one after each other until we were able to parse something or none is left.toMapWithSingleValue
(Map<String, List<InetAddress>> fromMapWithListValue)
-
Constructor Details
-
HostsFileParser
private HostsFileParser()Can't be instantiated.
-
-
Method Details
-
parseSilently
Parse hosts file at standard OS location using the systems defaultCharset
for decoding.- Returns:
- a
HostsFileEntries
-
parseSilently
Parse hosts file at standard OS location using the givenCharset
s one after each other until we were able to parse something or none is left.- Parameters:
charsets
- theCharset
s to try as file encodings when parsing.- Returns:
- a
HostsFileEntries
-
parse
Parse hosts file at standard OS location using the system defaultCharset
for decoding.- Returns:
- a
HostsFileEntries
- Throws:
IOException
- file could not be read
-
parse
Parse a hosts file using the system defaultCharset
for 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
- theCharset
s 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
-
hostsFileEntries
-
toMapWithSingleValue
-