1 Reply Latest reply on May 2, 2005 11:57 AM by billstclair

    Streaming large data

    ffray

      Hi guys!

      I've been working on a project where support
      for large images is needed (10 - 250 MB).
      Instead of just uploading onto a plain file system
      a process has to be executed for billing, notifying
      the responsible persons, sorting the image into
      the correct cathegories and so on.
      So I thought j2ee could be a solution for our
      next larger release for displacing our old solution.
      But I found no explanation on how such huge amounts
      of data could be handled. I'm searching for a solution
      on NOT sending the whole image as byte [] due to
      obviously reasons.
      Is there any way to solve this? I've first tried around
      whith the serialization-process, but I stuck.
      Isn't there any way to use streaming instead of
      loading all the data into the RAM?

      Thanks in advance

      FF

        • 1. Re: Streaming large data
          billstclair

          I'm not sure I understand your problem well enough to answer, but I'll give a guess at it.

          You should be able to "chunk" the data over the wire. Have a stateful bean on the server side with a read(int cnt) method that returns the data in chunks, as a byte[] array result, much like reading chunks of an InputStream. The drawback to this is that you'll garbage collect a lot on the client, since there's no way to tell RMI to put the result in a pre-allocated buffer, but it shouldn't be too bad.