\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{mamencortess} \pdfinfo{ /Title (java-files-cheat-sheet.pdf) /Creator (Cheatography) /Author (mamencortess) /Subject (Java Files Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{6985E0} \definecolor{LightBackground}{HTML}{F5F7FD} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Java Files Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{mamencortess} via \textcolor{DarkBackground}{\uline{cheatography.com/183103/cs/38116/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}mamencortess \\ \uline{cheatography.com/mamencortess} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 11th April, 2023.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Java Files}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{File es una forma de referenciar de un ruta en un sistema de ficheros. Esta ruta puede no existir físicamente o podría ser la ruta correspondiente con un directorio (carpeta).% Row Count 4 (+ 4) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Tipos de referencias}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Absoluta}}: empieza en la unidad de almacenamiento \newline % Row Count 2 (+ 2) Ej:"C:\textbackslash{}\textbackslash{}carpeta\textbackslash{}\textbackslash{}fichero.txt" \newline % Row Count 3 (+ 1) {\bf{Relativa}}: Buscan archivos dentro de la carpeta/paquete donde se ejecuta el programa. \newline % Row Count 5 (+ 2) Ej: carpeta/fichero.txt \newline % Row Count 6 (+ 1) //averiguar cuál es el directorio actual de trabajo \newline % Row Count 8 (+ 2) \seqsplit{System.getProperty("user.dir"));}% Row Count 9 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Constructores}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{File(String pathname) \newline File(String directorio, String nombreArchivo)} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Inicializar File}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{File nameFile = new File(String path);% Row Count 1 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.76 cm} x{4.24 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Métodos File}} \tn % Row 0 \SetRowColor{LightBackground} createNewFile() & si no existe, lo crea \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} delete() & borra \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} isDirectory() & true si referencia a un directorio \tn % Row Count 4 (+ 2) % Row 3 \SetRowColor{white} isFile() & true si referencia a un archivo \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} mkdir() & crea el directorio \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} mkdirs() & crea todos los directorios necesarios para crear un fichero cuya ruta coincida con la representada \tn % Row Count 12 (+ 5) % Row 6 \SetRowColor{LightBackground} length() & tamaño \tn % Row Count 13 (+ 1) % Row 7 \SetRowColor{white} listFiles() & array File{[}{]} con los archivos del directorio \tn % Row Count 16 (+ 3) % Row 8 \SetRowColor{LightBackground} canExecute(), canRead(), canWrite() & true cuando se tiene permisos de ejecución, lectura o escritura sobre un fichero \tn % Row Count 20 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Array archivos de un directorio}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{File directorio = new File("C:/"); \newline % Row Count 1 (+ 1) File{[}{]} lista; \newline % Row Count 2 (+ 1) if ((directorio.exists()) \&\& (directorio.isDirectory()))\{ \newline % Row Count 4 (+ 2) ~lista = directorio.listFiles(); \newline % Row Count 5 (+ 1) \}else\{ \newline % Row Count 6 (+ 1) ~System.out.println("El directorio no existe"); \newline % Row Count 8 (+ 2) \}% Row Count 9 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Flujo de datos/Stream}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Representa cualquier fuente que proporcione datos al programa, o cualquier sumidero que tome datos del programa. \newline % Row Count 3 (+ 3) {\bf{Flujo de datos binario/ de bytes}}: información en formato binario. más compacto. Objetos deben ser serializables. \newline % Row Count 6 (+ 3) {\bf{Flujo de datos de texto}}: información en formato de texto. Más fácil de leer desde otros lenguajes. \newline % Row Count 9 (+ 3) {\bf{Flujo de entrada/Input}}: flujos que proporcionan datos. \newline % Row Count 11 (+ 2) {\bf{Flujo de salida/Output}}: el programa escribe datos% Row Count 13 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Jerarquía Entrada/Salida en binario}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{{\emph{Output:}}}} \newline % Row Count 1 (+ 1) {\bf{Datos primitivos}}:FileOutputStream -\textgreater{} DataOutputStream \newline % Row Count 3 (+ 2) {\bf{Objetos}}:FileOutputStream -\textgreater{} ObjectOutputStream (Objetos serializables) \newline % Row Count 5 (+ 2) {\bf{{\emph{Input:}}}} \newline % Row Count 6 (+ 1) {\bf{Datos primitivos}}:FileInputStream -\textgreater{} DataInputStream \newline % Row Count 8 (+ 2) {\bf{Objetos}}:FileInputStream -\textgreater{} ObjectInputStream (Objetos serializables)% Row Count 10 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.6 cm} x{4.4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Métodos OutputStream y Writer}} \tn % Row 0 \SetRowColor{LightBackground} close() & cierra el flujo y libera recursos \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} flush() & sincroniza este flujo de datos con el dispositivo al cual se están escribiendo los datos \tn % Row Count 7 (+ 5) % Row 2 \SetRowColor{LightBackground} write(byte{[}{]} b) & escribe el array \tn % Row Count 8 (+ 1) % Row 3 \SetRowColor{white} write(byte{[}{]} b, int off, int len) & escribe len bytes del array b, empezando a escribirlos en el offset indicado por off \tn % Row Count 12 (+ 4) % Row 4 \SetRowColor{LightBackground} abstract void write(int b) & escribe 1 byte \tn % Row Count 14 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Clase abstracta que representa un flujo de datos de salida binario cualquiera} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Salida de bytes}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{8.4cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/mamencortess_1681077119_SalidaBytes.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Salida de bytes}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{File f1 = new \seqsplit{File("src/main/resources/File}.csv"); \newline % Row Count 2 (+ 2) FileOutputStream fout = null; \newline % Row Count 3 (+ 1) DataOutputStream dout = null; \newline % Row Count 4 (+ 1) ObjectOutputStream oout = null; \newline % Row Count 5 (+ 1) try \{ \newline % Row Count 6 (+ 1) ~if (f1.createNewFile()) \{ \newline % Row Count 7 (+ 1) ~~System.out.println("Se ha creado el archivo"); \newline % Row Count 9 (+ 2) ~\} \newline % Row Count 10 (+ 1) ~fout = new FileOutputStream(f1); \newline % Row Count 11 (+ 1) ~dout = new DataOutputStream(fout); \newline % Row Count 12 (+ 1) ~oout = new \seqsplit{ObjectOutputStream(fout);} \newline % Row Count 13 (+ 1) ~dout.writeChar('a'); \newline % Row Count 14 (+ 1) \seqsplit{~dout.writeBoolean(true);} \newline % Row Count 15 (+ 1) ~dout.writeInt(34); \newline % Row Count 16 (+ 1) ~dout.writeFloat(34.4f); \newline % Row Count 17 (+ 1) ~oout.writeObject(new Date()); \newline % Row Count 18 (+ 1) ~oout.writeObject(new ObjetoPrueba(4, "hola")); \newline % Row Count 20 (+ 2) \seqsplit{~dout.writeBytes("hola");} \newline % Row Count 21 (+ 1) \} catch (IOException e) \{ \newline % Row Count 22 (+ 1) ~throw new RuntimeException(e); \newline % Row Count 23 (+ 1) \} finally\{ \newline % Row Count 24 (+ 1) ~if(oout != null)\{ \newline % Row Count 25 (+ 1) ~~try\{ \newline % Row Count 26 (+ 1) ~~~oout.close(); \newline % Row Count 27 (+ 1) ~~\}catch (IOException ex) \newline % Row Count 28 (+ 1) ~~~ex.printStackTrace(); \newline % Row Count 29 (+ 1) ~~\} \newline % Row Count 30 (+ 1) } \tn \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Salida de bytes (cont)}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{~\} \newline % Row Count 1 (+ 1) ~if(fout != null)\{ \newline % Row Count 2 (+ 1) ~~try\{ \newline % Row Count 3 (+ 1) ~~~oout.close(); \newline % Row Count 4 (+ 1) ~~\}catch (IOException ex) \newline % Row Count 5 (+ 1) ~~~ex.printStackTrace(); \newline % Row Count 6 (+ 1) ~~\} \newline % Row Count 7 (+ 1) ~\} \newline % Row Count 8 (+ 1) ~if(dout != null)\{ \newline % Row Count 9 (+ 1) ~~try\{ \newline % Row Count 10 (+ 1) ~~~oout.close(); \newline % Row Count 11 (+ 1) ~~\}catch (IOException ex) \newline % Row Count 12 (+ 1) ~~~ex.printStackTrace(); \newline % Row Count 13 (+ 1) ~~\} \newline % Row Count 14 (+ 1) ~\} \newline % Row Count 15 (+ 1) \} \newline % Row Count 16 (+ 1) {\emph{//Clase ObjetoPrueba}} \newline % Row Count 17 (+ 1) class ObjetoPrueba implements Serializable \{ \newline % Row Count 18 (+ 1) ~private int a; \newline % Row Count 19 (+ 1) ~private String b; \newline % Row Count 20 (+ 1) ~public ObjetoPrueba(int a, String b) \{ \newline % Row Count 21 (+ 1) ~~this.a = a; \newline % Row Count 22 (+ 1) ~~this.b = b; \newline % Row Count 23 (+ 1) ~\} \newline % Row Count 24 (+ 1) ~@Override \newline % Row Count 25 (+ 1) ~public String toString() \{ \newline % Row Count 26 (+ 1) ~~return a+", "+b; \newline % Row Count 27 (+ 1) ~\} \newline % Row Count 28 (+ 1) \}% Row Count 29 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Salida de texto}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{8.4cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/mamencortess_1681079731_SalidaTexto.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Writer representa cualquier flujo de datos de salida donde la info. se va a representar en modo texto.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Salida Texto}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{import java.io.*; \newline % Row Count 1 (+ 1) public class Ejemplo5 \{ \newline % Row Count 2 (+ 1) ~public static void main(String{[}{]} args) \{ \newline % Row Count 3 (+ 1) ~~File file = new File("C:/datos.txt"); \newline % Row Count 4 (+ 1) ~~PrintWriter printWriter = null; \newline % Row Count 5 (+ 1) ~~try \{ \newline % Row Count 6 (+ 1) ~~~printWriter = new PrintWriter(file); \newline % Row Count 8 (+ 2) \seqsplit{~~~printWriter.println(25);} \newline % Row Count 9 (+ 1) \seqsplit{~~~printWriter.println(2.5);} \newline % Row Count 10 (+ 1) \seqsplit{~~~printWriter.println(true);} \newline % Row Count 11 (+ 1) ~~~printWriter.printl n(3.6F); \newline % Row Count 12 (+ 1) \seqsplit{~~~printWriter.println("hola"} + 2.4+ ", "+ 3); \newline % Row Count 14 (+ 2) ~~~printWriter.close(); \newline % Row Count 15 (+ 1) ~~\} catch (IOException ex) \newline % Row Count 16 (+ 1) ~~~System.out.printl ("Error durante el proceso"); \newline % Row Count 18 (+ 2) ~~~ex.printStackTrace(); \newline % Row Count 19 (+ 1) ~~\} finally \newline % Row Count 20 (+ 1) ~~... \newline % Row Count 21 (+ 1) ~~\} \newline % Row Count 22 (+ 1) ~\} \newline % Row Count 23 (+ 1) \}% Row Count 24 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Metodos InputStream y Reader}} \tn % Row 0 \SetRowColor{LightBackground} close() & cierra el flujo \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} int available() & devuelve el nº de bytes que se pueden leer sin bloqueo (solo InputStream) \tn % Row Count 5 (+ 4) % Row 2 \SetRowColor{LightBackground} int read(byte{[}{]} b) & lee bytes y almacena en array. Devuelve el numero de bytes que se han leído. -1 si se ha alcanzado el final. Si no hay bytes, espera a que haya (bloqueante) \tn % Row Count 13 (+ 8) % Row 3 \SetRowColor{white} int read() & lee un único byte \tn % Row Count 14 (+ 1) % Row 4 \SetRowColor{LightBackground} abstract int read(byte{[}{]} b, int off, int len) & lee hasta len bytes y almacena en b, empezando a leer en el offset \tn % Row Count 18 (+ 4) % Row 5 \SetRowColor{white} skip(long n) & ignora los próximos n bytes \tn % Row Count 20 (+ 2) % Row 6 \SetRowColor{LightBackground} boolean ready() & true si hay caracteres para leer (Reader) \tn % Row Count 23 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Entrada de bytes}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{8.4cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/mamencortess_1681077119_SalidaBytes.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Entrada de bytes}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{File f1 = new \seqsplit{File("src/main/resources/File}.csv"); \newline % Row Count 2 (+ 2) FileOutputStream fout; \newline % Row Count 3 (+ 1) DataOutputStream dout; \newline % Row Count 4 (+ 1) ObjectOutputStream oout; \newline % Row Count 5 (+ 1) try \{ \newline % Row Count 6 (+ 1) ~if (f1.createNewFile()) \{ \newline % Row Count 7 (+ 1) ~~System.out.println("Se ha creado el archivo"); \newline % Row Count 9 (+ 2) ~\} \newline % Row Count 10 (+ 1) ~finput = new FileInputStream(f1); \newline % Row Count 11 (+ 1) ~dinput = new DataInputStream(finput); \newline % Row Count 12 (+ 1) ~oinput = new \seqsplit{ObjectInputStream(finput);} \newline % Row Count 13 (+ 1) \seqsplit{~System.out.println(dinput.readChar());} \newline % Row Count 14 (+ 1) \seqsplit{~System.out.println(dinput.readBoolean());} \newline % Row Count 15 (+ 1) \seqsplit{~System.out.println(dinput.readInt());} \newline % Row Count 16 (+ 1) \seqsplit{~System.out.println(dinput.readFloat());} \newline % Row Count 17 (+ 1) \seqsplit{~System.out.println((Date)} oinput.readObject()); \newline % Row Count 19 (+ 2) \seqsplit{~System.out.println((ObjetoPrueba)} oinput.readObject()); \newline % Row Count 21 (+ 2) ~finp.close(); \newline % Row Count 22 (+ 1) \} catch (IOException e) \{ \newline % Row Count 23 (+ 1) ~throw new RuntimeException(e); \newline % Row Count 24 (+ 1) \} catch (ClassNotFoundException e) \{ \newline % Row Count 25 (+ 1) ~throw new RuntimeException(e); \newline % Row Count 26 (+ 1) \}finally\{ \newline % Row Count 27 (+ 1) ~... \newline % Row Count 28 (+ 1) \}% Row Count 29 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Entrada Texto}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{p{8.4cm}}{\vspace{1px}\centerline{\includegraphics[width=5.1cm]{/web/www.cheatography.com/public/uploads/mamencortess_1681079764_entradaTexto.png}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Entrada Texto}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{import java.io.*; \newline % Row Count 1 (+ 1) public class Ejemplo5 \{ \newline % Row Count 2 (+ 1) ~public static void main(String{[}{]} args) \{ \newline % Row Count 3 (+ 1) ~~File file = new File("C:/datos.txt"); \newline % Row Count 4 (+ 1) ~~FileInputStream fileInputStream = null; \newline % Row Count 6 (+ 2) ~~InputStreamReader inputStreamReader = null; \newline % Row Count 8 (+ 2) ~~BufferedReader bufferedReader = nulll; \newline % Row Count 10 (+ 2) ~~try \{ \newline % Row Count 11 (+ 1) ~~~fileInputStream = new FileInputStream(file); \newline % Row Count 13 (+ 2) ~~~inputStreamReader = new \seqsplit{InputStreamReader(fileInputStream);} \newline % Row Count 15 (+ 2) ~~~bufferedReader = new \seqsplit{BufferedReader(inputStreamReader);} \newline % Row Count 17 (+ 2) ~~~int entero = \seqsplit{Integer.parseInt(bufferedReader.readLine());} \newline % Row Count 19 (+ 2) ~~~double realDoble = \seqsplit{Double.parseDouble(bufferedReader.readLine());} \newline % Row Count 21 (+ 2) ~~~boolean logico = \seqsplit{Boolean.parseBoolean(bufferedReader.readLine());} \newline % Row Count 23 (+ 2) ~~~float real = Float.parseFloat(buffe redReader.readLine()); \newline % Row Count 25 (+ 2) \seqsplit{~~~System.out.println(entero} + " " + realDoble + " " + logico + " " + real); \newline % Row Count 27 (+ 2) \seqsplit{~~~System.out.println(buffer.readLine());} \newline % Row Count 29 (+ 2) ~~\} catch (IOException ex) \newline % Row Count 30 (+ 1) } \tn \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Entrada Texto (cont)}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{~~~System.out.printl ("Error durante el proceso"); \newline % Row Count 2 (+ 2) ~~~ex.printStackTrace(); \newline % Row Count 3 (+ 1) ~~\} finally \newline % Row Count 4 (+ 1) ~~... \newline % Row Count 5 (+ 1) ~~\} \newline % Row Count 6 (+ 1) ~\} \newline % Row Count 7 (+ 1) \}% Row Count 8 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}