Top Description Inners Fields Constructors Methods
io.netty.resolver

public final Class HostsFileEntriesProvider

extends Object
Class Inheritance
Imports
io.netty.util.NetUtil, io.netty.util.internal.PlatformDependent, io.netty.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.io.BufferedReader, .File, .FileInputStream, .IOException, .InputStreamReader, .Reader, java.net.Inet4Address, .InetAddress, java.nio.charset.Charset, java.util.ArrayList, .Collections, .HashMap, .List, .Locale, .Map, java.util.regex.Pattern

A container of hosts file entries

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
private static class

Field Summary

Modifier and TypeField and Description
pack-priv static final HostsFileEntriesProvider
private final Map<String, List<InetAddress>>
private final Map<String, List<InetAddress>>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Map<String, List<InetAddress>>

Returns:

the IPv4 entries
ipv4Entries
()

The IPv4 entries.

public Map<String, List<InetAddress>>

Returns:

the IPv6 entries
ipv6Entries
()

The IPv6 entries.

public static HostsFileEntriesProvider.Parser
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EMPTYback to summary
pack-priv static final HostsFileEntriesProvider EMPTY
ipv4Entriesback to summary
private final Map<String, List<InetAddress>> ipv4Entries
ipv6Entriesback to summary
private final Map<String, List<InetAddress>> ipv6Entries

Constructor Detail

HostsFileEntriesProviderback to summary
pack-priv HostsFileEntriesProvider(Map<String, List<InetAddress>> ipv4Entries, Map<String, List<InetAddress>> ipv6Entries)

Method Detail

ipv4Entriesback to summary
public Map<String, List<InetAddress>> ipv4Entries()

The IPv4 entries.

Returns:Map<String, List<InetAddress>>

the IPv4 entries

ipv6Entriesback to summary
public Map<String, List<InetAddress>> ipv6Entries()

The IPv6 entries.

Returns:Map<String, List<InetAddress>>

the IPv6 entries

parserback to summary
public static HostsFileEntriesProvider.Parser parser()

Creates a parser for HostsFileEntriesProvider.

Returns:HostsFileEntriesProvider.Parser

a new HostsFileEntriesProvider.Parser

io.netty.resolver back to summary

public Interface HostsFileEntriesProvider.Parser

Known Direct Implementers
io.netty.resolver.HostsFileEntriesProvider.ParserImpl

Method Summary

Modifier and TypeMethod and Description
public HostsFileEntriesProvider
parse()

Parses the hosts file at standard OS location using the system default Charset for decoding.

public HostsFileEntriesProvider
parse(Charset...
the Charsets to try as file encodings when parsing
charsets
)

Parses the hosts file at standard OS location using the given Charsets one after another until parse something or none is left.

public HostsFileEntriesProvider
parse(File
the file to be parsed
file
,
Charset...
the Charsets to try as file encodings when parsing, in case Charsets are not provided, the system default Charset is used for decoding
charsets
)

Parses the provided hosts file using the given Charsets one after another until parse something or none is left.

public HostsFileEntriesProvider
parse(Reader
the reader of hosts file format
reader
)

Performs the parsing operation using the provided reader of hosts file format.

public HostsFileEntriesProvider
parseSilently()

Parses the hosts file at standard OS location using the system default Charset for decoding.

public HostsFileEntriesProvider
parseSilently(Charset...
the Charsets to try as file encodings when parsing
charsets
)

Parses the hosts file at standard OS location using the given Charsets one after another until parse something or none is left.

public HostsFileEntriesProvider
parseSilently(File
the file to be parsed
file
,
Charset...
the Charsets to try as file encodings when parsing, in case Charsets are not provided, the system default Charset is used for decoding
charsets
)

Parses the provided hosts file using the given Charsets one after another until parse something or none is left.

Method Detail

parseback to summary
public HostsFileEntriesProvider parse() throws IOException

Parses the hosts file at standard OS location using the system default Charset for decoding.

Returns:HostsFileEntriesProvider

a new HostsFileEntriesProvider

Exceptions
IOException:
file could not be read
parseback to summary
public HostsFileEntriesProvider parse(Charset... charsets) throws IOException

Parses the hosts file at standard OS location using the given Charsets one after another until parse something or none is left.

Parameters
charsets:Charset[]

the Charsets to try as file encodings when parsing

Returns:HostsFileEntriesProvider

a new HostsFileEntriesProvider

Exceptions
IOException:
file could not be read
parseback to summary
public HostsFileEntriesProvider parse(File file, Charset... charsets) throws IOException

