Here is the constructor:

---------
    /**
     * Create a datasource from an input stream.
     *
     * @param is InputStream
     * @param type Content-Type
     */
    public ByteArrayDataSource(InputStream is, String type)
        throws IOException {
        this.type = type;

        ByteArrayOutputStream os = new ByteArrayOutputStream();

        byte buf[] = new byte[4096];
        int len;
        while (true){
            len = is.read(buf);
            if (len < 0)
                break;
            os.write(buf, 0, len);
        }
        data = os.toByteArray();
    }
---------

As you see, the data is read into memory. It would be an easy thing
to do to implement your own DataSource. Simply get the SOAP-Source
and look into "org.apache.soap.util.mime.ByteArrayDataSource".

But maybe there is a better datasource in JavaMail?!

If you wrote your own DataSource, that reads from an InputStream, 
tell me! I think we could also need something like that.


Christian

> -----Ursprüngliche Nachricht-----
> Von: Alain K [mailto:[EMAIL PROTECTED]]
> Gesendet: Dienstag, 5. März 2002 14:28
> An: Beer, Christian; [EMAIL PROTECTED]
> Betreff: Re: AW: CONT: Streaming large data in and out
> 
> 
> Thanks. So you're saying there no way to avoid loading
> the attachement into memory ?
> 
> Thanks for your help. We have potentially 10MB or
> larger file to exchange between java application so
> this question is crucial.
> 
> Again thank you.
> 
> Alain.
> 
>  --- "Beer, Christian" <[EMAIL PROTECTED]> a écrit : > Hi!
> > > Are your using attachement with SOAP RPC or with
> > SOAP
> > > Messaging ? 
> > 
> > I am using Messaging.
> > 
> > 
> > > I'm puzzled by the fact that 
> > > 
> > >
> > http://xml.apache.org/soap/faq/faq_chawke.html#Q5_6
> > > 
> > > Says that everything is stored in memory.
> > 
> > I don't know the internals! I only know the JavaDoc.
> > But I didn't 
> > read anything about that. But the Name is
> > ByteArrayDataSource,
> > so that it could be stored in memory as it is in
> > ByteArrayInputStream.
> > 
> > 
> > Christian 
> 
> ___________________________________________________________
> Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
> Yahoo! Mail : http://fr.mail.yahoo.com
> 

Reply via email to