{"id":690,"date":"2024-03-06T17:49:01","date_gmt":"2024-03-06T17:49:01","guid":{"rendered":"https:\/\/javigomez.org\/?p=690"},"modified":"2025-09-29T20:33:15","modified_gmt":"2025-09-29T20:33:15","slug":"u11-05-lectura-de-archivo-de-texto-caracter","status":"publish","type":"post","link":"https:\/\/javigomez.org\/index.php\/2024\/03\/06\/u11-05-lectura-de-archivo-de-texto-caracter\/","title":{"rendered":"U11-05-Lectura de archivo de texto (caracter)"},"content":{"rendered":"\n<p>El m\u00e9todo read() de la clase FileReader en Java se utiliza para leer un \u00fanico car\u00e1cter de un archivo de texto. Devuelve un valor entero que representa el punto de c\u00f3digo Unicode del car\u00e1cter le\u00eddo, o -1 si se ha llegado al final del archivo.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import java.io.FileReader;\nimport java.io.IOException;\n\npublic class A01005 {\n\n\tpublic static void main(String&#91;] args) {\n\t\tFileReader in=null;\n\t\ttry {\n\/\/\t\t\tFileReader in =  new FileReader(\"C:\\\\Users\\\\Javi\\\\Dropbox\\\\00-ESIC\\\\eclipse23-24\\\\U11\\\\src\\\\U11\\\\a.txt\");\n\t\t\tin =  new FileReader(\"src\\\\U11\\\\a.txt\");\n\t\t\tint c = in.read();\n\t\t\twhile (c!=-1) {\n\t\t\t\tSystem.out.print((char)c);\n\t\t\t\tc=in.read();\n\t\t\t}\n\t\t\t\n\t\t} catch (IOException e) {\t\n\t\t\tSystem.out.println(e);\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tin.close();\n\t\t\t} catch (IOException e) {\n\t\t\t\tSystem.out.println(e);;\n\t\t\t}\n\t\t}\n\t\t\n\t\t\/\/System.out.println(\"FIN\");\n\n\t\t\n\n\t}\n\n}<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Java U11 05 Lectura archivo caracter\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/H1DSRr2mESg?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>El m\u00e9todo read() de la clase FileReader en Java se utiliza para leer un \u00fanico car\u00e1cter de un archivo de texto. Devuelve un valor entero &hellip; <\/p>\n","protected":false},"author":1,"featured_media":691,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[68,143,203,217],"class_list":["post-690","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-caracter","tag-fichero-texto","tag-java","tag-lectura"],"_links":{"self":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/690","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/comments?post=690"}],"version-history":[{"count":1,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/690\/revisions"}],"predecessor-version":[{"id":874,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/690\/revisions\/874"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/media\/691"}],"wp:attachment":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/media?parent=690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/categories?post=690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/tags?post=690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}