public final class HostsFileParser
extends java.lang.Object
HostsFileEntriesProvider
when mappings with all entries per hostname are needed.限定符和类型 | 方法和说明 |
---|---|
static HostsFileEntries |
parse()
Parse hosts file at standard OS location using the system default
Charset for decoding. |
static HostsFileEntries |
parse(java.io.File file)
Parse a hosts file using the system default
Charset for decoding. |
static HostsFileEntries |
parse(java.io.File file,
java.nio.charset.Charset... charsets)
Parse a hosts file.
|
static HostsFileEntries |
parse(java.io.Reader reader)
Parse a reader of hosts file format.
|
static HostsFileEntries |
parseSilently()
Parse hosts file at standard OS location using the systems default
Charset for decoding. |
static HostsFileEntries |
parseSilently(java.nio.charset.Charset... charsets)
Parse hosts file at standard OS location using the given
Charset s one after each other until
we were able to parse something or none is left. |
public static HostsFileEntries parseSilently()
Charset
for decoding.HostsFileEntries
public static HostsFileEntries parseSilently(java.nio.charset.Charset... charsets)
Charset
s one after each other until
we were able to parse something or none is left.charsets
- the Charset
s to try as file encodings when parsing.HostsFileEntries
public static HostsFileEntries parse() throws java.io.IOException
Charset
for decoding.HostsFileEntries
java.io.IOException
- file could not be readpublic static HostsFileEntries parse(java.io.File file) throws java.io.IOException
Charset
for decoding.file
- the file to be parsedHostsFileEntries
java.io.IOException
- file could not be readpublic static HostsFileEntries parse(java.io.File file, java.nio.charset.Charset... charsets) throws java.io.IOException
file
- the file to be parsedcharsets
- the Charset
s to try as file encodings when parsing.HostsFileEntries
java.io.IOException
- file could not be readpublic static HostsFileEntries parse(java.io.Reader reader) throws java.io.IOException
reader
- the file to be parsedHostsFileEntries
java.io.IOException
- file could not be read