I am trying to read a custom file extension When reading a string from the file it output the correct string, however when I attempt to read an int it does not output the correct int. Here is my code:
import java.awt.event.*;
import java.awt.*;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import javax.swing.*;
public class TestRead {
public TestRead () throws IOException{
JFrame f = new JFrame ("Test Read From Custom File Extention");
JPanel p = new JPanel ();
int inFile = 0;
String file = "";
BufferedReader stream;
try {
stream = new BufferedReader (new FileReader("C:\\Users\\Adam\\Desktop\\TestFile.wpf"));
inFile = stream.read();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
JLabel text = new JLabel ("" + inFile);
p.add (text);
f.add(p);
f.setSize (200,200);
f.setVisible (true);
}
public static void main (String [] args) throws IOException{
TestRead tr = new TestRead();
}
}
How would I solve this issue?
Thanks for the help.