import java.io.*;
import java.util.Scanner;
/**
*
* @author jmkoz_000
*/
public class JavaApplication5 {
public static void odczyt1(String name) throws IOException {
FileReader in = null;
try {
in = new FileReader(name);
int znak = in.read();
while (znak != -1) {
System.out.print((char) znak);
znak = in.read();
}
} catch (FileNotFoundException ex) {
System.out.println(ex.toString());
} finally {
if (in != null) {
in.close();
}
}
}
public static void odczyt2(String name) throws IOException {
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(name));
String line;
while((line = in.readLine())!=null){
System.out.println(line);
}
} catch (FileNotFoundException ex) {
System.out.println(ex.toString());
} finally {
if (in != null) {
in.close();
}
}
}
public static void odczyt3(String name) throws IOException {
Scanner in = null;
try {
in = new Scanner(new FileReader(name));
int suma = 0;
while(in.hasNext()){
if(in.hasNextInt()){
suma += in.nextInt();
} else{
in.next();
}
}
System.out.println(suma);
} finally {
if (in != null) {
in.close();
}
}
}
public static void zapis(String nazwa) throws IOException {
FileWriter out = null;
try{
out = new FileWriter(nazwa, true);
out.write("Ala ma kota i psa\r\n");
} finally {
if (out != null) {
out.close();
}
}
}
public static void zapis2(String nazwa) throws IOException {
PrintWriter out = null;
try{
out = new PrintWriter(new FileWriter(nazwa, true));
out.printf("abc %.2f def", Math.PI);
} finally {
if (out != null) {
out.close();
}
}
}
public static void main(String[] args) throws IOException {
//odczyt2("src/javaapplication5/JavaApplication5.java");
//odczyt3("abc.txt");
zapis2("nowy.txt");
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}