Package io.netty.resolver
Class HostsFileEntriesProvider.ParserImpl
- java.lang.Object
-
- io.netty.resolver.HostsFileEntriesProvider.ParserImpl
-
- All Implemented Interfaces:
HostsFileEntriesProvider.Parser
- Enclosing class:
- HostsFileEntriesProvider
private static final class HostsFileEntriesProvider.ParserImpl extends java.lang.Object implements HostsFileEntriesProvider.Parser
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static HostsFileEntriesProvider.ParserImpl
INSTANCE
private static InternalLogger
logger
private static java.util.regex.Pattern
WHITESPACES
private static java.lang.String
WINDOWS_DEFAULT_SYSTEM_ROOT
private static java.lang.String
WINDOWS_HOSTS_FILE_RELATIVE_PATH
private static java.lang.String
X_PLATFORMS_HOSTS_FILE_PATH
-
Constructor Summary
Constructors Modifier Constructor Description private
ParserImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.io.File
locateHostsFile()
HostsFileEntriesProvider
parse()
Parses the hosts file at standard OS location using the system defaultCharset
for decoding.HostsFileEntriesProvider
parse(java.io.File file, java.nio.charset.Charset... charsets)
Parses the provided hosts file using the givenCharset
s one after another until parse something or none is left.HostsFileEntriesProvider
parse(java.io.Reader reader)
Performs the parsing operation using the provided reader of hosts file format.HostsFileEntriesProvider
parse(java.nio.charset.Charset... charsets)
Parses the hosts file at standard OS location using the givenCharset
s one after another until parse something or none is left.HostsFileEntriesProvider
parseSilently()
Parses the hosts file at standard OS location using the system defaultCharset
for decoding.HostsFileEntriesProvider
parseSilently(java.io.File file, java.nio.charset.Charset... charsets)
Parses the provided hosts file using the givenCharset
s one after another until parse something or none is left.HostsFileEntriesProvider
parseSilently(java.nio.charset.Charset... charsets)
Parses the hosts file at standard OS location using the givenCharset
s one after another until parse something or none is left.
-
-
-
Field Detail
-
WINDOWS_DEFAULT_SYSTEM_ROOT
private static final java.lang.String WINDOWS_DEFAULT_SYSTEM_ROOT
- See Also:
- Constant Field Values
-
WINDOWS_HOSTS_FILE_RELATIVE_PATH
private static final java.lang.String WINDOWS_HOSTS_FILE_RELATIVE_PATH
- See Also:
- Constant Field Values
-
X_PLATFORMS_HOSTS_FILE_PATH
private static final java.lang.String X_PLATFORMS_HOSTS_FILE_PATH
- See Also:
- Constant Field Values
-
WHITESPACES
private static final java.util.regex.Pattern WHITESPACES
-
logger
private static final InternalLogger logger
-
INSTANCE
static final HostsFileEntriesProvider.ParserImpl INSTANCE
-
-
Method Detail
-
parse
public HostsFileEntriesProvider parse() throws java.io.IOException
Description copied from interface:HostsFileEntriesProvider.Parser
Parses the hosts file at standard OS location using the system defaultCharset
for decoding.- Specified by:
parse
in interfaceHostsFileEntriesProvider.Parser
- Returns:
- a new
HostsFileEntriesProvider
- Throws:
java.io.IOException
- file could not be read
-
parse
public HostsFileEntriesProvider parse(java.nio.charset.Charset... charsets) throws java.io.IOException
Description copied from interface:HostsFileEntriesProvider.Parser
Parses the hosts file at standard OS location using the givenCharset
s one after another until parse something or none is left.- Specified by:
parse
in interfaceHostsFileEntriesProvider.Parser
- Parameters:
charsets
- theCharset
s to try as file encodings when parsing- Returns:
- a new
HostsFileEntriesProvider
- Throws:
java.io.IOException
- file could not be read
-
parse
public HostsFileEntriesProvider parse(java.io.File file, java.nio.charset.Charset... charsets) throws java.io.IOException
Description copied from interface:HostsFileEntriesProvider.Parser
Parses the provided hosts file using the givenCharset
s one after another until parse something or none is left. In caseCharset
s are not provided, the system defaultCharset
is used for decoding.- Specified by:
parse
in interfaceHostsFileEntriesProvider.Parser
- Parameters:
file
- the file to be parsedcharsets
- theCharset
s to try as file encodings when parsing, in caseCharset
s are not provided, the system defaultCharset
is used for decoding- Returns:
- a new
HostsFileEntriesProvider
- Throws:
java.io.IOException
- file could not be read
-
parse
public HostsFileEntriesProvider parse(java.io.Reader reader) throws java.io.IOException
Description copied from interface:HostsFileEntriesProvider.Parser
Performs the parsing operation using the provided reader of hosts file format.- Specified by:
parse
in interfaceHostsFileEntriesProvider.Parser
- Parameters:
reader
- the reader of hosts file format- Returns:
- a new
HostsFileEntriesProvider
- Throws:
java.io.IOException
-
parseSilently
public HostsFileEntriesProvider parseSilently()
Description copied from interface:HostsFileEntriesProvider.Parser
Parses the hosts file at standard OS location using the system defaultCharset
for decoding.- Specified by:
parseSilently
in interfaceHostsFileEntriesProvider.Parser
- Returns:
- a new
HostsFileEntriesProvider
-
parseSilently
public HostsFileEntriesProvider parseSilently(java.nio.charset.Charset... charsets)
Description copied from interface:HostsFileEntriesProvider.Parser
Parses the hosts file at standard OS location using the givenCharset
s one after another until parse something or none is left.- Specified by:
parseSilently
in interfaceHostsFileEntriesProvider.Parser
- Parameters:
charsets
- theCharset
s to try as file encodings when parsing- Returns:
- a new
HostsFileEntriesProvider
-
parseSilently
public HostsFileEntriesProvider parseSilently(java.io.File file, java.nio.charset.Charset... charsets)
Description copied from interface:HostsFileEntriesProvider.Parser
Parses the provided hosts file using the givenCharset
s one after another until parse something or none is left. In caseCharset
s are not provided, the system defaultCharset
is used for decoding.- Specified by:
parseSilently
in interfaceHostsFileEntriesProvider.Parser
- Parameters:
file
- the file to be parsedcharsets
- theCharset
s to try as file encodings when parsing, in caseCharset
s are not provided, the system defaultCharset
is used for decoding- Returns:
- a new
HostsFileEntriesProvider
-
locateHostsFile
private static java.io.File locateHostsFile()
-
-