Hi,
I'm new in Java and learning midlet development. I got stuck in this conversion. Please help me to convert StringBuffer to InputStream. Thanks!
Hi,
I'm new in Java and learning midlet development. I got stuck in this conversion. Please help me to convert StringBuffer to InputStream. Thanks!
Do it now! Today will be yesterday tomorrow - MadSum
Hi madsum,
I cannot think of a case where conversion from StringBuffer to InputStream would be useful. What are you trying to do?
If you perform a receive operation, you read something that comes from an InputStream and you store it to an array of bytes. I would expect that you either get this array of bytes and convert it to a String or a StringBuffer.
Or if you perform a send operation, then you can convert your StringBuffer, that contain the message to be sent, to an array of bytes and send it over an OutputStream by writing your byte array to the Stream.
I receive data from socket and store them in StringBuffer form InputStream. Data is in XML format. Later I need to paras xml data. There I need InputStream again Like follows:-
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = factory.newSAXParser();
saxParser.parse(InputStream ,new EventHandler(this));
Do it now! Today will be yesterday tomorrow - MadSum
Hello madsum,
you might want to check these examples online on Nokia Developer Wiki:
http://www.developer.nokia.com/Commu..._using_JSR_172
http://www.developer.nokia.com/Commu...arsing_Example
Regards,
r2j7
well my problem wasn't about xml parsing. I saved data in StringBuffer. Later on I had to parse data where I need InputStream. Now I changed my app logic. I don' t store any StringBuffer. I parse xml data as soon as I got it from socket. Thanks any way.
Do it now! Today will be yesterday tomorrow - MadSum