Results 1 to 1 of 1
  1. #1
    dan0 is offline Member
    Join Date
    Feb 2009
    Posts
    40
    Rep Power
    0

    Question [SOLVED] Converting output stream to string

    I want to convert an output stream into something that I can display. I put together the following code, but it only display incoherent text.

    Note:
    1. I do not have a preference for the output stream type. I just want to display the converted string in the console viewer, i.e. "System.out.println()"
    2. request.writeRequest(outStream); - writes to output stream

    Java Code:
    ByteArrayOutputStream outStream = new ByteArrayOutputStream();
    ...
    ...
    MultipartRequestEntity request = new MultipartRequestEntity( parts, post.getParams() );
    request.writeRequest(outStream);
    System.out.println( outStream.toString() );
    Last edited by dan0; 03-16-2009 at 05:08 PM. Reason: Posted code works; problem was with IDE

Similar Threads

  1. Java, output string, getting correct output? HELP!
    By computerboyo in forum New To Java
    Replies: 2
    Last Post: 02-25-2009, 11:44 PM
  2. Converting a String into a array.
    By taraxgoesxboom in forum New To Java
    Replies: 12
    Last Post: 02-22-2009, 05:29 AM
  3. Replies: 3
    Last Post: 02-16-2009, 09:20 PM
  4. JSP- Binary output stream
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-29-2008, 09:06 AM
  5. Converting String to Double
    By srini in forum New To Java
    Replies: 1
    Last Post: 12-24-2007, 08:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •