Class KnownHostEntry
java.lang.Object
org.apache.sshd.client.config.hosts.HostPatternsHolder
org.apache.sshd.client.config.hosts.KnownHostEntry
Contains a representation of an entry in the
known_hosts
file- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate KnownHostHashValue
private AuthorizedKeyEntry
private String
private String
static final char
Character that denotes that start of a markerstatic final String
Standard OpenSSH config file nameFields inherited from class org.apache.sshd.client.config.hosts.HostPatternsHolder
ALL_HOSTS_PATTERN, NEGATION_CHAR_PATTERN, NON_STANDARD_PORT_PATTERN_ENCLOSURE_END_DELIM, NON_STANDARD_PORT_PATTERN_ENCLOSURE_START_DELIM, PATTERN_CHARS, PORT_VALUE_DELIMITER, SINGLE_CHAR_PATTERN, WILDCARD_PATTERN
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Path
boolean
isHostMatch
(String host, int port) Checks if a given host name / address matches the entry's host pattern(s)static <E extends KnownHostEntry>
EparseKnownHostEntry
(E entry, String data) static KnownHostEntry
parseKnownHostEntry
(String line) static List<KnownHostEntry>
Reads configuration entriesstatic List<KnownHostEntry>
readKnownHostEntries
(InputStream inStream, boolean okToClose) static List<KnownHostEntry>
readKnownHostEntries
(Reader rdr, boolean okToClose) static List<KnownHostEntry>
readKnownHostEntries
(URL url) static List<KnownHostEntry>
readKnownHostEntries
(Path path, OpenOption... options) void
setConfigLine
(String line) void
setHashedEntry
(KnownHostHashValue hashedEntry) void
setKeyEntry
(AuthorizedKeyEntry keyEntry) void
toString()
Methods inherited from class org.apache.sshd.client.config.hosts.HostPatternsHolder
findMatchingEntries, findMatchingEntries, getPatterns, isHostMatch, isHostMatch, isPortMatch, isSpecificHostPattern, isValidPatternChar, parsePatterns, parsePatterns, setPatterns, toPattern
-
Field Details
-
MARKER_INDICATOR
public static final char MARKER_INDICATORCharacter that denotes that start of a marker- See Also:
-
STD_HOSTS_FILENAME
Standard OpenSSH config file name- See Also:
-
line
-
marker
-
keyEntry
-
hashedEntry
-
-
Constructor Details
-
KnownHostEntry
public KnownHostEntry() -
KnownHostEntry
- Parameters:
line
- The original line from which this entry was created
-
-
Method Details
-
getConfigLine
- Returns:
- The original line from which this entry was created
-
setConfigLine
-
getMarker
-
setMarker
-
getKeyEntry
-
setKeyEntry
-
getHashedEntry
-
setHashedEntry
-
isHostMatch
Description copied from class:HostPatternsHolder
Checks if a given host name / address matches the entry's host pattern(s)- Overrides:
isHostMatch
in classHostPatternsHolder
- Parameters:
host
- The host name / address - ignored ifnull
/emptyport
- The connection port- Returns:
true
if the name / address matches the pattern(s)- See Also:
-
toString
-
getDefaultKnownHostsFile
- Returns:
- The default
Path
location of the OpenSSH known hosts file
-
readKnownHostEntries
public static List<KnownHostEntry> readKnownHostEntries(Path path, OpenOption... options) throws IOException - Throws:
IOException
-
readKnownHostEntries
- Throws:
IOException
-
readKnownHostEntries
public static List<KnownHostEntry> readKnownHostEntries(InputStream inStream, boolean okToClose) throws IOException - Throws:
IOException
-
readKnownHostEntries
public static List<KnownHostEntry> readKnownHostEntries(Reader rdr, boolean okToClose) throws IOException - Throws:
IOException
-
readKnownHostEntries
Reads configuration entries- Parameters:
rdr
- TheBufferedReader
to use- Returns:
- The
List
of readKnownHostEntry
-ies - Throws:
IOException
- If failed to parse the read configuration
-
parseKnownHostEntry
-
parseKnownHostEntry
-