Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Object Streams and DeflaterStreams together  RSS feed

Erick Smith
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm writing a client/server system in which I transmit a lot of objects back and forth. I'd like to implement the DeflaterStream/InflaterStream in order to make this process more efficient. I have gotten this to work, but only once during an execution. Here's what I have:
DeflaterOutputStream defOut = new DeflaterOutputStream(objectSocket.getOutputStream());
ObjectOutputStream objOut = new ObjectOutputStream(defOut);

I can send an object through this by using:
I have not been able to get this to work without the finish line, and that seems to close the Deflater stream, which then causes me to have to restart both streams. Am I doing something wrong?
It seems like I should be able to stop sending an object while leaving the DeflaterStream open so that I can sen another object through at a later time. Could anyone explain how to accomplish this?
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!