<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>

<channel>
	<title>Mañas Geek.</title>
	<atom:link href="http://rodrigo-salado-anaya.blog.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://rodrigo-salado-anaya.blog.com</link>
	<description>Blog dedicado a Geek's.</description>
	<pubDate>Wed, 04 Jun 2008 20:11:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Renombrar un archivo en Java (rename).</title>
		<link>http://rodrigo-salado-anaya.blog.com/2008/06/05/renombrar-un-archivo-en-java-rename/</link>
		<comments>http://rodrigo-salado-anaya.blog.com/2008/06/05/renombrar-un-archivo-en-java-rename/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 20:11:51 +0000</pubDate>
		<dc:creator>trade</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[Usando la clase "existe" ya posteada, pongo esta que nos renombra un archivo. De hecho es muy facíl hacerlo pero, es tu decisión si lo cambias o mejoras, solo te pido que me lo hagas saber.<br />
/**<br />
&#160;*<br />
&#160;* @author rodrigo salado anaya.<br />
&#160;*/<br />
import java.io.File;<br />
<br />
public class rename {<br />
<br />
&#160;&#160;&#160; File file;<br />
&#160;&#160;&#160; File fileTemp;<br />
<br />
&#160;&#160;&#160; public&#160; rename(String path, String temp) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; /*Comprobamos su existencia*/<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; existe arch = new existe();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (!arch.existe(temp)) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /*borramos basura*/<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; path = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; arch = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; file = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; new utilidad.gc();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; file = new File(path);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; fileTemp = new File(temp);<br />
&#160;&#160;&#160;&#160;&#160;&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (!fileTemp.renameTo(file)) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println("No se pudo actualizar el systema.");<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
&#160;&#160;&#160; }<br />
}<br />
]]></description>
			<content:encoded><![CDATA[<div>Usando la clase &#8220;existe&#8221; ya posteada, pongo esta que nos renombra un archivo. De hecho es muy facíl hacerlo pero, es tu decisión si lo cambias o mejoras, solo te pido que me lo hagas saber.<br />
/**<br />
&#160;*<br />
&#160;* @author rodrigo salado anaya.<br />
&#160;*/<br />
import java.io.File;</p>
<p>public class rename {</p>
<p>&#160;&#160;&#160; File file;<br />
&#160;&#160;&#160; File fileTemp;</p>
<p>&#160;&#160;&#160; public&#160; rename(String path, String temp) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; /*Comprobamos su existencia*/<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; existe arch = new existe();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (!arch.existe(temp)) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /*borramos basura*/<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; path = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; arch = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; file = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; new utilidad.gc();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; file = new File(path);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; fileTemp = new File(temp);<br />
&#160;&#160;&#160;&#160;&#160;&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (!fileTemp.renameTo(file)) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(&#8220;No se pudo actualizar el systema.&#8221;);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
&#160;&#160;&#160; }<br />
}
</div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://rodrigo-salado-anaya.blog.com/2008/06/05/renombrar-un-archivo-en-java-rename/feed/</wfw:commentRss>
		</item>
		<item>
		<title>crear un archivo en Java (touch).</title>
		<link>http://rodrigo-salado-anaya.blog.com/2008/06/05/crear-un-archivo-en-java-touch/</link>
		<comments>http://rodrigo-salado-anaya.blog.com/2008/06/05/crear-un-archivo-en-java-touch/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 20:08:08 +0000</pubDate>
		<dc:creator>trade</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[Usando la clase "existe" que ya publique, vamos a crear un nuevo archivo.<br />
Pongo dos opciones una que lo crea y retorna el File y otro que lo intenta crear informandonos, si se creo o no.<br />
<br />
/**<br />
&#160;*<br />
&#160;* @author trade<br />
&#160;*/<br />
import java.io.File;<br />
<br />
public class nuevo {<br />
<br />
&#160;&#160;&#160; File file;<br />
<br />
&#160;&#160;&#160; public nuevo() {<br />
&#160;&#160;&#160; }<br />
<br />
&#160;&#160;&#160; public File nuevo(String path) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; /*Comprobamos su existencia*/<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; existe arch = new existe();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (arch.existe(path)) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /*borramos basura*/<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; path = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; arch = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; file = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; new utilidad.gc();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; file = new File(path);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; /*borramos basura*/<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; arch = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; path = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; new utilidad.gc();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; return file;<br />
&#160;&#160;&#160; }<br />
<br />
&#160;&#160;&#160; public boolean archivo(String path) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; /*Comprobamos su existencia*/<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; existe arch = new existe();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (arch.existe(path)) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /*borramos basura*/<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; path = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; arch = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; file = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; new utilidad.gc();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return false;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; file = new File(path);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; /*borramos basura*/<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; arch = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; path = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; new utilidad.gc();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; return true;<br />
&#160;&#160;&#160; }<br />
<br />
&#160;&#160;&#160; public File getObj() {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; return file;<br />
&#160;&#160;&#160; }<br />
}<br />
<br />
]]></description>
			<content:encoded><![CDATA[<div>Usando la clase &#8220;existe&#8221; que ya publique, vamos a crear un nuevo archivo.<br />
Pongo dos opciones una que lo crea y retorna el File y otro que lo intenta crear informandonos, si se creo o no.</p>
<p>/**<br />
&#160;*<br />
&#160;* @author trade<br />
&#160;*/<br />
import java.io.File;</p>
<p>public class nuevo {</p>
<p>&#160;&#160;&#160; File file;</p>
<p>&#160;&#160;&#160; public nuevo() {<br />
&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160; public File nuevo(String path) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; /*Comprobamos su existencia*/<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; existe arch = new existe();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (arch.existe(path)) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /*borramos basura*/<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; path = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; arch = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; file = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; new utilidad.gc();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; file = new File(path);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; /*borramos basura*/<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; arch = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; path = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; new utilidad.gc();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; return file;<br />
&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160; public boolean archivo(String path) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; /*Comprobamos su existencia*/<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; existe arch = new existe();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (arch.existe(path)) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /*borramos basura*/<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; path = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; arch = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; file = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; new utilidad.gc();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return false;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; file = new File(path);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; /*borramos basura*/<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; arch = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; path = null;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; new utilidad.gc();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; return true;<br />
&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160; public File getObj() {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; return file;<br />
&#160;&#160;&#160; }<br />
}</p>
</div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://rodrigo-salado-anaya.blog.com/2008/06/05/crear-un-archivo-en-java-touch/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Borrar un directorio en Java (rmdir).</title>
		<link>http://rodrigo-salado-anaya.blog.com/2008/06/05/borrar-un-directorio-en-java-rmdir/</link>
		<comments>http://rodrigo-salado-anaya.blog.com/2008/06/05/borrar-un-directorio-en-java-rmdir/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 19:58:43 +0000</pubDate>
		<dc:creator>trade</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[Esta clase borra un directorio.<br />
<br />
/**<br />
&#160;*<br />
&#160;* @author rodrigo salado anaya<br />
&#160;*/<br />
import java.io.File;<br />
<br />
public class rmDir {<br />
<br />
&#160;&#160;&#160; File directorio;<br />
<br />
&#160;&#160;&#160; public rmDir(String path) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; directorio = new File(path);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (directorio.isDirectory()) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; directorio.delete();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
<br />
&#160;&#160;&#160; }<br />
}<br />
<br />
]]></description>
			<content:encoded><![CDATA[<div>Esta clase borra un directorio.</p>
<p>/**<br />
&#160;*<br />
&#160;* @author rodrigo salado anaya<br />
&#160;*/<br />
import java.io.File;</p>
<p>public class rmDir {</p>
<p>&#160;&#160;&#160; File directorio;</p>
<p>&#160;&#160;&#160; public rmDir(String path) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; directorio = new File(path);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (directorio.isDirectory()) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; directorio.delete();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160; }<br />
}</p>
</div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://rodrigo-salado-anaya.blog.com/2008/06/05/borrar-un-directorio-en-java-rmdir/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Crear un directorio en Java (mkdir).</title>
		<link>http://rodrigo-salado-anaya.blog.com/2008/06/05/crear-un-directorio-en-java-mkdir/</link>
		<comments>http://rodrigo-salado-anaya.blog.com/2008/06/05/crear-un-directorio-en-java-mkdir/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 19:54:40 +0000</pubDate>
		<dc:creator>trade</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[Esta clase crea un directorio.<br />
<br />
/**<br />
&#160;*<br />
&#160;* @author rodrigo salado anaya<br />
&#160;*/<br />
import java.io.File;<br />
<br />
public class mkDir {<br />
<br />
&#160;&#160;&#160; File directorio;<br />
<br />
&#160;&#160;&#160; public mkDir(String path) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; directorio = new File(path);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (!directorio.isDirectory()) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; directorio.mkdir();<br />
<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
&#160;&#160;&#160; }<br />
}<br />
<br />
<br />
]]></description>
			<content:encoded><![CDATA[<div>Esta clase crea un directorio.</p>
<p>/**<br />
&#160;*<br />
&#160;* @author rodrigo salado anaya<br />
&#160;*/<br />
import java.io.File;</p>
<p>public class mkDir {</p>
<p>&#160;&#160;&#160; File directorio;</p>
<p>&#160;&#160;&#160; public mkDir(String path) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; directorio = new File(path);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (!directorio.isDirectory()) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; directorio.mkdir();</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
&#160;&#160;&#160; }<br />
}</p>
<p>
</div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://rodrigo-salado-anaya.blog.com/2008/06/05/crear-un-directorio-en-java-mkdir/feed/</wfw:commentRss>
		</item>
		<item>
		<title>obtener fecha y hora en Java.</title>
		<link>http://rodrigo-salado-anaya.blog.com/2008/06/05/obtener-fecha-y-hora-en-java/</link>
		<comments>http://rodrigo-salado-anaya.blog.com/2008/06/05/obtener-fecha-y-hora-en-java/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 19:37:27 +0000</pubDate>
		<dc:creator>trade</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[Esta clase sirve para poder obtener la facha y la hora del sistema en Java. Estuve buscando y no encostre un ejemplo concreto en la red, así que me dirigí ala documentación de Java y decidí dar esta clase para uso de quien lo necesite.<br />
<br />
/**<br />
&#160;*<br />
&#160;* @author rodrigo salado anaya<br />
&#160;*/<br />
import java.util.*;<br />
import java.text.SimpleDateFormat;<br />
<br />
public class fechaHora {<br />
<br />
&#160;&#160;&#160; public fechaHora() {<br />
<br />
&#160;&#160;&#160; }<br />
<br />
&#160;&#160;&#160; public String putIdH() {<br />
<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Calendar calendario = new GregorianCalendar();<br />
&#160;&#160; &#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; SimpleDateFormat horaformat = new SimpleDateFormat("HH:mm:ss");<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; String hora = horaformat.format(calendario.getTime());<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; return hora;<br />
&#160;&#160;&#160; }<br />
<br />
&#160;&#160;&#160; public String putIdF() {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Calendar calendario = new GregorianCalendar();<br />
&#160;&#160;&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; SimpleDateFormat dateformat = new SimpleDateFormat("dd-MM-yy");<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; String fecha = dateformat.format(calendario.getTime());<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; return fecha;<br />
&#160;&#160;&#160; }<br />
<br />
&#160;&#160;&#160; public void putFechaHora() {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Calendar calendario = new GregorianCalendar();<br />
&#160;&#160;&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; SimpleDateFormat dateformat = new SimpleDateFormat("dd-MMMM-yyyy");<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; SimpleDateFormat horaformat = new SimpleDateFormat("HH:mm:ss");<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; String fecha = dateformat.format(calendario.getTime());<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; String hora = horaformat.format(calendario.getTime());<br />
<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(fecha + "&#160;&#160; " + hora);<br />
&#160;&#160;&#160; }<br />
}<br />
<br />
Un ejemplo de uso seria así:<br />
<br />
fechaHora fh = new fechaHora();<br />
String id = fh.putIdF();<br />
<br />
<br />
<br />
Por: <a href="http://rodrigo-salado-anaya.blog.com">Rodrigo Salado Anaya.</a><br />
]]></description>
			<content:encoded><![CDATA[<div>Esta clase sirve para poder obtener la facha y la hora del sistema en Java. Estuve buscando y no encostre un ejemplo concreto en la red, así que me dirigí ala documentación de Java y decidí dar esta clase para uso de quien lo necesite.</p>
<p>/**<br />
&#160;*<br />
&#160;* @author rodrigo salado anaya<br />
&#160;*/<br />
import java.util.*;<br />
import java.text.SimpleDateFormat;</p>
<p>public class fechaHora {</p>
<p>&#160;&#160;&#160; public fechaHora() {</p>
<p>&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160; public String putIdH() {</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Calendar calendario = new GregorianCalendar();<br />
&#160;&#160; &#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; SimpleDateFormat horaformat = new SimpleDateFormat(&#8220;HH:mm:ss&#8221;);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; String hora = horaformat.format(calendario.getTime());<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; return hora;<br />
&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160; public String putIdF() {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Calendar calendario = new GregorianCalendar();<br />
&#160;&#160;&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; SimpleDateFormat dateformat = new SimpleDateFormat(&#8220;dd-MM-yy&#8221;);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; String fecha = dateformat.format(calendario.getTime());<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; return fecha;<br />
&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160; public void putFechaHora() {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Calendar calendario = new GregorianCalendar();<br />
&#160;&#160;&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; SimpleDateFormat dateformat = new SimpleDateFormat(&#8220;dd-MMMM-yyyy&#8221;);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; SimpleDateFormat horaformat = new SimpleDateFormat(&#8220;HH:mm:ss&#8221;);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; String fecha = dateformat.format(calendario.getTime());<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; String hora = horaformat.format(calendario.getTime());</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(fecha + &#8220;&#160;&#160; &#8221; + hora);<br />
&#160;&#160;&#160; }<br />
}</p>
<p>Un ejemplo de uso seria así:</p>
<p>fechaHora fh = new fechaHora();<br />
String id = fh.putIdF();</p>
<p>Por: <a href="http://rodrigo-salado-anaya.blog.com">Rodrigo Salado Anaya.</a>
</div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://rodrigo-salado-anaya.blog.com/2008/06/05/obtener-fecha-y-hora-en-java/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Escribir en un archivo.txt desde Java</title>
		<link>http://rodrigo-salado-anaya.blog.com/2008/06/04/escribir-en-un-archivotxt-desde-java/</link>
		<comments>http://rodrigo-salado-anaya.blog.com/2008/06/04/escribir-en-un-archivotxt-desde-java/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 14:17:31 +0000</pubDate>
		<dc:creator>trade</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[Hacer una programa que guarde texto, en un archivo cualquiera; lo crea si no existe y si ya existe escribe al final del mismo, Siempre es útil así que aquí lo dejo.<br />
<br />
De hecho se puede guardar todo tipo de dato, ya que en Java todo se pueden convertir explicita mente en texto.<br />
<br />
/**<br />
&#160;*<br />
&#160;* @author rodrigo salado anaya<br />
&#160;*/<br />
import java.io.FileWriter;<br />
<br />
public class ejemplo {<br />
<br />
&#160;&#160;&#160; public static void main(String[] args) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; graba g = new graba();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; g.rec("Linux, OpenSolaris, FreeBSD, IRIX\n", "prueba1.txt");<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; g.rec("Debian, SuSE, Mandrivia, Slax&#160;&#160;&#160; \n", "prueba1.txt");<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; g.rec("México, Japon, Alemania, Rusia&#160;&#160; \n", "prueba1.txt");<br />
&#160;&#160;&#160; }<br />
}<br />
<br />
class graba {<br />
<br />
&#160;&#160;&#160; FileWriter f = null;<br />
<br />
&#160;&#160;&#160; public void rec(String s, String path) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; path = "/home/rodrigo/" + path;<br />
<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; f = new FileWriter(path, true);<br />
<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (java.io.IOException ex) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.err.println("Hubo un error_archivoPkg_backUp_1" + ex);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; f.write(s, 0, s.length());<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (java.io.IOException ex) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.err.println("Hubo un error_archivoPkg_backUp_2" + ex);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; } finally {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (f != null) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; f.close();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (java.io.IOException ex) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.err.println("Hubo un error_archivoPkg_backUp_3" + ex);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
&#160;&#160;&#160; }<br />
}<br />
<br />
run:<br />
rodrigo@debianHP:~$ cat prueba1.txt<br />
Linux, OpenSolaris, FreeBSD, IRIX<br />
Debian, SuSE, Mandrivia, Slax<br />
México, Japon, Alemania, Rusia<br />
<br />
<a href="http://rodrigo-salado-anaya.blog.com">Por: Rodrigo Salado Anaya.</a><br />
<br />
]]></description>
			<content:encoded><![CDATA[<div>Hacer una programa que guarde texto, en un archivo cualquiera; lo crea si no existe y si ya existe escribe al final del mismo, Siempre es útil así que aquí lo dejo.</p>
<p>De hecho se puede guardar todo tipo de dato, ya que en Java todo se pueden convertir explicita mente en texto.</p>
<p>/**<br />
&#160;*<br />
&#160;* @author rodrigo salado anaya<br />
&#160;*/<br />
import java.io.FileWriter;</p>
<p>public class ejemplo {</p>
<p>&#160;&#160;&#160; public static void main(String[] args) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; graba g = new graba();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; g.rec(&#8220;Linux, OpenSolaris, FreeBSD, IRIX\n&#8221;, &#8220;prueba1.txt&#8221;);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; g.rec(&#8220;Debian, SuSE, Mandrivia, Slax&#160;&#160;&#160; \n&#8221;, &#8220;prueba1.txt&#8221;);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; g.rec(&#8220;México, Japon, Alemania, Rusia&#160;&#160; \n&#8221;, &#8220;prueba1.txt&#8221;);<br />
&#160;&#160;&#160; }<br />
}</p>
<p>class graba {</p>
<p>&#160;&#160;&#160; FileWriter f = null;</p>
<p>&#160;&#160;&#160; public void rec(String s, String path) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; path = &#8220;/home/rodrigo/&#8221; + path;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; f = new FileWriter(path, true);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (java.io.IOException ex) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.err.println(&#8220;Hubo un error_archivoPkg_backUp_1&#8243; + ex);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; f.write(s, 0, s.length());<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (java.io.IOException ex) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.err.println(&#8220;Hubo un error_archivoPkg_backUp_2&#8243; + ex);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; } finally {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (f != null) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; f.close();<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (java.io.IOException ex) {<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.err.println(&#8220;Hubo un error_archivoPkg_backUp_3&#8243; + ex);<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />
&#160;&#160;&#160; }<br />
}</p>
<p>run:<br />
rodrigo@debianHP:~$ cat prueba1.txt<br />
Linux, OpenSolaris, FreeBSD, IRIX<br />
Debian, SuSE, Mandrivia, Slax<br />
México, Japon, Alemania, Rusia</p>
<p><a href="http://rodrigo-salado-anaya.blog.com">Por: Rodrigo Salado Anaya.</a></p>
</div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://rodrigo-salado-anaya.blog.com/2008/06/04/escribir-en-un-archivotxt-desde-java/feed/</wfw:commentRss>
		</item>
		<item>
		<title>robot (I)</title>
		<link>http://rodrigo-salado-anaya.blog.com/2008/06/04/robot-i/</link>
		<comments>http://rodrigo-salado-anaya.blog.com/2008/06/04/robot-i/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 13:37:57 +0000</pubDate>
		<dc:creator>trade</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[Con un amigo y compañero por un tiempo "Angel Francisco Alarcon" y un servidor nos encantaba estar construyendo y reconstruyendo un pequeño Kit de robotica que nos prestaban en La UNAM FESC c4. Aquí les dejo una foto de ejemplo:<br />
<br />
<img src="http://amadeo.blog.com/repository/538573/3231707.jpg" align="bottom" /><br />
<br />
Estaba padrisimo por que tenia un montos de sensores; no muy sofisticados por cierto, motores muy ruidosos, y un procesador como de 600M, la verdad no me acuerdo con esactitud, tambien se podia programar con un "DK" muy parecido al de C, casi todas las instruccion eras iguales, también tenia un "IDE" en modo grafico, pero nunca me gusto.
]]></description>
			<content:encoded><![CDATA[<div>Con un amigo y compañero por un tiempo &#8220;Angel Francisco Alarcon&#8221; y un servidor nos encantaba estar construyendo y reconstruyendo un pequeño Kit de robotica que nos prestaban en La UNAM FESC c4. Aquí les dejo una foto de ejemplo:</p>
<p><img src="http://amadeo.blog.com/repository/538573/3231707.jpg" align="bottom" /></p>
<p>Estaba padrisimo por que tenia un montos de sensores; no muy sofisticados por cierto, motores muy ruidosos, y un procesador como de 600M, la verdad no me acuerdo con esactitud, tambien se podia programar con un &#8220;DK&#8221; muy parecido al de C, casi todas las instruccion eras iguales, también tenia un &#8220;IDE&#8221; en modo grafico, pero nunca me gusto.
</p></div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://rodrigo-salado-anaya.blog.com/2008/06/04/robot-i/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Universidad de Cuautitlan Izcalli (UCI)</title>
		<link>http://rodrigo-salado-anaya.blog.com/2008/06/04/universidad-de-cuautitlan-izcalli-uci/</link>
		<comments>http://rodrigo-salado-anaya.blog.com/2008/06/04/universidad-de-cuautitlan-izcalli-uci/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 13:09:38 +0000</pubDate>
		<dc:creator>trade</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[Y ya sabia algo al respecto, pero hasta a penas encontre el articulo. Resulta que la UCI (Escuela el la que estudie Ing.), quedo en un buen lugar dentro de las mejores en Ingeniería; tomando en cuanta todas las que hay!.<br />
<br />
No me sorprende ya que tuve unos excelentes profesores y unos compañeros que hoy en día son muy buenos en lo que hacen.<br />
<br />
<a href="http://farm2.static.flickr.com/1024/968478232_32e1d37d4d_o_d.jpg"><img src="http://amadeo.blog.com/repository/538573/3231673.jpg" align="bottom" /></a><br />
<a href="http://www.flickr.com/photos/guapads/968478232/">http://www.flickr.com/photos/guapads/968478232/</a><br />
<br />
Pagína de la UCI:<br />
<br />
<a href="http://www.udeci.edu.mx/"><img src="http://amadeo.blog.com/repository/538573/3231682.jpg" align="bottom" /></a><br />
<a href="http://www.udeci.edu.mx/">http://www.udeci.edu.mx/</a>
]]></description>
			<content:encoded><![CDATA[<div>Y ya sabia algo al respecto, pero hasta a penas encontre el articulo. Resulta que la UCI (Escuela el la que estudie Ing.), quedo en un buen lugar dentro de las mejores en Ingeniería; tomando en cuanta todas las que hay!.</p>
<p>No me sorprende ya que tuve unos excelentes profesores y unos compañeros que hoy en día son muy buenos en lo que hacen.</p>
<p><a href="http://farm2.static.flickr.com/1024/968478232_32e1d37d4d_o_d.jpg"><img src="http://amadeo.blog.com/repository/538573/3231673.jpg" align="bottom" /></a><br />
<a href="http://www.flickr.com/photos/guapads/968478232/">http://www.flickr.com/photos/guapads/968478232/</a></p>
<p>Pagína de la UCI:</p>
<p><a href="http://www.udeci.edu.mx/"><img src="http://amadeo.blog.com/repository/538573/3231682.jpg" align="bottom" /></a><br />
<a href="http://www.udeci.edu.mx/">http://www.udeci.edu.mx/</a>
</div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://rodrigo-salado-anaya.blog.com/2008/06/04/universidad-de-cuautitlan-izcalli-uci/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Concursos</title>
		<link>http://rodrigo-salado-anaya.blog.com/2008/06/04/concursos/</link>
		<comments>http://rodrigo-salado-anaya.blog.com/2008/06/04/concursos/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 12:43:51 +0000</pubDate>
		<dc:creator>trade</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[Me he interesado desde ya hace mucho por todo lo relacionado a la tecnología, y por lo mismo he participado en diversos concursos, de hecho han sido más de dos, pero por lo mientras pongo esto:<br />
<br />
En la peparatoria otro compañero y yo diseñamos, contruimos un matamoscas electrico; muy peligroso por cierto:<br />
<img src="http://amadeo.blog.com/repository/538573/3231646.jpg" align="bottom" /><br />
<br />
Y ya en la universidad, participaba activamente en el desarrollo de proyectos:<br />
<img src="http://amadeo.blog.com/repository/538573/3231650.jpg" align="bottom" /><br />
]]></description>
			<content:encoded><![CDATA[<div>Me he interesado desde ya hace mucho por todo lo relacionado a la tecnología, y por lo mismo he participado en diversos concursos, de hecho han sido más de dos, pero por lo mientras pongo esto:</p>
<p>En la peparatoria otro compañero y yo diseñamos, contruimos un matamoscas electrico; muy peligroso por cierto:<br />
<img src="http://amadeo.blog.com/repository/538573/3231646.jpg" align="bottom" /></p>
<p>Y ya en la universidad, participaba activamente en el desarrollo de proyectos:<br />
<img src="http://amadeo.blog.com/repository/538573/3231650.jpg" align="bottom" />
</div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://rodrigo-salado-anaya.blog.com/2008/06/04/concursos/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Entarada de Datos en Java</title>
		<link>http://rodrigo-salado-anaya.blog.com/2008/06/04/entarada-de-datos-en-java/</link>
		<comments>http://rodrigo-salado-anaya.blog.com/2008/06/04/entarada-de-datos-en-java/#comments</comments>
		<pubDate>Tue, 03 Jun 2008 19:35:37 +0000</pubDate>
		<dc:creator>trade</dc:creator>
		
		<guid isPermaLink="false"></guid>
		<description><![CDATA[Siempre he pensado que es un dolor de cabeza estar implementado métodos de entrada de datos como: scanner o buffered reader, así que dejo a disposición de ustedes la clase "entrada", la cual puede capturar errores y en caso de una implementación, usar la suerte de poder salir de manera muy elegante.<br />
<br />
/**<br />
*<br />
* @author rodrigo salado anaya<br />
*/<br />
import java.io.IOException;<br />
<br />
public class ejem {<br />
&#160;&#160;&#160; public static void main(String[] args) {<br />
<br />
&#160;&#160;&#160; &#160;&#160;&#160; entrada io = new entrada();<br />
<br />
&#160;&#160;&#160; &#160;&#160;&#160; int a = io.setInt("a = ");<br />
&#160;&#160;&#160; &#160;&#160;&#160; if(a == -1){<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return;<br />
&#160;&#160;&#160; &#160;&#160;&#160; }<br />
<br />
&#160;&#160;&#160; &#160;&#160;&#160; float b = io.setFlo("b = ");<br />
&#160;&#160;&#160; &#160;&#160;&#160; double c = io.setDou("c = ");<br />
&#160;&#160;&#160; &#160;&#160;&#160; String d = io.setStr("n = ");<br />
&#160;&#160;&#160; &#160;&#160;&#160; char e = io.setChar("s/n: ");<br />
&#160;&#160;&#160; }<br />
}<br />
<br />
class entrada {<br />
&#160;&#160;&#160; public int setInt(String text) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; java.io.BufferedReader e =<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; new java.io.BufferedReader(new java.io.InputStreamReader(System.in));<br />
&#160;&#160;&#160; &#160;&#160;&#160; int intD = -1;<br />
&#160;&#160;&#160; &#160;&#160;&#160; boolean v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; String buff = "";<br />
&#160;&#160;&#160; &#160;&#160;&#160; do {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; try {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.print(text);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = e.readLine();<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = buff.toLowerCase();<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (buff.equals("salir")) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return -1;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; intD = Integer.parseInt(buff);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = false;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } catch (java.io.IOException ex) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.println("Ingrese un Número entero!!!");<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } catch (NumberFormatException ex) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.println("Ingrese un Número entero!!!");<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160;&#160; } while (v);<br />
&#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; return intD;<br />
&#160;&#160;&#160; }<br />
<br />
/************************************************/<br />
&#160;&#160;&#160; public float setFlo(String text) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; java.io.BufferedReader e =<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; new java.io.BufferedReader(new java.io.InputStreamReader(System.in));<br />
&#160;&#160;&#160; &#160;&#160;&#160; float floD = -1f;<br />
&#160;&#160;&#160; &#160;&#160;&#160; boolean v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; String buff = "";<br />
&#160;&#160;&#160; &#160;&#160;&#160; do {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; try {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.print(text);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = e.readLine();<br />
&#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; &#160;&#160;&#160; if (buff.equals("salir")) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return -1;<br />
&#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; &#160;&#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; floD = Float.parseFloat(buff + "d");<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = false;<br />
&#160;&#160;&#160; &#160;&#160; &#160; &#160; &#160; &#160;&#160; } catch (java.io.IOException ex) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; &#160;&#160;&#160; System.out.println("Ingrese un Número decimal!!!");<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; } catch (NumberFormatException ex) {<br />
&#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; &#160;&#160; &#160; &#160;&#160; System.out.println("Ingrese un Número decimal!!!");<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; } while (v);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return floD;<br />
&#160;&#160;&#160; &#160;&#160;&#160; }<br />
<br />
/************************************************/<br />
<br />
&#160;&#160;&#160; public double setDou(String text) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; java.io.BufferedReader e =<br />
&#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; new java.io.BufferedReader(new java.io.InputStreamReader(System.in));<br />
&#160;&#160;&#160; &#160;&#160;&#160; double douD = -1d;<br />
&#160;&#160;&#160; &#160;&#160;&#160; boolean v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; String buff = "";<br />
&#160;&#160;&#160; &#160;&#160;&#160; do {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; try {<br />
&#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; &#160;&#160;&#160; System.out.print(text);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = e.readLine();<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (buff.equals("salir")) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return -1;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; douD = Double.parseDouble(buff + "d");<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; v = false;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } catch (java.io.IOException ex) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.println("Ingrese un Número decimal!!!");<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } catch (NumberFormatException ex) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.println("Ingrese un Número decimal!!!");<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } while (v);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return douD;<br />
&#160;&#160;&#160; &#160;&#160;&#160; }<br />
/************************************************/<br />
&#160;&#160;&#160; public char setChar(String text) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; java.io.BufferedReader e =<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; new java.io.BufferedReader(new java.io.InputStreamReader(System.in));<br />
&#160;&#160;&#160; &#160;&#160;&#160; char strC = 'n';<br />
&#160;&#160;&#160; &#160;&#160;&#160; boolean v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; do {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; try {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.print(text);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (text.contains("salir")) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return 'n';<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; strC = (char) e.read();<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; e.readLine();<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = false;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } catch (java.io.IOException ex) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.println("ErrorIOE: e_setChar_1" + ex);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } catch (NumberFormatException ex) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.println("ErrorIOE: e_setChar_2" + ex);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160;&#160; } while (v);<br />
&#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; return strC;<br />
&#160;&#160;&#160; }<br />
<br />
/************************************************/<br />
&#160;&#160;&#160; public String setStr(String text) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; java.io.BufferedReader e =<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; new java.io.BufferedReader(new java.io.InputStreamReader(System.in));<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; String strD = "-1";<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; boolean v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; do {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; try {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.print(text);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; strD = strD.toLowerCase();<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (strD.equals("salir")) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; strD = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return "-1";<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; strD = e.readLine();<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = false;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } catch (IOException ex) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.println("ErrorIOE: e_setStr_1" + ex);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } catch (NumberFormatException ex) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.println("ErrorIOE: e_setStr_2" + ex);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } while (v);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return strD;<br />
&#160;&#160;&#160; &#160;&#160;&#160; }<br />
}<br />
<br />
Por: <a href="http://rodrigo-salado-anaya.blog.com">Rodrigo Salado Anaya.<br /></a>
]]></description>
			<content:encoded><![CDATA[<div>Siempre he pensado que es un dolor de cabeza estar implementado métodos de entrada de datos como: scanner o buffered reader, así que dejo a disposición de ustedes la clase &#8220;entrada&#8221;, la cual puede capturar errores y en caso de una implementación, usar la suerte de poder salir de manera muy elegante.</p>
<p>/**<br />
*<br />
* @author rodrigo salado anaya<br />
*/<br />
import java.io.IOException;</p>
<p>public class ejem {<br />
&#160;&#160;&#160; public static void main(String[] args) {</p>
<p>&#160;&#160;&#160; &#160;&#160;&#160; entrada io = new entrada();</p>
<p>&#160;&#160;&#160; &#160;&#160;&#160; int a = io.setInt(&#8220;a = &#8220;);<br />
&#160;&#160;&#160; &#160;&#160;&#160; if(a == -1){<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return;<br />
&#160;&#160;&#160; &#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160; &#160;&#160;&#160; float b = io.setFlo(&#8220;b = &#8220;);<br />
&#160;&#160;&#160; &#160;&#160;&#160; double c = io.setDou(&#8220;c = &#8220;);<br />
&#160;&#160;&#160; &#160;&#160;&#160; String d = io.setStr(&#8220;n = &#8220;);<br />
&#160;&#160;&#160; &#160;&#160;&#160; char e = io.setChar(&#8220;s/n: &#8220;);<br />
&#160;&#160;&#160; }<br />
}</p>
<p>class entrada {<br />
&#160;&#160;&#160; public int setInt(String text) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; java.io.BufferedReader e =<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; new java.io.BufferedReader(new java.io.InputStreamReader(System.in));<br />
&#160;&#160;&#160; &#160;&#160;&#160; int intD = -1;<br />
&#160;&#160;&#160; &#160;&#160;&#160; boolean v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; String buff = &#8220;&#8221;;<br />
&#160;&#160;&#160; &#160;&#160;&#160; do {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; try {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.print(text);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = e.readLine();<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = buff.toLowerCase();<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (buff.equals(&#8220;salir&#8221;)) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return -1;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; intD = Integer.parseInt(buff);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = false;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } catch (java.io.IOException ex) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.println(&#8220;Ingrese un Número entero!!!&#8221;);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } catch (NumberFormatException ex) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.println(&#8220;Ingrese un Número entero!!!&#8221;);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160;&#160; } while (v);<br />
&#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; return intD;<br />
&#160;&#160;&#160; }</p>
<p>/************************************************/<br />
&#160;&#160;&#160; public float setFlo(String text) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; java.io.BufferedReader e =<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; new java.io.BufferedReader(new java.io.InputStreamReader(System.in));<br />
&#160;&#160;&#160; &#160;&#160;&#160; float floD = -1f;<br />
&#160;&#160;&#160; &#160;&#160;&#160; boolean v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; String buff = &#8220;&#8221;;<br />
&#160;&#160;&#160; &#160;&#160;&#160; do {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; try {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.print(text);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = e.readLine();<br />
&#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; &#160;&#160;&#160; if (buff.equals(&#8220;salir&#8221;)) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return -1;<br />
&#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; &#160;&#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; floD = Float.parseFloat(buff + &#8220;d&#8221;);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = false;<br />
&#160;&#160;&#160; &#160;&#160; &#160; &#160; &#160; &#160;&#160; } catch (java.io.IOException ex) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; &#160;&#160;&#160; System.out.println(&#8220;Ingrese un Número decimal!!!&#8221;);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; } catch (NumberFormatException ex) {<br />
&#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; &#160;&#160; &#160; &#160;&#160; System.out.println(&#8220;Ingrese un Número decimal!!!&#8221;);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; } while (v);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return floD;<br />
&#160;&#160;&#160; &#160;&#160;&#160; }</p>
<p>/************************************************/</p>
<p>&#160;&#160;&#160; public double setDou(String text) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; java.io.BufferedReader e =<br />
&#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; new java.io.BufferedReader(new java.io.InputStreamReader(System.in));<br />
&#160;&#160;&#160; &#160;&#160;&#160; double douD = -1d;<br />
&#160;&#160;&#160; &#160;&#160;&#160; boolean v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; String buff = &#8220;&#8221;;<br />
&#160;&#160;&#160; &#160;&#160;&#160; do {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; try {<br />
&#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; &#160;&#160;&#160; System.out.print(text);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = e.readLine();<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (buff.equals(&#8220;salir&#8221;)) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return -1;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; douD = Double.parseDouble(buff + &#8220;d&#8221;);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160; &#160; &#160;&#160; v = false;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } catch (java.io.IOException ex) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.println(&#8220;Ingrese un Número decimal!!!&#8221;);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } catch (NumberFormatException ex) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.println(&#8220;Ingrese un Número decimal!!!&#8221;);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } while (v);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; buff = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return douD;<br />
&#160;&#160;&#160; &#160;&#160;&#160; }<br />
/************************************************/<br />
&#160;&#160;&#160; public char setChar(String text) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; java.io.BufferedReader e =<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; new java.io.BufferedReader(new java.io.InputStreamReader(System.in));<br />
&#160;&#160;&#160; &#160;&#160;&#160; char strC = &#8216;n&#8217;;<br />
&#160;&#160;&#160; &#160;&#160;&#160; boolean v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; do {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; try {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.print(text);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (text.contains(&#8220;salir&#8221;)) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return &#8216;n&#8217;;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; strC = (char) e.read();<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; e.readLine();<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = false;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } catch (java.io.IOException ex) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.println(&#8220;ErrorIOE: e_setChar_1&#8243; + ex);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } catch (NumberFormatException ex) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.println(&#8220;ErrorIOE: e_setChar_2&#8243; + ex);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160;&#160; } while (v);<br />
&#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; return strC;<br />
&#160;&#160;&#160; }</p>
<p>/************************************************/<br />
&#160;&#160;&#160; public String setStr(String text) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; java.io.BufferedReader e =<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; new java.io.BufferedReader(new java.io.InputStreamReader(System.in));<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; String strD = &#8220;-1&#8243;;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; boolean v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; do {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; try {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.print(text);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; strD = strD.toLowerCase();<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; if (strD.equals(&#8220;salir&#8221;)) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; strD = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return &#8220;-1&#8243;;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; strD = e.readLine();<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = false;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } catch (IOException ex) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.println(&#8220;ErrorIOE: e_setStr_1&#8243; + ex);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } catch (NumberFormatException ex) {<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; System.out.println(&#8220;ErrorIOE: e_setStr_2&#8243; + ex);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; v = true;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; }<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; } while (v);<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; e = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; text = null;<br />
&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return strD;<br />
&#160;&#160;&#160; &#160;&#160;&#160; }<br />
}</p>
<p>Por: <a href="http://rodrigo-salado-anaya.blog.com">Rodrigo Salado Anaya.<br /></a>
</div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://rodrigo-salado-anaya.blog.com/2008/06/04/entarada-de-datos-en-java/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
