Code example for ObjectOutputStream

Methods: closewriteObject

0
		ObjectOutput streamEscrituraPersona = null;
		 
		try { 
			try { 
				streamEscritura = new FileOutputStream(ruta);
				streamEscrituraPersona = new ObjectOutputStream(streamEscritura);
				streamEscrituraPersona.writeObject(new Persona("Jose", "López", "2563"));
			} finally { 
				if(streamEscrituraPersona != null)
					streamEscrituraPersona.close();
			} 
		} catch(FileNotFoundException e) {
			e.printStackTrace();
		} catch(IOException e) {
			e.printStackTrace();
		} 
	} 
	 
	public static void main(String[] args) {
		new EscritorPersona().ejecutar("src\\practica17\\persona.ser"); 
Stop searching for code, let great code find you!  Add Codota to your java IDE