Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User madsum's Avatar
    Join Date
    Jan 2005
    Location
    Helsinki, Finland
    Posts
    257
    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

  2. #2
    Nokia Developer Expert skalogir's Avatar
    Join Date
    Aug 2011
    Posts
    547
    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.

  3. #3
    Registered User madsum's Avatar
    Join Date
    Jan 2005
    Location
    Helsinki, Finland
    Posts
    257
    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

  4. #4

  5. #5
    Registered User madsum's Avatar
    Join Date
    Jan 2005
    Location
    Helsinki, Finland
    Posts
    257
    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

Similar Threads

  1. How to convert an InputStream to array of bytes?
    By Eng.Shefooooooo in forum Mobile Java Media (Graphics & Sounds)
    Replies: 5
    Last Post: 2009-07-17, 11:04
  2. About inputstream and stringbuffer
    By Hanibal_88 in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2007-09-16, 23:26
  3. StringBuffer question
    By javame.developer in forum Mobile Java General
    Replies: 1
    Last Post: 2007-09-14, 19:59
  4. How to convert Double into String in MIDP 1.0
    By agajewski in forum Mobile Java General
    Replies: 11
    Last Post: 2005-02-05, 09:43
  5. [40 MIDP SDK] Cannot support InputStream.available() method ??
    By kimseye in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2002-07-08, 06:35

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved