dcsimg
How can i implement a <tt>getInputStream()</tt> type method for a class i've written?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Tim_Evans
Posted On:   Tuesday, June 18, 2002 08:47 AM

I'm trying to write a WAP client and i'd like to able to create something similar to the HttpURLConnection class.


The problem i have is how my WAP client class can provide an InputStream to a class using the WAP client for reading the content, much like the getInputStream() method of the HttpURLConnection class.


Just don't know where to start with this one, as its obviously not possible for my WAP client to write data to an InputStream .

Re: How can i implement a <tt>getInputStream()</tt> type method for a class i've written?

Posted By:   Stephen_Ostermiller  
Posted On:   Wednesday, June 26, 2002 04:27 AM

Write an inner class. Return an instance of the inner class when somebody calls the getInputStream() method. When the read() method of that inner class is used, provide the data.



I used this strategy when I wrote my CircularBuffer classes. The source code is available.

About | Sitemap | Contact