Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.util.Log;

import java.io.File;

import java.io.FileOutputStream;

import java.io.ObjectOutputStream;

public class Main {
    public static final String TAG = "P2PUtils";

    public static void writeObject(String root, String filename, Object object) {
        File file = new File(root, filename);
        try {
            FileOutputStream fos = new FileOutputStream(file);
            ObjectOutputStream oos = new ObjectOutputStream(fos);
            oos.writeObject(object);
            oos.flush();
            oos.close();
        } catch (Exception e) {
            Log.e(TAG, String.format("Failed to write [%s]", file), e);
        }
    }
}