My goal is to get string from a file with out bytes using BufferedReader but i can get the string but some times the result is 'string with bytes' so the files getting corrupted. I used readline to get the 1st line but it working but some time the bytes coming with the string. Here is the code am trying to do it
public static void main(String[] args) throws IOException {
InputStream inStream = null;
OutputStream outStream = null;
String line;
BufferedReader reader;
File afile = new File(
"snake2.jpg");
File bfile = new File(
"snake.jpg");
File file=new File("E://snake.txt");
// for stream reading and writing.....
inStream = new FileInputStream(afile);
outStream = new FileOutputStream(bfile);
OutputStream txt=new FileOutputStream(file);
// create byte array.....
ByteArrayOutputStream f = new ByteArrayOutputStream();
reader = new BufferedReader(new InputStreamReader(inStream));
line = reader.readLine();