0

So i need to read a text file and convert it to String in order for me to start using shift chipper to chipper my msg. all i found of how to read text file involves a loop, and it in itself only show printed character from the first to the next until there's no more text.

File fl = new File("d:/chipper/msg/msg.txt");
BufferedReader brText = new BufferedReader(new FileReader(fl));
String text = null;
while((text=brText.readLine())!=null){
System.out.println(text);
}
brPesan.close(); 

is there a way so i can just

File fl = new File("d:/chipper/msg/msg.txt");
textToChipper = fl;
chipper();
Arivas
  • 5
  • 5

1 Answers1

1

You could do something like this:

textToChipper = new String(Files.readAllBytes(Paths.get("d:/chipper/msg/msg.txt")));
Chad
  • 99
  • 6