Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.DataOutputStream;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import java.io.IOException;

import android.content.Context;

public class Main {
    public static void secSet(Context context, String key, String val) {
        //long now = System.currentTimeMillis();
        FileOutputStream fos = null;
        try {
            DataOutputStream dos = new DataOutputStream(
                    (fos = context.openFileOutput(key + ".mits", android.content.Context.MODE_PRIVATE)));
            dos.writeUTF(val);
        } catch (FileNotFoundException e1) {
            //e1.printStackTrace();
        } catch (IOException e1) {
            //e1.printStackTrace();
        } finally {
            if (fos != null)
                try {
                    fos.close();
                } catch (IOException ignored) {
                }
        }
    }
}