import java.io.*;
import java.util.*;
public class Wdadta {
/** Creates a new instance of Wdadta */
public Wdadta() {
}
public static void main(
String args[])throws Exception
{
FileReader fr=new FileReader("c:\\java\\cv.doc");
FileWriter fw=new FileWriter("c:\\java\\cv1.doc");
char ch;
int i;
String str="";
while((i=fr.read())!=-1)
{
ch=(char)i;
if(ch!='\n')
{
str=str+ch;
}
else
{
StringTokenizer st=new StringTokenizer(str);
while(st.hasMoreTokens())
{
String f=st.nextToken();
f.trim();
fw.write(f);
fw.write("\r\n");
}
str="";
}
}
fw.close();
}
}
When I attempting t run the abovre program Unneccessary garbage values are comning.But It IS workin properly in case os text files
the solution for this using Apache POI package.if this is the case pls
tell me how to use Apache POI