Example #1
0
  private void initialize(File knownHosts) throws IOException {
    char[] buff = new char[512];

    CharArrayWriter cw = new CharArrayWriter();

    knownHosts.createNewFile();

    FileReader fr = new FileReader(knownHosts);

    while (true) {
      int len = fr.read(buff);
      if (len < 0) break;
      cw.write(buff, 0, len);
    }

    fr.close();

    initialize(cw.toCharArray());
  }
Example #2
0
 public KnownHosts(File knownHosts) throws IOException {
   initialize(knownHosts);
 }
Example #3
0
 public KnownHosts(char[] knownHostsData) throws IOException {
   initialize(knownHostsData);
 }
Example #4
0
 /**
  * Parses the given known_hosts file and adds entries to the database.
  *
  * @param knownHosts
  * @throws IOException
  */
 public void addHostkeys(File knownHosts) throws IOException {
   initialize(knownHosts);
 }
Example #5
0
 /**
  * Parses the given known_hosts data and adds entries to the database.
  *
  * @param knownHostsData
  * @throws IOException
  */
 public void addHostkeys(char[] knownHostsData) throws IOException {
   initialize(knownHostsData);
 }