Parses the provided hosts file using the given Charsets one after another until parse something or none is left. In case Charsets are not provided, the system default Charset is used for decoding.

Parameters
file:File

the file to be parsed

charsets:Charset[]

the Charsets to try as file encodings when parsing, in case Charsets are not provided, the system default Charset is used for decoding

Returns:HostsFileEntriesProvider

a new HostsFileEntriesProvider

Exceptions
IOException:
file could not be read
parseback to summary
public HostsFileEntriesProvider parse(Reader reader) throws IOException

Performs the parsing operation using the provided reader of hosts file format.

Parameters
reader:Reader

the reader of hosts file format

Returns:HostsFileEntriesProvider

a new HostsFileEntriesProvider

parseSilentlyback to summary
public HostsFileEntriesProvider parseSilently()

Parses the hosts file at standard OS location using the system default Charset for decoding.

Returns:HostsFileEntriesProvider

a new HostsFileEntriesProvider

parseSilentlyback to summary
public HostsFileEntriesProvider parseSilently(Charset... charsets)

Parses the hosts file at standard OS location using the given Charsets one after another until parse something or none is left.

Parameters
charsets:Charset[]

the Charsets to try as file encodings when parsing

Returns:HostsFileEntriesProvider

a new HostsFileEntriesProvider

parseSilentlyback to summary
public HostsFileEntriesProvider parseSilently(File file, Charset... charsets)

Parses the provided hosts file using the given Charsets one after another until parse something or none is left. In case Charsets are not provided, the system default Charset is used for decoding.

Parameters
file:File

the file to be parsed

charsets:Charset[]

the Charsets to try as file encodings when parsing, in case Charsets are not provided, the system default Charset is used for decoding

Returns:HostsFileEntriesProvider

a new HostsFileEntriesProvider

io.netty.resolver back to summary

private final Class HostsFileEntriesProvider.ParserImpl

extends Object
implements Parser
Class Inheritance
All Implemented Interfaces
io.netty.resolver.HostsFileEntriesProvider.Parser

Field Summary

Modifier and TypeField and Description
pack-priv static final HostsFileEntriesProvider.ParserImpl
private static final InternalLogger
private static final Pattern
private static final String
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static File
public HostsFileEntriesProvider
parse()

Implements io.netty.resolver.HostsFileEntriesProvider.Parser.parse.

Parses the hosts file at standard OS location using the system default Charset for decoding.
public HostsFileEntriesProvider
parse(Charset...
the Charsets to try as file encodings when parsing
charsets
)

Implements io.netty.resolver.HostsFileEntriesProvider.Parser.parse.

Parses the hosts file at standard OS location using the given Charsets one after another until parse something or none is left.
public HostsFileEntriesProvider
parse(File
the file to be parsed
file
,
Charset...
the Charsets to try as file encodings when parsing, in case Charsets are not provided, the system default Charset is used for decoding
charsets
)

Implements io.netty.resolver.HostsFileEntriesProvider.Parser.parse.

Parses the provided hosts file using the given Charsets one after another until parse something or none is left.
public HostsFileEntriesProvider
parse(Reader
the reader of hosts file format
reader
)

Implements io.netty.resolver.HostsFileEntriesProvider.Parser.parse.

Performs the parsing operation using the provided reader of hosts file format.
public HostsFileEntriesProvider
parseSilently()

Implements io.netty.resolver.HostsFileEntriesProvider.Parser.parseSilently.

Parses the hosts file at standard OS location using the system default Charset for decoding.
public HostsFileEntriesProvider
parseSilently(Charset...
the Charsets to try as file encodings when parsing
charsets
)

Implements io.netty.resolver.HostsFileEntriesProvider.Parser.parseSilently.

Parses the hosts file at standard OS location using the given Charsets one after another until parse something or none is left.
public HostsFileEntriesProvider
parseSilently(File
the file to be parsed
file
,
Charset...
the Charsets to try as file encodings when parsing, in case Charsets are not provided, the system default Charset is used for decoding
charsets
)

Implements io.netty.resolver.HostsFileEntriesProvider.Parser.parseSilently.

