Code example for FileWriter

Methods: write

0
            fileBRandom = new RandomAccessFile(fileB, "rw");
            fileBRandom.setLength(0);
            fileBRandom.seek(0);
            fileBRandom.close();
 
            out = new FileWriter(fileB);
            out.write("<firewall>\n");
            out.write("\t<rule access=\"deny\" network=\"127.0.0.1\"/>");
            out.write("</firewall>\n");
            out.close();
 
            reg.getConfiguration().reparseConfigFileSecuritySections();
 
            assertFalse(reg.getSecurityManager().accessVirtualhost("test", new InetSocketAddress("127.0.0.1", 65535)));
        } 
        finally 
        { 
            ApplicationRegistry.remove(1); 
        } 
    }