Hey,
So basically I build a code to check lines on a .txt file and those likes compare a substring and change it to another saved string (always in the same position). Everything worked like a charm, no problem whatsoever, the messed up situation pops when I try to run the code on txt files with more than 2 million lines. This is definitely a problem because I need to run it on files with more than 10 million lines. What I tried to do was to save it on an ArrayList but it does not work, so Im lost here, been with this issue for more than 3 days, now Im getting to the point of dying. Here's the method call for the proccess:
public void checaFechaSegunLugarUnico(String path, String archivo, int inicio, int fin) throws FileNotFoundException{ jTextArea2.setText(""); try{ FileReader fstream = new FileReader(path); //DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(fstream); String strLine,primero, segundo, pivote,aux; int i = 0; ArrayList almacem; almacem = new ArrayList(); primero= ""; jTextArea2.append("Hola\n"); boolean bandera=true; while ((strLine = br.readLine()) != null){ almacem.add(strLine); /*if(strLine.length() < fin){ aux= strLine; jTextArea2.append(aux+"\n"); } else{ pivote = strLine.substring(inicio,fin); if(pivote.equals(primero)) { aux= strLine; } else{ if (bandera == true){ primero = pivote; bandera = false; aux=strLine; } else{ aux = strLine.substring(0, inicio)+primero+strLine.substring(fin); //aux = strLine.replaceAll(pivote, primero); } } jTextArea2.append(aux+"\n"); */} jTextArea2.append("Salio\n"); jTextArea2.append("Total leído: "+ almacem.size()); //} /*SimpleDateFormat format = new SimpleDateFormat("yy-M-d"); jTextArea1.append(primero+"\n"); Date check = format.parse(primero); Calendar calendar = Calendar.getInstance(); calendar.setTime(check); int dia = Integer.parseInt(primero.substring(8)); int mes = calendar.get(Calendar.MONTH); int año = calendar.get(Calendar.YEAR); int ultDiaHab= obtenerUltimoDia(mes,año); if(dia == ultDiaHab){ jTextArea1.append("La fecha capturada en el archivo "+archivo+" si concuerda con el último dia habil del mes\n"); crearArchivo(path,archivo); jTextArea2.setText(""); } else { jTextArea1.append("La fecha capturada en el archivo "+archivo+" no concuerda con el último dia habil del mes\n"); jTextArea2.setText(""); }*/ }catch (Exception e){ } }
Any help will be greatly appreciated.