Code example for Closer

Methods: close

0
public class MorphEncodingToolTest extends RandomizedTest { 
    private Closer closer = Closer.create();
 
    @After 
    public void cleanup() throws IOException {
        closer.close();
    } 
     
	@Test
	public void testTool() throws Exception {
		// Create a simple plain text file. 
		File input = super.newTempFile();
		File output = super.newTempFile();
 
		// Populate the file with data. 
		PrintWriter w = 
		    new PrintWriter(
		        new OutputStreamWriter(
		            closer.register(new FileOutputStream(input)), "UTF-8"));
		w.println("passagère\tpassager\ttag");
Contextual code suggestions in your IDE  Get Codota for Java