import java.io.*;
public class Archivos_2
{
static String PideDato(String Mensaje) throws IOException
{
BufferedReader EntradaDeTeclado = new BufferedReader(new InputStreamReader(System.in));
System.out.print(Mensaje + " ");
System.out.flush();
return EntradaDeTeclado.readLine();
}
public static void main(String args[]) throws IOException
{
FileOutputStream fe = null;
FileInputStream se = null;
fe = new FileOutputStream("Archivo_2.txt");
se = new FileInputStream("Archivo_2.txt");
Escribe(">> ", fe);
Lee("<< Contenido >>", se);
}
public static void Escribe(String Mensaje, FileOutputStream FF)
{
byte[] buffer = new byte[81];
int nbytes;
try
{
System.out.println("Introduzca un " + Mensaje + ": ");
nbytes = System.in.read(buffer);
FF .write(buffer, 0, nbytes);
}
catch (IOException e){}
}
public static void Lee(String Mensaje, FileInputStream FF)
{
byte[] buffer = new byte[81];
int nbytes;
try
{
System.out.println("Lectura de " + Mensaje + ": ");
nbytes = FF.read(buffer, 0, 81);
String str = new String(buffer, 0, nbytes);
System.out.println(str);
}
catch (IOException e){}
}
}