Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 1.04 KB | None | 0 0
  1. import java.io.*;
  2.  
  3. class LastFM {
  4.     String sessionkey = "";
  5.     String username = "";
  6.     String password = "";
  7.    
  8.     public LastFM() {
  9.         readConfig("lastfm_config.txt");
  10.         System.out.println("lastfm username: " + username + ", password: " + doAskterisks(password));
  11.     }
  12.    
  13.     public static void main(String[] args) {
  14.         if(args.length < 3) {
  15.             System.out.println("Error: not enough args!");
  16.             return;
  17.         }
  18.         LastFM scrobbler = new LastFM();
  19.     }
  20.  
  21.     private String doAskterisks(String pass) {
  22.         String ob = "";
  23.         for(int i = 0; i < pass.length(); i++) {
  24.             ob += "*";
  25.         }
  26.         return ob;
  27.     }
  28.  
  29.     private void readConfig(String file) {
  30.         BufferedReader in = null;
  31.         try {
  32.             in = new BufferedReader(new FileReader(file));
  33.             username = in.readLine();
  34.             password = in.readLine();
  35.         } catch(java.io.IOException e) {
  36.             System.err.println("Caught java.io.IOException: " + e.getMessage());
  37.         } finally {
  38.             if(in != null) {
  39.                 try {
  40.                     in.close();
  41.                 } catch(java.io.IOException e) {
  42.                     System.err.println("Caught java.io.IOException: " + e.getMessage());
  43.                 }  
  44.             }
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement