import java.io.FileInputStream;
import java.io.BufferedInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class LeerArchivoGrandeBuffer {
  public static void main(String [] args){
   final int longitud=1024;
   if (args.length>0) {
     String ruta = args[0];
    try {
     BufferedInputStream elArchivo = new BufferedInputStream(
        new FileInputStream(args[0]),4*longitud);
     byte [] elArreglo= new byte[longitud] ;
     long inicio = System.currentTimeMillis();
     while ( elArchivo.read(elArreglo) != -1 ) ;
     long fin = System.currentTimeMillis();
     elArchivo.close();
     System.out.println("Tiempo de lectura "+(fin-inicio));
    } catch (FileNotFoundException laExcepcion) {
         System.err.println("Error al crear al archivo "+laExcepcion.getMessage());
    } catch (IOException laExcepcion) {
         System.err.println("Error al escribir o cerrar al archivo "
         +laExcepcion.getMessage());
    }
   } else {
        System.err.println("Proporcionar ruta del archivo");
   }
  }
}