反序列化抛出java.lang.ClassCastException

反序列化抛出java.lang.ClassCastException,java,android,serialization,deserialization,classcastexception,Java,Android,Serialization,Deserialization,Classcastexception,我在android设备上保存了一个序列化类。将其传输至win 10 PC,并通过以下方式加载文件: fis = new FileInputStream(result.get(i)); ois = new ObjectInputStream(fis); Object obj = ois.readObject(); Android和win 10上的课程是: public class ImgLogFile implements Serializable{ byte[] frame;

我在android设备上保存了一个序列化类。将其传输至win 10 PC,并通过以下方式加载文件:

fis = new FileInputStream(result.get(i));
ois = new ObjectInputStream(fis);
Object obj = ois.readObject();
Android和win 10上的课程是:

public class ImgLogFile implements Serializable{

        byte[] frame;
        byte[] result;
        String config;

    public String getConfig(){
            return config;
        }

    public byte[] getFrame() {
        return frame;
    }

    public byte[] getResult() {
        return result;
    }
} 
当我尝试将加载的对象强制转换到它的类中时,我得到:

Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: class [Lde.mtt.smartiePlatform.ImgLogFile; cannot be cast to class de.mtt.smartiePlatform.ImgLogFile ([Lde.mtt.smartiePlatform.ImgLogFile; and de.mtt.smartiePlatform.ImgLogFile are in unnamed module of loader 'app')
我注意到一条小路前面的“L”,但不知道它是什么意思。 我怎样才能解决这个问题

[…]类[Lde.[…]不能强制转换为类de.[…]

[
表示数组。
[L
是以下引用类型的数组

因此,您已序列化了一个数组,并试图将反序列化对象强制转换为非数组的类型


(另外,使用Java序列化也不是一个好主意。)

您建议使用什么替代方法?@Niro某种形式的JSON库似乎很常见。