sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #36028
Re: [Question #278890]: read and write
Question #278890 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/278890
surya posted a new comment:
import java.io.*;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.PrintWriter;
public class tryy
{
public static void main(String args[])throws IOException
{
File file=new File("my file1.txt");
PrintWriter writer= new PrintWriter(file, "UTF-8");
String p="New folder";
File dir=new File(p);
File[] files=dir.listFiles();
for(File f : files)
if(f.isFile())
{
StringBuilder sb=new StringBuilder();
BufferedReader ins=null;
ins=new BufferedReader(new FileReader(f));
String line;
writer.print("[");
writer.print(f.getName());
writer.println("_DINAMALAR_DATE]\n");
while((line=ins.readLine())!=null)
{
writer.println(line);
writer.println(sb.toString());
System.out.println(line);
}
}
}
write.close();
String inputFile="myfile1.txt";
String file=inputFile;
Buffered Reader br = new Buffered Reader(new File Reader(new File(inputFile)));
String line=null;
StringBuilder sb = new StringBuilder();
int count=1;
{
while((line = br.readLine()) != null){
if(line.startsWith("[")){
if(sb.length()!=0){
File file1= new File(line+".txt");
PrintWriter writer1 = new PrintWriter(file1, "UTF-8"));
{
writer1.println(line);
writer1.println(sb.toString());
}
sb.delete(0, sb.length());
count++;
}
continue;
}
sb.append(line);
}
}
}
}
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.