-
October 13th, 2008, 11:06 AM
#1
Convert InputStream to String?
Is there a simple way to do this other than doing it line-by-line? I'm not sure how type casting works in Java. Below is some code I'm working on.
Code:
InputStream in = s.getInputStream();
String s;
-
October 13th, 2008, 11:37 AM
#2
Re: Convert InputStream to String?
Is there a simple way to do this other than doing it line-by-line?
Is there a simple way to do what exactly - please explain clearly what you want to do.
Below is some code I'm working on.
Are you being serious? You've provided 2 lines of code without any explanation as to what it's supposed to do. The second line is declaring the variable s which you have already used in the first line. You are calling a method getInputStream() which isn't in the String class, so what type is s.
-
October 13th, 2008, 11:48 AM
#3
Re: Convert InputStream to String?
If by convert you mean to "read" Strings from an InputStream. Wrap the InputStream in a reader and then in a BufferedReader and use its readLine() method.
Norm
-
October 13th, 2008, 12:35 PM
#4
Re: Convert InputStream to String?
PHP Code:
BufferedReader br = new BufferedReader(new InputStreamReader(is));
Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?
I had a nightmare last night. I was dreaming that I’m 64-bit and my blanket is 32-bit and I couldn’t cover myself with it, so I’ve spent the whole night freezing. And in the morning I find that my blanket just had fallen off the bed. =S (from: bash.org.ru)
//always looking for job opportunities in AU/NZ/US/CA/Europe :P
willCodeForFood(Arrays.asList("Java","PHP","C++","bash","Assembler","XML","XHTML","CSS","JS","PL/SQL"));
USE [code] TAGS! Read this FAQ if you are new here. If this post was helpful, please rate it!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|