示例#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());
  }
示例#2
0
 public KnownHosts(File knownHosts) throws IOException {
   initialize(knownHosts);
 }
示例#3
0
 public KnownHosts(char[] knownHostsData) throws IOException {
   initialize(knownHostsData);
 }
示例#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);
 }
示例#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);
 }