Parses the provided hosts file using the given Charsets one after another until parse something or none is left.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
pack-priv static final HostsFileEntriesProvider.ParserImpl INSTANCE
loggerback to summary
private static final InternalLogger logger
WHITESPACESback to summary
private static final Pattern WHITESPACES
WINDOWS_DEFAULT_SYSTEM_ROOTback to summary
private static final String WINDOWS_DEFAULT_SYSTEM_ROOT
WINDOWS_HOSTS_FILE_RELATIVE_PATHback to summary
private static final String WINDOWS_HOSTS_FILE_RELATIVE_PATH
X_PLATFORMS_HOSTS_FILE_PATHback to summary
private static final String X_PLATFORMS_HOSTS_FILE_PATH

Constructor Detail

ParserImplback to summary
private ParserImpl()

Method Detail

locateHostsFileback to summary
private static File locateHostsFile()
parseback to summary
public HostsFileEntriesProvider parse() throws IOException

Implements io.netty.resolver.HostsFileEntriesProvider.Parser.parse.

Doc from io.netty.resolver.HostsFileEntriesProvider.Parser.parse.

Parses the hosts file at standard OS location using the system default Charset for decoding.

Returns:HostsFileEntriesProvider

a new HostsFileEntriesProvider

Annotations
@Override
Exceptions
IOException:
file could not be read
parseback to summary
public HostsFileEntriesProvider parse(Charset... charsets) throws IOException

Implements io.netty.resolver.HostsFileEntriesProvider.Parser.parse.

Doc from io.netty.resolver.HostsFileEntriesProvider.Parser.parse.

Parses the hosts file at standard OS location using the given Charsets one after another until parse something or none is left.

Parameters
charsets:Charset[]

the Charsets to try as file encodings when parsing

Returns:HostsFileEntriesProvider

a new HostsFileEntriesProvider

Annotations
@Override
Exceptions
IOException:
file could not be read
parseback to summary
public HostsFileEntriesProvider parse(File file, Charset... charsets) throws IOException

Implements io.netty.resolver.HostsFileEntriesProvider.Parser.parse.

Doc from io.netty.resolver.HostsFileEntriesProvider.Parser.parse.

Parses the provided hosts file using the given Charsets one after another until parse something or none is left. In case Charsets are not provided, the system default Charset is used for decoding.

Parameters
file:File

the file to be parsed

charsets:Charset[]

the Charsets to try as file encodings when parsing, in case Charsets are not provided, the system default Charset is used for decoding

Returns:HostsFileEntriesProvider

a new HostsFileEntriesProvider

Annotations
@Override
Exceptions
IOException:
file could not be read
parseback to summary
public HostsFileEntriesProvider parse(Reader reader) throws IOException

Implements io.netty.resolver.HostsFileEntriesProvider.Parser.parse.

Doc from io.netty.resolver.HostsFileEntriesProvider.Parser.parse.

Performs the parsing operation using the provided reader of hosts file format.

Parameters
reader:Reader

the reader of hosts file format

Returns:HostsFileEntriesProvider

a new HostsFileEntriesProvider

Annotations
@Override
parseSilentlyback to summary
public HostsFileEntriesProvider parseSilently()

Implements io.netty.resolver.HostsFileEntriesProvider.Parser.parseSilently.

Doc from io.netty.resolver.HostsFileEntriesProvider.Parser.parseSilently.

Parses the hosts file at standard OS location using the system default Charset for decoding.

Returns:HostsFileEntriesProvider

a new HostsFileEntriesProvider

Annotations
@Override
parseSilentlyback to summary
public HostsFileEntriesProvider parseSilently(Charset... charsets)

Implements io.netty.resolver.HostsFileEntriesProvider.Parser.parseSilently.

Doc from io.netty.resolver.HostsFileEntriesProvider.Parser.parseSilently.

Parses the hosts file at standard OS location using the given Charsets one after another until parse something or none is left.

Parameters
charsets:Charset[]

the Charsets to try as file encodings when parsing

Returns:HostsFileEntriesProvider

a new HostsFileEntriesProvider

Annotations
@Override
parseSilentlyback to summary
public HostsFileEntriesProvider parseSilently(File file, Charset... charsets)

Implements io.netty.resolver.HostsFileEntriesProvider.Parser.parseSilently.

Doc from io.netty.resolver.HostsFileEntriesProvider.Parser.parseSilently.

Parses the provided hosts file using the given Charsets one after another until parse something or none is left. In case Charsets are not provided, the system default Charset is used for decoding.

Parameters
file:File

the file to be parsed

charsets:Charset[]

the Charsets to try as file encodings when parsing, in case Charsets are not provided, the system default Charset is used for decoding

Returns:HostsFileEntriesProvider

a new HostsFileEntriesProvider

Annotations
@Override