Code example for FileWriter

Methods: close, write

0
        reader.close();
        return writer.toString();
    } 
 
    public void writeFile(File file, String content) throws Exception {
        FileWriter writer = new FileWriter(file);
        writer.write(content);
        writer.close();
    } 
 
    private void assertInoperable(DiskLruCache.Editor editor) throws Exception {
        try { 
            editor.getString(0);
            fail();
        } catch (IllegalStateException expected) {
        } 
        try { 
            editor.set(0, "A");
            fail();
        } catch (IllegalStateException expected) {
        }