On Wed, Dec 3, 2008 at 7:59 PM, Markus Wiederkehr
<[EMAIL PROTECTED]> wrote:
> Currently StorageProvider defines a method to create a Storage object
> from an InputStream because an InputStream is what you get from
> ContentHandler.
>
> But many libraries provide some kind of mechanism to write a document
> to an OutputStream. iText's PdfWriter would be one example. Writing an
> XML document with LSSerializer/LSWriter would be another. Even Mime4j
> has a writeTo() method declared in Body.
>
> So what if I wanted to create an e-mail attachment from one of these
> documents? Currently I'd have to write to a file or a
> ByteArrayOutputStream and then create a Storage by reading back the
> content. Clearly inefficient..
>
> So I propose to add OutputStream support to StorageProvider. Here's
> what it could look like:
>
>    SomeDocument doc = ...;
>    StorageProvider sp = DefaultStorageProvider.getInstance();
>    StorageOutputStream out = sp.createStorageOutputStream();
>    doc.writeTo(out);
>    Storage storage = out.toStorage();
>
> Then I would add methods to BodyFactory to create text or binary
> bodies directly from a Storage object..
>
> I could implement this on the weekend..

sounds good

- robert

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to