I'm using a dat
file to store underscore separated values and comma separated values at the same time but every time I want to get the values of a the second String[]
called basics in order to set values of another object but it suddenly resets it's size and stores values to the first splitted one.
String data in this case would be like:
String data = "0234_ADMIN_12-Jun-2022 21:58:59,5635_PAL_16.0_54";
private void cargarNotas() {
try {
BufferedReader leerNotas = new BufferedReader(new FileReader(regNotas));
String data = leerNotas.readLine();
while (data!= null) {
String[] items = data.split(",");
String[] basics = items[0].trim().split("_");
System.out.println(basics.length);
NotaDeVenta tempNota = new NotaDeVenta();
tempNota.setnoNota(basics[0]);
tempNota.setUsuario(basics[1]);
tempNota.setFecha(FORMAT.parse(basics[2]));
String[] values = null;
for(int i = 0;i<items.length-1;i++) {
values = items[i+1].split("_");
ItemParaMovimientos tempItem = new ItemParaMovimientos(Control.getProducto(values[1]),Integer.parseInt(values[3]));
tempNota.addItem(tempItem);
}
Control.addNota(tempNota);
data = leerNotas.readLine();
}
leerNotas.close();
}
catch (Exception e) {
e.printStackTrace();
}