gitweb on Svarog
projekti pod git sistemom za održavanje verzija -- projects under
the git version control system
eac889005c3672d0c48be893be8d0ae84eb9b3e7
2 import java
.nio
.file
.*;
5 * Kratka demonstracija rada sa fajlovima preko ugradjenih biblioteka
7 public class FajloviBezBiblioteke
{
8 public static void citaj(String ime
) {
9 try (BufferedReader reader
= Files
.newBufferedReader(Paths
.get(ime
))) {
11 while ((line
= reader
.readLine()) != null) {
12 System
.out
.println(line
);
14 } catch (IOException x
) {
15 System
.err
.format("IOException: %s%n", x
);
19 public static void pisi(String ime
, String sadrzaj
) {
20 try (BufferedWriter writer
= Files
.newBufferedWriter(Paths
.get(ime
))) {
21 writer
.write(sadrzaj
, 0, sadrzaj
.length());
22 } catch (IOException x
) {
23 System
.err
.format("IOException: %s%n", x
);
27 public static void main(String
[] args
) {
28 String ime
= "fajl.txt";
30 pisi("izlaz.txt","tekstic");
Svarog.pmf.uns.ac.rs/gitweb
maintanance
Doni Pracner