public class KnownHostEntryReader
extends java.lang.Object
This reader is a bit more robust and tries to handle this case if there is only one colon (otherwise it might be an IPv6 address (without port)), and it skips and logs invalid entries, but still returns all other valid entries from the file.
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
Modifier | Constructor and Description |
---|---|
private |
KnownHostEntryReader() |
Modifier and Type | Method and Description |
---|---|
private static java.lang.String |
clean(java.lang.String line) |
private static org.apache.sshd.client.config.hosts.KnownHostEntry |
parseHostEntry(java.lang.String line) |
private static java.util.Collection<org.apache.sshd.client.config.hosts.HostPatternValue> |
parsePatterns(java.lang.String text) |
static java.util.List<org.apache.sshd.client.config.hosts.KnownHostEntry> |
readFromFile(java.nio.file.Path path)
Reads a known_hosts file and returns all valid entries.
|
public static java.util.List<org.apache.sshd.client.config.hosts.KnownHostEntry> readFromFile(java.nio.file.Path path) throws java.io.IOException
path
- of the file to readList
of all valid entries read from the filejava.io.IOException
- if the file cannot be read.private static java.lang.String clean(java.lang.String line)
private static org.apache.sshd.client.config.hosts.KnownHostEntry parseHostEntry(java.lang.String line)
private static java.util.Collection<org.apache.sshd.client.config.hosts.HostPatternValue> parsePatterns(java.lang.String text)