Mantis - Hessian
Viewing Issue Advanced Details
2352 minor always 01-22-08 08:13 03-05-08 20:51
new 3.1.4  
0002352: Hessian: serializing large data
(rep by Bjorn Melinder)

I've implemented a way to send large amounts of data over hessian, without having to interact directly with the HessianInput classes. My SerializableInputStream class wraps any input stream into a temp file which data is buffered to. Thus:

class MyServiceImpl {
   public InputStream getLotsOfData() {
      InputStream someSource = new FileInputStream("foo.mp3"); // or other source, e.g. large db result sets
      return new SerializableInputStream(someSource);

On the client side, the SerializableInputStream is deserialized using a buffered temp file internally. The connection is not kept open, since all data is deserialized directly. The end result is pretty neat, allowing us to send large data as a normal part of any api we create for any application. It also works using ObjectOutputStream / ObjectInputStream serialization... but RMI breaks this since its' marshalling layer uses ByteArrayOutputStream :/

I would be happy to share this code with the open source community. My first initial thought was to hear what you think about it, and if you think it fits into the hessian.jar or spring or anything else. Please see the attached jar (with source code included) and tell me what you think.

There are no notes attached to this issue.