Code example for PrintStream

Methods: close, println

0
            public void run() { 
                try { 
                    File propsFile = new File(file2.toString()
                            + "/jndi.properties"); 
                    FileOutputStream fos = new FileOutputStream(propsFile);
                    PrintStream ps = new PrintStream(fos);
                    ps
                            .println("java.naming.factory.initial=org.apache.harmony.jndi.tests.javax.naming.spi.mock.MockContextFactory");
                    ps.println("java.naming.provider.url=http://test2");
                    ps.close();
 
                    InitialContext context = new InitialContext();
                    Hashtable<?, ?> env = context.getEnvironment();
                    assertEquals(
                            "org.apache.harmony.jndi.tests.javax.naming.spi.mock.MockContextFactory", 
                            env.get("java.naming.factory.initial"));
                    assertEquals("http://test2", env
                            .get("java.naming.provider.url"));
 
                    propsFile.delete();
                } catch (Exception e) {