Code example for OutputStreamWriter

Methods: close, write

0
            return null; 
        } 
 
        Writer writer;
        try { 
            writer = new OutputStreamWriter(new FileOutputStream(csvFile));
        } catch (IOException e) {
            Toast.makeText(this, "Unable to write the csv file needed for transmission of data.",
                           Toast.LENGTH_SHORT).show();
            return null; 
        } 
 
        try { 
            writer.write(csvData);
        } catch (IOException e) {
            Toast.makeText(this, "Failure to write CSV text.", Toast.LENGTH_SHORT).show();
        } 
 
        try { 
            writer.close();
        } catch (IOException e) {
            Log.w(TAG, "Failure to close the output stream handle.");
        } 
 
        return csvFile;