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
Charsets one after each other until
we were able to parse something or none is left. |
public static HostsFileEntries parseSilently()
Charset for decoding.HostsFileEntriespublic static HostsFileEntries parseSilently(java.nio.charset.Charset... charsets)
Charsets one after each other until
we were able to parse something or none is left.charsets - the Charsets to try as file encodings when parsing.HostsFileEntriespublic static HostsFileEntries parse() throws java.io.IOException
Charset for decoding.HostsFileEntriesjava.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 parsedHostsFileEntriesjava.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 Charsets to try as file encodings when parsing.HostsFileEntriesjava.io.IOException - file could not be readpublic static HostsFileEntries parse(java.io.Reader reader) throws java.io.IOException
reader - the file to be parsedHostsFileEntriesjava.io.IOException - file could not be read