I am writing a program that decrypts a text file that has been encrypted. My buffered reader only seems to read the first line of the text file only? This is shown by my decryption function() only printing out the first line only correctly decrypted. I have attached a snippet of my code but im not sure where it is going wrong. The b variable is to exhaustively decrypt the code, its irrelevant to the file reading
BufferedReader br = new BufferedReader(new FileReader("decryptthis.txt"));
String message;
while (((message = br.readLine()) != null))
{
message = message.toUpperCase();
while (b <= 26)
{
decryption(message, b);
b++;
}
This part is in my main function
public static String decryption(String message, int b)
This is what my decryption function takes in
i think i need it to go in loop and continuously feed my decryption function the lines, however i thought this was done by the != null part
Any help would be appreciated it. Thank you
First, try to put the correct code lines to the corresponding methods. Your problem is not located at the 'reading' part. How to confirm that? Just print what lines your buffer reads. After that, call your decryption method that inside includes all the decrypt codes.
For example,
this will print the content of the txt. (check it)
In your case,
Each method is doing something. Try not to stop your reading. Just abort the strings on your method with your conditions