I have a .doc file with contains header before the ÐÏ , So I need to remove all the characters that are exist before the ÐÏ.
Example : asdfasdfasdfasfasdfasfÐÏ9asjdfkj
I have used the below code.
InputStream is = new FileInputStream("D:\\Users\\Vinoth\\workspace\\Testing\\Testing_2.doc");
DataInputStream dis = new DataInputStream(is);
OutputStream os = new FileOutputStream("D:\\Users\\Vinoth\\workspace\\Testing\\Testing_3.doc");
DataOutputStream dos = new DataOutputStream(os);
byte[] buff = new byte[dis.available()];
dis.readFully(buff);
char temp = 0;
boolean start = false;
try{
for(byte b:buff){
char c = (char)b;
if(temp == 'Ð' && c == 'Ï' ){
start = true;
}
if(start){
dos.write(c);
}
temp = c;
}
However , it is not writing anything in my file as the first if condition is not getting satisfied. Please advise how can I perform this .