Top Description Inners Fields Constructors Methods
org.apache.sshd.client.config.hosts

public Class KnownHostEntry

extends HostPatternsHolder
Class Inheritance
Imports
java.io.BufferedReader, .IOException, .InputStream, .InputStreamReader, .Reader, .StreamCorruptedException, java.net.URL, java.nio.charset.StandardCharsets, java.nio.file.Files, .OpenOption, .Path, java.util.ArrayList, .Collections, .List, org.apache.sshd.common.config.ConfigFileReaderSupport, org.apache.sshd.common.config.keys.AuthorizedKeyEntry, .PublicKeyEntry, org.apache.sshd.common.util.GenericUtils, .ValidateUtils, org.apache.sshd.common.util.io.input.NoCloseInputStream, .NoCloseReader

Contains a representation of an entry in the known_hosts file
Author
Apache MINA SSHD Project
See Also
sshd(8) man page

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private KnownHostHashValue
private AuthorizedKeyEntry
private String
private String
public static final char
MARKER_INDICATOR

Character that denotes that start of a marker

public static final String
STD_HOSTS_FILENAME

Standard OpenSSH config file name

Inherited from org.apache.sshd.client.config.hosts.HostPatternsHolder:
ALL_HOSTS_PATTERNNEGATION_CHAR_PATTERNNON_STANDARD_PORT_PATTERN_ENCLOSURE_END_DELIMNON_STANDARD_PORT_PATTERN_ENCLOSURE_START_DELIMPATTERN_CHARSPORT_VALUE_DELIMITERSINGLE_CHAR_PATTERNWILDCARD_PATTERN

Constructor Summary

AccessConstructor and Description
public
public
KnownHostEntry(String
The original line from which this entry was created
line
)

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

The original line from which this entry was created
getConfigLine
()

public static Path

Returns:

The default Path location of the OpenSSH known hosts file
getDefaultKnownHostsFile
()

public KnownHostHashValue
public AuthorizedKeyEntry
public String
public boolean
isHostMatch(String
The host name / address - ignored if null/empty
host
,
int
The connection port
port
)

Overrides org.apache.sshd.client.config.hosts.HostPatternsHolder.isHostMatch.

Checks if a given host name / address matches the entry's host pattern(s)

public static KnownHostEntry
public static <E extends KnownHostEntry> E
parseKnownHostEntry(E entry, String data)

public static List<KnownHostEntry>
public static List<KnownHostEntry>
public static List<KnownHostEntry>
readKnownHostEntries(InputStream inStream, boolean okToClose)

public static List<KnownHostEntry>
readKnownHostEntries(Reader rdr, boolean okToClose)

public static List<KnownHostEntry>

Returns:

The List of read KnownHostEntry-ies
readKnownHostEntries
(BufferedReader
The BufferedReader to use
rdr
)

Reads configuration entries

public void
public void
public void
public void
setMarker(String marker)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from org.apache.sshd.client.config.hosts.HostPatternsHolder:
getPatternsisHostMatchisHostMatchisPortMatchisSpecificHostPatternisValidPatternCharparsePatternsparsePatternssetPatternstoPattern

Field Detail

hashedEntryback to summary
private KnownHostHashValue hashedEntry
keyEntryback to summary
private AuthorizedKeyEntry keyEntry
lineback to summary
private String line
markerback to summary
private String marker
MARKER_INDICATORback to summary
public static final char MARKER_INDICATOR

Character that denotes that start of a marker

STD_HOSTS_FILENAMEback to summary
public static final String STD_HOSTS_FILENAME

Standard OpenSSH config file name

Constructor Detail

KnownHostEntryback to summary
public KnownHostEntry()
KnownHostEntryback to summary
public KnownHostEntry(String line)
Parameters
line:String

The original line from which this entry was created

Method Detail

getConfigLineback to summary
public String getConfigLine()
Returns:String

The original line from which this entry was created

getDefaultKnownHostsFileback to summary
public static Path getDefaultKnownHostsFile()
Returns:Path

The default Path location of the OpenSSH known hosts file

Annotations
@SuppressWarnings:synthetic-access
getHashedEntryback to summary
public KnownHostHashValue getHashedEntry()
getKeyEntryback to summary
public AuthorizedKeyEntry getKeyEntry()
getMarkerback to summary
public String getMarker()
isHostMatchback to summary
public boolean isHostMatch(String host, int port)

Overrides org.apache.sshd.client.config.hosts.HostPatternsHolder.isHostMatch.

Doc from org.apache.sshd.client.config.hosts.HostPatternsHolder.isHostMatch.

Checks if a given host name / address matches the entry's host pattern(s)

Parameters
host:String

The host name / address - ignored if null/empty

port:int

The connection port

Returns:boolean

true if the name / address matches the pattern(s)

Annotations
@Override
parseKnownHostEntryback to summary
public static KnownHostEntry parseKnownHostEntry(String line)
parseKnownHostEntryback to summary
public static <E extends KnownHostEntry> E parseKnownHostEntry(E entry, String data)
readKnownHostEntriesback to summary
public static List<KnownHostEntry> readKnownHostEntries(Path path, OpenOption... options) throws IOException
readKnownHostEntriesback to summary
public static List<KnownHostEntry> readKnownHostEntries(URL url) throws IOException
readKnownHostEntriesback to summary
public static List<KnownHostEntry> readKnownHostEntries(InputStream inStream, boolean okToClose) throws IOException
readKnownHostEntriesback to summary
public static List<KnownHostEntry> readKnownHostEntries(Reader rdr, boolean okToClose) throws IOException
readKnownHostEntriesback to summary
public static List<KnownHostEntry> readKnownHostEntries(BufferedReader rdr) throws IOException

Reads configuration entries

Parameters
rdr:BufferedReader

The BufferedReader to use

Returns:List<KnownHostEntry>

The List of read KnownHostEntry-ies

Exceptions
IOException:
If failed to parse the read configuration
setConfigLineback to summary
public void setConfigLine(String line)
setHashedEntryback to summary
public void setHashedEntry(KnownHostHashValue hashedEntry)
setKeyEntryback to summary
public void setKeyEntry(AuthorizedKeyEntry keyEntry)
setMarkerback to summary
public void setMarker(String marker)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
org.apache.sshd.client.config.hosts back to summary

private final Class KnownHostEntry.LazyDefaultConfigFileHolder

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.sshd.client.config.hosts.KnownHostEntry.LazyDefaultConfigFileHolder

Field Summary

Modifier and TypeField and Description
private static final Path

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

HOSTS_FILEback to summary
private static final Path HOSTS_FILE

Constructor Detail

LazyDefaultConfigFileHolderback to summary
private LazyDefaultConfigFileHolder()