クライアント/サーバアプリケーションのシリアル化のおかげで、TCP経由でオブジェクトを送信しようとしています。 TCPクライアントはアンドロイドシステムで書かれており、オブジェクトを送信するためにObjectOutputStreamを使用します。 TCPサーバーはバネ統合で書かれており、デシリアライザを使用してこのオブジェクトを読み取ろうとします。このような何か:私はデシリアライザ方式で引数であるInputSreamからのObjectInputStreamをcreateingいシリアライザとデシリアライザのインターフェイスを実装するクラスでInputStreamからオブジェクトへの変換 - Spring統合
<int-ip:tcp-connection-factory id="hosServer"
serializer="connectionSerializeDeserialize"
deserializer="connectionSerializeDeserialize" ..... >
。私はもう一度サーバーに接続しようとする瞬間までうまく動作します。次に、オブジェクト・フォームObjectInputStreamをreadObject()メソッドで読み取っているときにEOFExceptionを受け取ります。
public class CommandConverter implements Serializer<Command>, Deserializer<Command>{
private ObjectInputStream ois = null;
private ObjectOutputStream oos = null;
private CommandBuilder commandBuilder = new CommandBuilder();
public Command deserialize(InputStream inputStream) throws IOException {
if (ois == null)
ois = new ObjectInputStream(inputStream);
Command cmd = null;
try {
cmd = (Command) ois.readObject();
} catch (ClassNotFoundException e) {
commandBuilder.setCommandBuilder(new ImproperCommandBuilder());
commandBuilder.createCommand();
cmd = commandBuilder.getCommand();
} catch (InvalidClassException e) {
commandBuilder.setCommandBuilder(new ImproperCommandBuilder());
commandBuilder.createCommand();
cmd = commandBuilder.getCommand();
}
return cmd;
}
バネ統合でTCP経由でオブジェクトを送信するにはどうすればよいですか?