<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Scala: Converting an input stream to a string</title>
	<atom:link href="http://www.markhneedham.com/blog/2009/10/26/scala-converting-an-input-stream-to-a-string/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markhneedham.com/blog/2009/10/26/scala-converting-an-input-stream-to-a-string/</link>
	<description>Thoughts on Software Development</description>
	<lastBuildDate>Sat, 11 Feb 2012 23:17:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Bikash</title>
		<link>http://www.markhneedham.com/blog/2009/10/26/scala-converting-an-input-stream-to-a-string/comment-page-1/#comment-54951</link>
		<dc:creator>Bikash</dc:creator>
		<pubDate>Fri, 15 Oct 2010 06:57:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1762#comment-54951</guid>
		<description>while ((line = reader.readLine()) != null) {
when u say line=reader.readLine() its a assignment which return Unit in scala, and its always not null .

so just have to compare against variable line

something like this shud work

while({line=reader.readline();line!=null) {
       doSomething()
}</description>
		<content:encoded><![CDATA[<p>while ((line = reader.readLine()) != null) {<br />
when u say line=reader.readLine() its a assignment which return Unit in scala, and its always not null .</p>
<p>so just have to compare against variable line</p>
<p>something like this shud work</p>
<p>while({line=reader.readline();line!=null) {<br />
       doSomething()<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ray</title>
		<link>http://www.markhneedham.com/blog/2009/10/26/scala-converting-an-input-stream-to-a-string/comment-page-1/#comment-30903</link>
		<dc:creator>ray</dc:creator>
		<pubDate>Mon, 25 Jan 2010 00:34:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1762#comment-30903</guid>
		<description>I also wanted to do this and found that it is in fact very simple using Scala&#039;s Source class:
io.Source.fromInputStream(someStream).getLines.mkString

It also reads files, urls etc...</description>
		<content:encoded><![CDATA[<p>I also wanted to do this and found that it is in fact very simple using Scala&#8217;s Source class:<br />
io.Source.fromInputStream(someStream).getLines.mkString</p>
<p>It also reads files, urls etc&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wic</title>
		<link>http://www.markhneedham.com/blog/2009/10/26/scala-converting-an-input-stream-to-a-string/comment-page-1/#comment-25470</link>
		<dc:creator>wic</dc:creator>
		<pubDate>Tue, 27 Oct 2009 08:19:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1762#comment-25470</guid>
		<description>I realize java is showing age, but seriously... you should not ever need 20 lines of code to do this. Not even if you wrote it in C. And recursive as well? This should be a one-liner nowadays. Maybe two.</description>
		<content:encoded><![CDATA[<p>I realize java is showing age, but seriously&#8230; you should not ever need 20 lines of code to do this. Not even if you wrote it in C. And recursive as well? This should be a one-liner nowadays. Maybe two.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tweets that mention Scala: Converting an input stream to a string at Mark Needham -- Topsy.com</title>
		<link>http://www.markhneedham.com/blog/2009/10/26/scala-converting-an-input-stream-to-a-string/comment-page-1/#comment-25343</link>
		<dc:creator>Tweets that mention Scala: Converting an input stream to a string at Mark Needham -- Topsy.com</dc:creator>
		<pubDate>Mon, 26 Oct 2009 09:33:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1762#comment-25343</guid>
		<description>[...] This post was mentioned on Twitter by Bubbl Scala Feed, planettw. planettw said: Mark Needham: Scala: Converting an input stream to a string: I was playing around with Scala over the weekend and on... http://bit.ly/3fiCZq [...]</description>
		<content:encoded><![CDATA[<p>[...] This post was mentioned on Twitter by Bubbl Scala Feed, planettw. planettw said: Mark Needham: Scala: Converting an input stream to a string: I was playing around with Scala over the weekend and on&#8230; <a href="http://bit.ly/3fiCZq" rel="nofollow">http://bit.ly/3fiCZq</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DotNetBurner - XML</title>
		<link>http://www.markhneedham.com/blog/2009/10/26/scala-converting-an-input-stream-to-a-string/comment-page-1/#comment-25289</link>
		<dc:creator>DotNetBurner - XML</dc:creator>
		<pubDate>Mon, 26 Oct 2009 01:13:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1762#comment-25289</guid>
		<description>&lt;strong&gt;Scala: Converting an input stream to a string...&lt;/strong&gt;

DotNetBurner - burning hot .net content...</description>
		<content:encoded><![CDATA[<p><strong>Scala: Converting an input stream to a string&#8230;</strong></p>
<p>DotNetBurner &#8211; burning hot .net content&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Thomas</title>
		<link>http://www.markhneedham.com/blog/2009/10/26/scala-converting-an-input-stream-to-a-string/comment-page-1/#comment-25277</link>
		<dc:creator>Mark Thomas</dc:creator>
		<pubDate>Sun, 25 Oct 2009 22:38:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1762#comment-25277</guid>
		<description>Hi Mark, try this:

import scala.io.Source
import java.io.InputStream

def convertStreamToString(is: InputStream) : String =
    Source.fromInputStream(is).getLines.reduceLeft(_ + _)

Source has a load of useful methods like fromFile or fromURL.</description>
		<content:encoded><![CDATA[<p>Hi Mark, try this:</p>
<p>import scala.io.Source<br />
import java.io.InputStream</p>
<p>def convertStreamToString(is: InputStream) : String =<br />
    Source.fromInputStream(is).getLines.reduceLeft(_ + _)</p>
<p>Source has a load of useful methods like fromFile or fromURL.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2009/10/26/scala-converting-an-input-stream-to-a-string/comment-page-1/#comment-25276</link>
		<dc:creator>Mark Needham</dc:creator>
		<pubDate>Sun, 25 Oct 2009 22:19:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1762#comment-25276</guid>
		<description>Yeh I guess I could. I was just playing around with code in the REPL so I was seeing what I could do just with the libraries available there. 

Haven&#039;t worked out how to import 3rd party libraries into that environment yet. I guess that would be a good next thing to work out!

Thanks for the link though, will check that out.</description>
		<content:encoded><![CDATA[<p>Yeh I guess I could. I was just playing around with code in the REPL so I was seeing what I could do just with the libraries available there. </p>
<p>Haven&#8217;t worked out how to import 3rd party libraries into that environment yet. I guess that would be a good next thing to work out!</p>
<p>Thanks for the link though, will check that out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Ron</title>
		<link>http://www.markhneedham.com/blog/2009/10/26/scala-converting-an-input-stream-to-a-string/comment-page-1/#comment-25275</link>
		<dc:creator>David Ron</dc:creator>
		<pubDate>Sun, 25 Oct 2009 22:14:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=1762#comment-25275</guid>
		<description>Couldn&#039;t you just delegate off to a Java library to handle this for you?  How about Apache IOUtils?

http://commons.apache.org/io/api-1.4/org/apache/commons/io/IOUtils.html#toString(java.io.InputStream)</description>
		<content:encoded><![CDATA[<p>Couldn&#8217;t you just delegate off to a Java library to handle this for you?  How about Apache IOUtils?</p>
<p><a href="http://commons.apache.org/io/api-1.4/org/apache/commons/io/IOUtils.html#toString(java.io.InputStream)" rel="nofollow">http://commons.apache.org/io/api-1.4/org/apache/commons/io/IOUtils.html#toString(java.io.InputStream)</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

