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 KnownHostHashValueprivate AuthorizedKeyEntryprivate Stringprivate Stringstatic final charCharacter that denotes that start of a markerstatic final StringStandard 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 PathbooleanisHostMatch(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 KnownHostEntryparseKnownHostEntry(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) voidsetConfigLine(String line) voidsetHashedEntry(KnownHostHashValue hashedEntry) voidsetKeyEntry(AuthorizedKeyEntry keyEntry) voidtoString()Methods inherited from class org.apache.sshd.client.config.hosts.HostPatternsHolder
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:HostPatternsHolderChecks if a given host name / address matches the entry's host pattern(s)- Overrides:
isHostMatchin classHostPatternsHolder- Parameters:
host- The host name / address - ignored ifnull/emptyport- The connection port- Returns:
trueif the name / address matches the pattern(s)- See Also:
-
toString
-
getDefaultKnownHostsFile
- Returns:
- The default
Pathlocation 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- TheBufferedReaderto use- Returns:
- The
Listof readKnownHostEntry-ies - Throws:
IOException- If failed to parse the read configuration
-
parseKnownHostEntry
-
parseKnownHostEntry
-