@Override public KeyStore loadKeyStore(File file,String keyStoreType,String password){
  KeyStore keyStore;
  try {
    keyStore=KeyStore.getInstance(keyStoreType);
  }
 catch (  KeyStoreException e) {
    throw new KeyStoreAccessException("Unable to get KeyStore instance of type: " + keyStoreType,e);
  }
  try {
    InputStream keystoreAsStream=new FileInputStream(file);
    keyStore.load(keystoreAsStream,password.toCharArray());
  }
 catch (  IOException e) {
    throw new ImportException("Unable to read KeyStore from file: " + file.getName(),e);
  }
catch (  CertificateException|NoSuchAlgorithmException e) {
    throw new ImportException("Error while reading KeyStore",e);
  }
  return keyStore;
}

@ Override public KeyStore loadKeyStore ( File file , String keyStoreType , String password ) { KeyStore keyStore ; try { keyStore = KeyStore . getInstance ( keyStoreType ) ; } catch ( KeyStoreException e ) { throw new KeyStoreAccessException ( "Unable to get KeyStore instance of type: " + keyStoreType , e ) ; } try { InputStream keystoreAsStream = new FileInputStream ( file ) ; keyStore . load ( keystoreAsStream , password . toCharArray ( ) ) ; } catch ( IOException e ) { throw new ImportException ( "Unable to read KeyStore from file: " + file . getName ( ) , e ) ; } catch ( CertificateException | NoSuchAlgorithmException e ) { throw new ImportException ( "Error while reading KeyStore" , e ) ; } return keyStore ; }
loads the keystore from the specified inputstream . the inputstream is not closed after the keystore has been read .
