From 4ec1c15a784394fdf1193ef46ea1c8e6e7beb767 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 24 Nov 2022 15:15:19 +0100 Subject: [PATCH] actividad 8.1 --- .classpath | 10 +++++++ .project | 17 +++++++++++ .settings/org.eclipse.core.resources.prefs | 2 ++ .settings/org.eclipse.jdt.core.prefs | 14 +++++++++ bin/dam/com/es/EscribirFichObject.class | Bin 0 -> 1690 bytes bin/dam/com/es/Persona.class | Bin 0 -> 892 bytes src/dam/com/es/EscribirFichObject.java | 30 +++++++++++++++++++ src/dam/com/es/Persona.java | 33 +++++++++++++++++++++ 8 files changed, 106 insertions(+) create mode 100644 .classpath create mode 100644 .project create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 .settings/org.eclipse.jdt.core.prefs create mode 100644 bin/dam/com/es/EscribirFichObject.class create mode 100644 bin/dam/com/es/Persona.class create mode 100644 src/dam/com/es/EscribirFichObject.java create mode 100644 src/dam/com/es/Persona.java diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..57bca72 --- /dev/null +++ b/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..56d6902 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + Actividad_8_Objetos_Serializables + + + + + + 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..8c9943d --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,14 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=17 +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=17 diff --git a/bin/dam/com/es/EscribirFichObject.class b/bin/dam/com/es/EscribirFichObject.class new file mode 100644 index 0000000000000000000000000000000000000000..1a9a949c476adda5b2b2556a715e673a01d5b95b GIT binary patch literal 1690 zcmaJ>ZC4vb6n=)hY}iIfL!m&aY_%vah1l9^4HN_l1x-mbExHn|lid*pH@i8z8fPM++#>pgzeLGiAqk{OSSz00d`Ngt794uviJ}W8Ls{0 z%TV;x(ML$UN#Q8`M_GKV^pUb0FA#(H1j`zV{c)TIp=e~Wf+r*|uN4x(F~7u5g(}`< zkPO!tZbl?U+Kdy}Xi3Kweg^9d4|lj>5!<$Bgr4mM23=}U@n}3X4qM!(+Iog?4dEEv zw~pkAS2T32VqBH?X%<`9X3!2rxW^l$;TyAamn*ICJ6Y`FGvbIho5Hmj7O#@TCEISS z%gRM5i|6XLOz6dl=qTe04V7LA`?JsDOC>$6sR(hXHIm#vq*fZaqCp7u1F2W|9>dT% zm66nrPO=E~h~XBaW_ zqaEBVong{k=wRyk8K%v99o*SF!(Fq3_limFFT8Ii@^e))nO~@ysr+KqOy>*LVoLi{ zHxoIdY$kIHWiyrAD4XeAyp1dvq2RvXr<#9 zyu?0bJAwdTk>vp4j$z^(x@QI)2dEJPYj}ol$s$FFCG!1>c>F%PpLJ0@;;c@41F-%B DBVnY^ literal 0 HcmV?d00001 diff --git a/bin/dam/com/es/Persona.class b/bin/dam/com/es/Persona.class new file mode 100644 index 0000000000000000000000000000000000000000..724912d35242fc4f969cc1c9e0b52d2183b13d26 GIT binary patch literal 892 zcmZ{h-EI<56ouCr2By#{P)bqT+8@0EOq>U>_Qq(^gj5p@iI)dB!D(P78Kz$JnR=m# zjfodNfDdI{`^-tHp@wk&*lX=?ZGQjx`3t~nJP+V0w5ECyP0~eVmeB{3Ez?8?@D-Yu z`iqX{I+;c9$CqZ32dF5t?Q5JyLzBgN9$)M6+$dC%bTQ6&Xbo1fVV=dw?3IFVrh2NN z&RKXGCvkqJ(CMyMp7%y9ev?j34J9-}Y@(@9>h?xe&^knb4LP+#R8doC4C2IGTrI{X z`&e+a2I)l4N1ANpa*uxgIbKpVSWim0>dfR9j=tUPty8gNxhmOxfLpKw+Pt+f$;+St zHO1ZU+FZ3^dX-JgyIAHGx=Fv3Y2k#KO8l1L@xze(dpwEAy~6iRgj~0H`^5JW_eTE* z>irkD*zO~d|v=eohQY7OcXcldH#$nXe{d82`CqwGl^Y~1yZlz}f5-M$9y|!9q!L&`E5zkH@jecm_>9$_ zRNJI01i=Nhq7jEqQFRxt;=(CB#i8@M53+MZ(S4A;2SJW-yauxW&$J7WLxLRr2SjEo K6F9LQpZx{rae*}e literal 0 HcmV?d00001 diff --git a/src/dam/com/es/EscribirFichObject.java b/src/dam/com/es/EscribirFichObject.java new file mode 100644 index 0000000..f21d913 --- /dev/null +++ b/src/dam/com/es/EscribirFichObject.java @@ -0,0 +1,30 @@ +package dam.com.es; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectOutputStream; +import java.util.ArrayList; + +public class EscribirFichObject { + + public static void main(String[] args) throws IOException{ + File fichero = new File("C:\\Users\\kevin\\Documents\\Actividad8_1\\FichPersona.dat"); + + FileOutputStream fileout = new FileOutputStream(fichero); + ObjectOutputStream dataOS = new ObjectOutputStream(fileout); + ArrayList personas = new ArrayList<>(); + + String[] nombres= {"Paco","Pedro","Perico","Ivan"}; + int[] edades= {32,43,66,98}; + + dataOS.writeObject(nombres); + dataOS.writeObject(edades); + + dataOS .close(); + dataOS .close(); + + System.out.println("Ha creado todos los datos y guardado en el archivo: " + fichero.getName() ); + } + +} diff --git a/src/dam/com/es/Persona.java b/src/dam/com/es/Persona.java new file mode 100644 index 0000000..8737e99 --- /dev/null +++ b/src/dam/com/es/Persona.java @@ -0,0 +1,33 @@ +package dam.com.es; + +import java.io.Serializable; + +public class Persona implements Serializable { + private String nombre; + private int edad; + public Persona(String nombre, int edad) { + this.nombre = nombre; + this.edad= edad; + } + + public Persona() { + this.nombre=null; + } + + public String getNombre() { + return nombre; + } + + public void setNombre(String nombre) { + this.nombre = nombre; + } + + public int getEdad() { + return edad; + } + + public void setEdad(int edad) { + this.edad = edad; + } + +}