Code example for DataOutputStream

Methods: close, writeUTF

0
    public void writeText(String thing, String fname) {
        FileOutputStream fos = getFos(fname);
        if (fos == null)
            return; 
        try { 
            DataOutputStream dos = new DataOutputStream(fos);
            dos.writeUTF(thing);
            dos.close();
        } catch (IOException e) {
            Log.e(this.getClass().getName(), "Could not write text:" + thing
                    + "!"); 
            e.printStackTrace();
        } catch (Throwable th){
        	Log.e(this.getClass().getName(), "Problem writing text in "+fname, th);
        } 
    } 
 
    public String readText(String fname) {
        FileInputStream fin = getFin(fname);
        if (fin == null)
            return null;