try
{
CompressedMessage cMessage = new CompressedMessage(messageArea.getText(), false);
cMessage.compressMessage();
EncryptedMessage eMessage = new EncryptedMessage(MessageType.USERMESSAGE, "", cMessage);
outputStream.writeObject(eMessage);
}
catch (IOException e1)
{
System.out.println(e1);
System.exit(1);
}
我正在尝试将消息发送到服务器(本地atm),在尝试发送EncryptedMessage对象之前(以字符串形式)发送数据时没有问题。
public class EncryptedMessage
{
private MessageType type;
private String receipent;
private CompressedMessage message;
public EncryptedMessage(MessageType T, String R, CompressedMessage mes)
{
type = T;
receipent = R;
message = mes;
}
public MessageType getType()
{
return type;
}
public void setType(MessageType type)
{
this.type = type;
}
public String getReceipent()
{
return receipent;
}
public void setReceipent(String receipent)
{
this.receipent = receipent;
}
public CompressedMessage getMessage()
{
return message;
}
}
任何帮助将不胜感激
最佳答案
EncryptedMessage和CompressedMessage应该实现Serializable。