package test.pkg;

import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.InputStream;
import java.io.FileNotFoundException;
import android.content.Context;
import android.content.SharedPreferences;
import android.app.Activity;
import android.os.Bundle;

public class WorldWriteableFile {
    File mFile;
    Context mContext;

    public void foo() {
        OutputStream out = null;
        SharedPreferences prefs = null;
        File dir = null;

        boolean success = false;
        try {
            out = openFileOutput(mFile.getName()); // ok
            out = openFileOutput(mFile.getName(), MODE_PRIVATE); // ok
            out = openFileOutput(mFile.getName(), MODE_WORLD_WRITEABLE);
            out = openFileOutput(mFile.getName(), MODE_WORLD_READABLE);

            prefs = getSharedPreferences(mContext, 0); // ok
            prefs = getSharedPreferences(mContext, MODE_PRIVATE); // ok
            prefs = getSharedPreferences(mContext, MODE_WORLD_WRITEABLE);
            prefs = getSharedPreferences(mContext, MODE_WORLD_READABLE);

            dir = getDir(mFile.getName(), MODE_PRIVATE); // ok
            dir = getDir(mFile.getName(), MODE_WORLD_WRITEABLE);
            dir = getDir(mFile.getName(), MODE_WORLD_READABLE);

            mFile.setReadable(true, true); // ok
            mFile.setReadable(false, true); // ok
            mFile.setReadable(false, false); // ok
            mFile.setReadable(true, false);
            mFile.setReadable(true); // ok
            mFile.setReadable(false); // ok

            mFile.setWritable(true, true); // ok
            mFile.setWritable(false, true); // ok
            mFile.setWritable(false, false); // ok
            mFile.setWritable(true, false);
            mFile.setWritable(true); // ok
            mFile.setWritable(false); // ok

            // Flickr.get().downloadPhoto(params[0], Flickr.PhotoSize.LARGE,
            // out);
            success = true;
        } catch (FileNotFoundException e) {
        }
    }
}
