private static String loadUA ( ClassLoader loader , String filename ) { String ua = "cloudant-http" ; String version = "unknown" ; final InputStream propStream = loader . getResourceAsStream ( filename ) ; final Properties properties = new Properties ( ) ; try { if ( propStream != null ) { try { properties . load ( propStream ) ; } finally { propStream . close ( ) ; } } ua = properties . getProperty ( "user.agent.name" , ua ) ; version = properties . getProperty ( "user.agent.version" , version ) ; } catch ( IOException e ) { // Swallow exception and use default values. } return String . format ( Locale . ENGLISH , "%s/%s" , ua , version ) ; }
Loads the properties file using the classloader provided . Creating a string from the properties user . agent . name and user . agent . version .