I am trying to get text from a .txt file and write it out in the System, but it is not working. 
My User.txt file has the format of 
user:pass
user2:pass2
etc
I want to get the user and pass one at a time and show it in System. 
Current the system for "Details" shows the path to the .txt file
"username" shows "C"
"password" shows "C" 
I am assuming the C comes starting the path file. I am not sure why it is not getting the text from the .txt file. 
What am I doing wrong?
Also, it clears the whole .txt after the first iteration. 
String username;
String password;
String details;
try {
  Scanner fileScanner = new Scanner(getDirectoryData() + "User.txt");
  details = fileScanner.nextLine();
  System.out.println(details);
  username = details.split(":")[0].split("@")[0];
  password = details.split(":")[0];
  System.out.println(username);
  System.out.println(password);
  FileWriter fileStream = new FileWriter(getDirectoryData() + "User.txt");
  BufferedWriter out = new BufferedWriter(fileStream);
  // sendMessage("INFO:BOT:" + username);
  while(fileScanner.hasNextLine()) {
    String next = fileScanner.nextLine();
    if(next.equals("\n")) {
      out.newLine();
    } else {
      out.write(next);
      out.newLine();
    }
  }
  out.close();
} catch (IOException e) {
  e.printStackTrace();
}
 
     
    