العودة إلى موقع برمج

عدم التعرف على mode_private في resialize

#1

السلام عليكم لدي مشكلة و اصدار خطا في MODE_PRIVATE في RESIALIZE

package com.example.coch.outils;

import android.content.Context;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.StreamCorruptedException;

/**

  • classe qui permet de resializer et deresialiser des objets
  • @auther Emds

*/
public abstract class Serializer {

private static Object Context;

/**
 * Serialization d'un objet
 *
 * @param filename
 * @param object
 */
public static void serialize(String filename, Object object, Context context) {
    try {
        FileOutputStream file;
        file = context.openFileOutput(filename, Context.MODE_PRIVATE);
        ObjectOutputStream oos;
        try {
            oos = new ObjectOutputStream(file);
            oos.writeObject(object);
            oos.flush();
            oos.close();
        } catch (IOException e) {
            // erreur de serialization
            e.printStackTrace();
        }
    } catch (FileNotFoundException e) {

    }

}

    /**
     * Deserialization d'un objet
     * @parm filename
     * @parm context
     * @return
     */
    public static Object deSerialize (String filename, Context context){

        try {
            FileInputStream file = context.openFileInput(filename);
            ObjectInputStream ois;
            try {
                ois = new ObjectInputStream(file);
                try {
                    Object object = ois.readObject();
                    ois.close();
                    return object;
                } catch (ClassNotFoundException e) {
                    e.printStackTrace();
                }
            } catch (StreamCorruptedException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        } catch (FileNotFoundException e) {
            //fichier trouve
            e.printStackTrace();
        }
        return null;

    }
}
#2

هل من الممكن تحديد المزيد من المعلومات عن المشكلة و صورة توضح المشكلة ورسالة الخطأ الظاهرة لنتمكن من معرفة الخطأ ومساعدتك.