Guest User

Untitled

a guest
Jul 5th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. class Connection {
  2. String urlPath
  3.  
  4. private String username = project.properties.username
  5. private String password = project.properties.password
  6. private String basicAuth = "$username:$password".bytes.encodeBase64().toString()
  7. URL url = urlPath.toURL();
  8.  
  9. InputStream getStream() {
  10. URLConnection connection = url.openConnection();
  11. connection.setRequestProperty("Authorization","Basic $basicAuth");
  12. InputStream inputStream = connection.getInputStream();
  13. return getStream()
  14. }
  15. }
Add Comment
Please, Sign In to add comment