Thread: [Beepcore-java-users] sending files in messages
Status: Beta
Brought to you by:
huston
|
From: Gabe W. <gw...@wa...> - 2002-05-27 00:56:49
|
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
|
|
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
|
|
From: Huston <hu...@us...> - 2002-05-28 04:13:16
|
> 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 Thanks! > 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. When I started the new DataStreams the idea was that InputDataStream and OutputDataStream would be the low-level DataStreams. By low-level I mean that they would provide an interface that is very basic (e.g. wouldn't have any support for mime headers) and easy/efficient to use in building the core library. InputDataStreamAdapter, StringOutputDataStream, ByteOutputDataStream, etc.were intended to provide a higher level interface including support for mime headers. There were a couple of cases where it made the code much easier if the low-level DataStreams had limited knowledge of the mime headers being used by the derived classes. So I added the code but didn't make it public because I was trying to keep the low-level DataStreams interfaces simple. Also I thought most people would be using the high-level DataStreams, I imagine it would have helped if I had written the OutputDataStreamAdapter at the same time. Anyway, that is the history behind the code. While the code is better than the previous version it could probably use some refactoring. So let me know if you have any suggestions as you are using it. --Huston |
|
From: Huston <hu...@us...> - 2002-05-28 03:17:43
|
> 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?
done.
> 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")));
A FileOutputDataStream is on the list of things todo, I should get to it
soon.
--Huston
|
|
From: William J. M. <wm...@ol...> - 2002-05-28 17:50:37
|
Gabe,
Can't you set the mime type when you create the datastream? I
thought you could.
-bill
On Sun, May 26, 2002 at 05:56:41PM -0700, Gabe Wachob wrote:
> 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
|
|
From: Gabe W. <gw...@wa...> - 2002-05-28 17:57:46
|
I can write them out by hand.
Anyway, I think Tom Dengler's code will work for me as soon as huston
accepts it into the beepcore-java codeline.
Thanks for the quick turnaround.
-Gabe
On Tue, 28 May 2002, William J. Mills wrote:
> Gabe,
>
> Can't you set the mime type when you create the datastream? I
> thought you could.
>
> -bill
>
> On Sun, May 26, 2002 at 05:56:41PM -0700, Gabe Wachob wrote:
> > 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
>
--
Gabe Wachob gw...@wa...
Personal http://www.wachob.com
Founder, WiredObjects http://www.wiredobjects.com
|