Re: [Beepcore-java-users] sending files in messages
Status: Beta
Brought to you by:
huston
|
From: Erols <tde...@er...> - 2002-05-27 04:36:02
|
Gabe,
I am working on a class called OutputDataStreamAdapter extends
java.io.OutputStream. It would be accessed from OutputDataStream by method
getOutputStream. This is analogous to the InputDataStream.getInputStream()
returning a java.io.InputStream extended InputDataStreamAdapter. I expect
to submit this code back to the project sometime in the near future pending
Hustons approval. My motivation was so that I could treat the payload of an
outgoing message as a java.io.OutputStream, a more intuitive interface for
what I was trying to do. Actually, sending a file as you were doing, but
would also be able to things like send streaming data over the channel. My
call sequence would be: receive a message (ex. <getfile>), create an ods,
os = ods.getOutputStream(), message.sendANS(ods) , several os.write(data) ,
os.close().
I beleive the OutputDataStreamAdapter would serve as a basis for your helper
class and would simplify your demo code. Simplified in the sense of
creating intuitive sense. I expect I will be writing a FileDataOutputStream
helper class as well and will submit it back to cvs.
The mime headers are a different beast. They seem to be in a funny place to
me as well, in the subclasses. For example, they are settable in
StringDataOutputStream and ByteDataOutputStream. [aside: I am working from
memory here, so my class names might be a bit off. I assume you know which
ones I am talking about]. I found myself in a similiar boat as you, that in
order to test my code, I had to create a class called
SettableDataOutputStream, just so I could default the MimeHeaders.
To be honest, I don't quite understand what/why the MimeHeaders are
neccesary in *all* cases anyway. But I haven't taken the time yet to
investigate either.
Huston may have some reason for this scheme, so hopefully he will enlighten
us.
I will try to catch you two on openprojects Tuesday.
tom
----- Original Message -----
From: "Gabe Wachob" <gw...@wa...>
To: <bee...@li...>
Sent: Sunday, May 26, 2002 8:56 PM
Subject: [Beepcore-java-users] sending files in messages
> I am trying to send a file in a message using beepcore-java .. I'd like to
> do a typical read loop - read from the file, send it "through" the message
> outputdatastream, read from the file, send through the message datastream,
> etc.
>
> I can use OutputDataStream and create BufferSegments each time I read from
> the file. Fine. But OutputDataStream doesn't let me set the MimeHeaders
> without subclassing.. (the constructor is protectedEGAD!! Why is this? I
> really don't want to have to subclass just to set the mime headers.
>
> Can we just make the constructor for OutputDataStream not protected?
>
> I'm writing demo code and I'm trying to make things as simple as possible.
> Another thing I'd like to see is a helper class perhaps that would take a
> file or file inputstream and wrap it in a OutputDataStream interface.
> i.e.:
>
> new Message(new FileOutputDataStream(new FileInputStream("foo.txt")));
>
> This is relativley high priority for me - I'm working on a book chapter
> about beep and it is going to use the beepcore-java libs.. if we could
> un-hide the constructor I mentioned above, that'd be the quick-n-easy
> solution.
>
> THANKS!!!
>
> -Gabe
>
> --
> Gabe Wachob gw...@wa...
> Personal http://www.wachob.com
> Founder, WiredObjects http://www.wiredobjects.com
>
>
> _______________________________________________________________
>
> Don't miss the 2002 Sprint PCS Application Developer's Conference
> August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
>
> _______________________________________________
> Beepcore-java-users mailing list
> Bee...@li...
> https://lists.sourceforge.net/lists/listinfo/beepcore-java-users
|