primer commit
This commit is contained in:
commit
7de069f2d5
10
.classpath
Normal file
10
.classpath
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-25">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="module" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
||||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/bin/
|
||||||
|
*.class
|
||||||
17
.project
Normal file
17
.project
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>Actividad1_1</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
2
.settings/org.eclipse.core.resources.prefs
Normal file
2
.settings/org.eclipse.core.resources.prefs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding/<project>=UTF-8
|
||||||
13
.settings/org.eclipse.jdt.core.prefs
Normal file
13
.settings/org.eclipse.jdt.core.prefs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=24
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=24
|
||||||
|
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=24
|
||||||
57
src/es/palomafp/aadd/inm/AppPrincipalPaises.java
Normal file
57
src/es/palomafp/aadd/inm/AppPrincipalPaises.java
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
package es.palomafp.aadd.inm;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* AppPrincipalPaises: Clase que procesa el fichero con información de países
|
||||||
|
*
|
||||||
|
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||||
|
* @date 26 sept 2025
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AppPrincipalPaises {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
AppPrincipalPaises app = new AppPrincipalPaises();
|
||||||
|
|
||||||
|
String rutaFichero = "C:\\Users\\ineva\\aadd\\inm\\act11\\informacion_paises.txt";
|
||||||
|
app.procesarFicheroPaises(rutaFichero);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void procesarFicheroPaises(String rutaFichero) {
|
||||||
|
try (BufferedReader bf = new BufferedReader(new FileReader(rutaFichero))) {
|
||||||
|
String linea;
|
||||||
|
while ((linea = bf.readLine()) != null) {
|
||||||
|
|
||||||
|
// Procesa las líneas que NO empeiecen por '--' ni por '#'
|
||||||
|
if (!(linea.startsWith("--") || linea.startsWith("#"))) {
|
||||||
|
// Procesar información del País
|
||||||
|
String[] camposPais= linea.split(",");
|
||||||
|
String codContinente=camposPais[0].trim();
|
||||||
|
String identificador=camposPais[1].trim();
|
||||||
|
String nombrePais=camposPais[2].trim();
|
||||||
|
String capital=camposPais[3].trim(); ;
|
||||||
|
|
||||||
|
// Composición de la sentencia a imprimir
|
||||||
|
String sentencia = String.format("INSERT INTO T_PAIS(cod_continente, identificador, nombre_pais ,capital) VALUES (%s,%s,%s,%s);",
|
||||||
|
codContinente, identificador, nombrePais, capital);
|
||||||
|
|
||||||
|
System.out.println(sentencia);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
System.err.println("Fichero no encontrado: " + rutaFichero);
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.println("Error al leer el fichero: " + rutaFichero);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user