Phew..I've typed wrong in my program.
just finished deleted 27000 created output files in my dir. In the input file - there are 159451lines.
kindly please help me to figure it out ....really appreciate any help. thank you
just finished deleted 27000 created output files in my dir. In the input file - there are 159451lines.
kindly please help me to figure it out ....really appreciate any help. thank you
Code:
public class Transfer { private static String lineFRST = ""; public static void main(String[] args) throws IOException { BufferedReader inputFIRST = new BufferedReader (new FileReader("first100.txt")); spool(inputFIRST); } public static void spool(BufferedReader in) throws IOException { BufferedReader inputFIRST = new BufferedReader (new FileReader("first100.txt")); PrintWriter printWriter = null; BufferedWriter bufferWriter = null; int fileno = 1; lineFRST = inputFIRST.readLine(); while(lineFRST != null) { if (lineFRST.indexOf("groupAStart") >= 0) { if (printWriter == null) makeOutFile (fileno++); } else if (printWriter != null) { printWriter.println(lineFRST); if (lineFRST.indexOf("groupAFinish") >=0) { printWriter.close(); printWriter = null; } } } } public static void makeOutFile(int fileno) throws IOException { PrintWriter printWriter = null; BufferedWriter bufferWriter = null; bufferWriter = new BufferedWriter( new FileWriter("output" +fileno +".txt", true)); //this not works... String[] thelineFRST = lineFRST.split(" "); String num1 = thelineFRST[0]; String num2 = thelineFRST[1]; String method = thelineFRST[2]; bufferWriter.write(num1+ " " + num2+ "\n"); bufferWriter.close(); } }
Comment