Basic Usage

Simple file access (before JCFS)
            File myfile = new File("myfile.txt");
            FileOutputStream out = new FileOutputStream(myfile);
            ....
            out.close();
            FileInputStream in = new FileInputStream(myfile);
            ....
            in.close();

            
Simple file read with JCFS
            RFile myfile = new RFile("myfile.txt");
            RFileOutputStream out = new RFileOutputStream(myfile);
            ...
            out.close();
            RFileInputStream in = new RFileInputStream(myfile);
            ....
            in.close();
            

Advanced Usage

Example on transactional write and replication-constraints
            RFile myfile = new RFile("myfile.txt");
            // requiring server to replicate at least on 2 nodes before committing transaction
            int minPeers = 2;
            WriteMode mode = WriteMode.TRANSACTION;
            RFileOutputStream out = new RFileOutputStream(myfile,mode,inPeers,false);
            ...
            // COMMIT is done on a successfull close
            out.close();