commit 5f63b44e6ece6ce5566f6ce9e2c644483a20f560 Author: jxu4 Date: Tue Sep 22 17:55:06 2026 +0200 segundo diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..4e29ea7 --- /dev/null +++ b/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..8819eb3 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + Fichero_01 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..e4acff5 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,13 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=26 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=26 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=26 diff --git a/bin/module-info.class b/bin/module-info.class new file mode 100644 index 0000000..34e58e4 Binary files /dev/null and b/bin/module-info.class differ diff --git a/bin/org/palomafp/aadd/jx/AppPrincipal.class b/bin/org/palomafp/aadd/jx/AppPrincipal.class new file mode 100644 index 0000000..81cce56 Binary files /dev/null and b/bin/org/palomafp/aadd/jx/AppPrincipal.class differ diff --git a/src/module-info.java b/src/module-info.java new file mode 100644 index 0000000..6ef14bf --- /dev/null +++ b/src/module-info.java @@ -0,0 +1,8 @@ +/** + * + */ +/** + * + */ +module Actividad1_Jilai { +} \ No newline at end of file diff --git a/src/org/palomafp/aadd/jx/AppPrincipal.java b/src/org/palomafp/aadd/jx/AppPrincipal.java new file mode 100644 index 0000000..8dd99e7 --- /dev/null +++ b/src/org/palomafp/aadd/jx/AppPrincipal.java @@ -0,0 +1,80 @@ +package org.palomafp.aadd.jx; // Reemplaza 'xxx' por tus iniciales + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +public class AppPrincipal { + + public static void main(String[] args) { + + + // Colocaremos la ruta que tengamos, en mi caso la cuenta de usuario es alumnoT + + String rutaCarpeta = "C:\\Users\\alumnoT\\aadd\\fic01\\"; + String nombreFichero = "informacion_paises.txt"; + File fichero = new File(rutaCarpeta + nombreFichero); + + + BufferedReader bufferLectura = null; + + + try { + + // Comprobamos si existe el fichero + if (!fichero.exists()) { + System.out.println("No se encuentra el fichero en la ruta: " + fichero.getAbsolutePath()); + return; + } + + // Inicializamos la lectura y se guardara en un buffer + + bufferLectura = new BufferedReader(new FileReader(fichero)); + String linea; + + System.out.println("--- INICIO ---"); + + // vAmos a recorrer el fichero paso a paso + while ((linea = bufferLectura.readLine()) != null) { + + // Filtramos Ășnicamente la lĂ­nea que queramos por ejemplo que empiece por # + if (linea.trim().startsWith("#") || linea.trim().isEmpty()) { + continue; + } + + // Vamos a seperar con comas para que se entiendan las cosas + String[] campos = linea.split(","); + + if (campos.length >= 4) { + + // Ejemplo de limpieza de comillas si el formato de los campos las incluye + String idCiclo = campos[0].replace("\"", "").trim(); + String nombreCiclo = campos[2].replace("\"", "").trim(); + + int anio = 2000; + String familia = (idCiclo.length() >= 3) ? idCiclo.substring(0, 3) : idCiclo; + + // Imprimimos por consola el literal requerido por la actividad + System.out.println("INSERT INTO T_PAIS VALUES ('" + idCiclo + "', '" + nombreCiclo + "', " + anio + ", '" + familia + "');"); + } + } + + System.out.println("--- FIN ---"); + + } catch (IOException e) { + System.err.println("Error de E/S al leer el fichero: " + e.getMessage()); + e.printStackTrace(); + } finally { + + + try { + if (bufferLectura != null) { + bufferLectura.close(); + } + } catch (IOException e) { + System.err.println("Error al cerrar el fichero: " + e.getMessage()); + } + } + } +} \ No newline at end of file