Code example for RandomAccessFile

Methods: closeseeksetLength

0
            ApplicationRegistry.initialise(reg, 1);
 
            // Test config 
            assertFalse(reg.getSecurityManager().accessVirtualhost("test", new InetSocketAddress("127.0.0.1", 65535)));
 
            RandomAccessFile 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=\"allow\" network=\"127.0.0.1\"/>");
            out.write("</firewall>\n");
            out.close();
 
            reg.getConfiguration().reparseConfigFileSecuritySections();
 
            assertTrue(reg.getSecurityManager().accessVirtualhost("test", new InetSocketAddress("127.0.0.1", 65535)));