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
FieldsModifier and TypeFieldDescription(package private) static final HostsFileEntriesProvider.ParserImplprivate static final InternalLoggerprivate static final java.util.regex.Patternprivate static final java.lang.Stringprivate static final java.lang.Stringprivate static final java.lang.String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static java.io.Fileparse()Parses the hosts file at standard OS location using the system defaultCharsetfor decoding.parse(java.io.File file, java.nio.charset.Charset... charsets) Parses the provided hosts file using the givenCharsets one after another until parse something or none is left.parse(java.io.Reader reader) Performs the parsing operation using the provided reader of hosts file format.parse(java.nio.charset.Charset... charsets) Parses the hosts file at standard OS location using the givenCharsets one after another until parse something or none is left.Parses the hosts file at standard OS location using the system defaultCharsetfor decoding.parseSilently(java.io.File file, java.nio.charset.Charset... charsets) Parses the provided hosts file using the givenCharsets one after another until parse something or none is left.parseSilently(java.nio.charset.Charset... charsets) Parses the hosts file at standard OS location using the givenCharsets one after another until parse something or none is left.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
WINDOWS_DEFAULT_SYSTEM_ROOT
private static final java.lang.String WINDOWS_DEFAULT_SYSTEM_ROOT- See Also:
-
WINDOWS_HOSTS_FILE_RELATIVE_PATH
private static final java.lang.String WINDOWS_HOSTS_FILE_RELATIVE_PATH- See Also:
-
X_PLATFORMS_HOSTS_FILE_PATH
private static final java.lang.String X_PLATFORMS_HOSTS_FILE_PATH- See Also:
-
WHITESPACES
private static final java.util.regex.Pattern WHITESPACES -
logger
-
INSTANCE
-
-
Constructor Details
-
ParserImpl
private ParserImpl()
-
-
Method Details
-
parse
Description copied from interface:HostsFileEntriesProvider.ParserParses the hosts file at standard OS location using the system defaultCharsetfor decoding.- Specified by:
parsein 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.ParserParses the hosts file at standard OS location using the givenCharsets one after another until parse something or none is left.- Specified by:
parsein interfaceHostsFileEntriesProvider.Parser- Parameters:
charsets- theCharsets 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.ParserParses the provided hosts file using the givenCharsets one after another until parse something or none is left. In caseCharsets are not provided, the system defaultCharsetis used for decoding.- Specified by:
parsein interfaceHostsFileEntriesProvider.Parser- Parameters:
file- the file to be parsedcharsets- theCharsets to try as file encodings when parsing, in caseCharsets are not provided, the system defaultCharsetis used for decoding- Returns:
- a new
HostsFileEntriesProvider - Throws:
java.io.IOException- file could not be read
-
parse
Description copied from interface:HostsFileEntriesProvider.ParserPerforms the parsing operation using the provided reader of hosts file format.- Specified by:
parsein interfaceHostsFileEntriesProvider.Parser- Parameters:
reader- the reader of hosts file format- Returns:
- a new
HostsFileEntriesProvider - Throws:
java.io.IOException
-
parseSilently
Description copied from interface:HostsFileEntriesProvider.ParserParses the hosts file at standard OS location using the system defaultCharsetfor decoding.- Specified by:
parseSilentlyin interfaceHostsFileEntriesProvider.Parser- Returns:
- a new
HostsFileEntriesProvider
-
parseSilently
Description copied from interface:HostsFileEntriesProvider.ParserParses the hosts file at standard OS location using the givenCharsets one after another until parse something or none is left.- Specified by:
parseSilentlyin interfaceHostsFileEntriesProvider.Parser- Parameters:
charsets- theCharsets 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.ParserParses the provided hosts file using the givenCharsets one after another until parse something or none is left. In caseCharsets are not provided, the system defaultCharsetis used for decoding.- Specified by:
parseSilentlyin interfaceHostsFileEntriesProvider.Parser- Parameters:
file- the file to be parsedcharsets- theCharsets to try as file encodings when parsing, in caseCharsets are not provided, the system defaultCharsetis used for decoding- Returns:
- a new
HostsFileEntriesProvider
-
locateHostsFile
private static java.io.File locateHostsFile()
-