内部クラスのシーケンス化


シーケンス化できるのは静的内部クラスのみです
 
public void writeObject() {
        // readObject();
        ObjectOutputStream oos;
        try {
            oos = new ObjectOutputStream(this.openFileOutput("save.himi", MODE_PRIVATE));
            changeData();
            oos.writeObject(mapVector);
            oos.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

 
public void readObject() {
        try {
            
                ObjectInputStream ois = new ObjectInputStream(
                        this.openFileInput("save.himi"));

                mapVector = (Vector) (ois.readObject());
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

 
public static class MessageRememer implements Serializable{
        
        private static final long serialVersionUID= 1L;

        public MessageRememer(long accountId, long folderId, long messageId,int kind) {
            super();
            this.accountId = accountId;
            this.folderId = folderId;
            this.messageId = messageId;
            this.kind =kind;
        }
        private Long accountId;
        public Long getAccountId() {
            return accountId;
        }
        public void setAccountId(Long accountId) {
            this.accountId = accountId;
        }
        public Long getFolderId() {
            return folderId;
        }
        public void setFolderId(Long folderId) {
            this.folderId = folderId;
        }
        public Long getMessageId() {
            return messageId;
        }
        public void setMessageId(Long messageId) {
            this.messageId = messageId;
        }
        public Integer getKind() {
            return kind;
        }
        public void setKind(Integer kind) {
            this.kind = kind;
        }
        private Long folderId;
        private Long messageId;
        private Integer kind;
        
        @Override
        public boolean equals(Object o) {
            return super.equals(o);
        }
        @Override
        public int hashCode() {
            return super.hashCode();
        }
        @Override
        public String toString() {
            return super.toString();
        }
        
        
    }