Code example for DataOutputStream

Methods: close, writeUTF

0
        BufferedOutputStream b = null;
        DataOutputStream d = null;
        try { 
            f = new FileOutputStream(filePath);
            b = new BufferedOutputStream(f, BUFSIZE);
            d = new DataOutputStream(b);
            d.writeUTF(mUri.toString());
            mThumb.compress(Bitmap.CompressFormat.PNG, 100, d);
            d.close();
        } catch (IOException e) {
            return false; 
        } finally { 
            MenuHelper.closeSilently(f);
            MenuHelper.closeSilently(b);
            MenuHelper.closeSilently(d);
        } 
        return true; 
    } 
 
    // Loads the data from the specified file. 
    // Returns true for success.