Añadido resto de tema
This commit is contained in:
23
src/main/java/iesthiar/_343_OutputStreamWriter.java
Normal file
23
src/main/java/iesthiar/_343_OutputStreamWriter.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package iesthiar;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
|
||||
public class _343_OutputStreamWriter {
|
||||
public static void main(String[] args) {
|
||||
File f = new File("fichero.txt");
|
||||
try (
|
||||
FileOutputStream fos = new FileOutputStream(f, true);
|
||||
OutputStreamWriter osw = new OutputStreamWriter(fos, "ISO-8859-1");
|
||||
BufferedWriter bfw = new BufferedWriter(osw)) {
|
||||
bfw.write("Esto es un texto");
|
||||
bfw.newLine();
|
||||
bfw.write("Esto es otro texto con eñe");
|
||||
} catch (IOException ex) {
|
||||
System.err.printf("Error:%s", ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user