Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/03/2012, 04:36
viringas
 
Fecha de Ingreso: marzo-2011
Mensajes: 226
Antigüedad: 13 años
Puntos: 1
ficheros java

hola a todos tengo esta función para leer datos de un fichero, pero cuando voy a leerlos resulta que me dice que no puede cargar el fichero, la verdad es que no encuentro donde esta el fallo porque lo revisé mil veces y creo que esta bien, si alguien me puede dar su opinión y decirme que estoy haciendo mal se lo agradezco

Código java:
Ver original
  1. public void parsearTxt() {
  2.         try{
  3.             File file = new File("libros.txt");
  4.             if(file.exists()){
  5.                 ObjectInputStream entrada = new ObjectInputStream(new FileInputStream("libros.txt"));
  6.                
  7.                 while(entrada.readLine()!= null){
  8.                     String linea = entrada.readLine();
  9.                     StringTokenizer TI  = new StringTokenizer(linea, "\t");
  10.                     String titulo = TI.nextToken();
  11.                     String autor = TI.nextToken();
  12.                     String isbn = TI.nextToken();
  13.                     b.addLibro(isbn, titulo, autor);
  14.                    
  15.                 }
  16.             }
  17.         }catch (FileNotFoundException ex) { ex.printStackTrace(); System.out.println("ERROoooR: no hay fichero"); }
  18.          catch (IOException ex) {ex.printStackTrace(); System.out.println("ERROR: No se ha podido cargar1"); }
  19.        
  20.     }

gracias por las posibles soluciones