<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>{Complexity} &#187; Input</title>
	<atom:link href="http://technote.wsjoung.com/tag/input/feed/" rel="self" type="application/rss+xml" />
	<link>http://technote.wsjoung.com</link>
	<description>simple note</description>
	<lastBuildDate>Fri, 06 Aug 2010 19:03:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Getting input from keyboard</title>
		<link>http://technote.wsjoung.com/2006/11/17/23/</link>
		<comments>http://technote.wsjoung.com/2006/11/17/23/#comments</comments>
		<pubDate>Fri, 17 Nov 2006 00:28:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[I/O]]></category>
		<category><![CDATA[Input]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://wsjoung.wordpress.com/2006/11/17/23/</guid>
		<description><![CDATA[import java.io.*; InputStreamReader yetBufferedInput = new InputStreamReader(System.in); BufferedReader bufferedInput = new BufferedReader(yetBufferedInput); // Once you have created a BufferedReader, you can read either individual characters, or whole lines, from it. try { String inputLine = bufferedInput.readLine(); if ( inputLine != null ) { // &#8230; process &#8220;inputLine&#8221; &#8230; } else { System.err.println( &#8220;No more keyboard [...]]]></description>
			<content:encoded><![CDATA[<p>import java.io.*;<br />
InputStreamReader yetBufferedInput = new InputStreamReader(System.in);<br />
BufferedReader bufferedInput = new BufferedReader(yetBufferedInput);<br />
// Once you have created a BufferedReader, you can read either individual characters, or whole lines, from it.</p>
<p>try {<br />
String inputLine = bufferedInput.readLine();</p>
<p>if ( inputLine != null ) {<br />
// &#8230; process &#8220;inputLine&#8221; &#8230;<br />
} else {<br />
System.err.println( &#8220;No more keyboard input.&#8221; );<br />
}<br />
} catch ( IOException error ) {<br />
System.err.println( &#8220;Error reading keyboard: &#8221; + error );<br />
}</p>
<p>try {<br />
int input = bufferedInput.read();<br />
if ( input &gt;= 0 ) {<br />
char c = (char) input;<br />
// &#8230; process the input character in variable &#8220;c&#8221;<br />
} else {<br />
System.err.println( &#8220;No more keyboard input.&#8221; );<br />
}<br />
} catch( IOException error ) {<br />
System.err.println(&#8220;Error reading keyboard:&#8221;+error );<br />
}</p>
<p>readLine() can be used to read a line of text from BufferedReader, and read() reads a charactor.</p>
<p>try {<br />
bufferedInput.close();<br />
} catch ( IOException error ) {<br />
System.err.println(&#8220;Couldn&#8217;t close the reader:&#8221; + error);<br />
}</p>
<p>after that, you may close the connection to the stream and data source.</p>
]]></content:encoded>
			<wfw:commentRss>http://technote.wsjoung.com/2006/11/17/23/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
