<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Hamit&#039;s place</title>
	<atom:link href="http://hamitenglish.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://hamitenglish.wordpress.com</link>
	<description>A blog about programming</description>
	<lastBuildDate>Tue, 26 Apr 2011 15:48:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='hamitenglish.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Hamit&#039;s place</title>
		<link>http://hamitenglish.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://hamitenglish.wordpress.com/osd.xml" title="Hamit&#039;s place" />
	<atom:link rel='hub' href='http://hamitenglish.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Video Recording Using JMF</title>
		<link>http://hamitenglish.wordpress.com/2010/12/09/video/</link>
		<comments>http://hamitenglish.wordpress.com/2010/12/09/video/#comments</comments>
		<pubDate>Thu, 09 Dec 2010 13:32:47 +0000</pubDate>
		<dc:creator>hamitsarmis</dc:creator>
				<category><![CDATA[jmf]]></category>
		<category><![CDATA[jmf video]]></category>

		<guid isPermaLink="false">http://hamitenglish.wordpress.com/?p=21</guid>
		<description><![CDATA[Hi, I want to show you how to record video from your camera using jmf. I will not explain the full code, and you can get it by clicking here, I just want to talk about the jmf objects. Our &#8230; <a href="http://hamitenglish.wordpress.com/2010/12/09/video/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hamitenglish.wordpress.com&amp;blog=18286029&amp;post=21&amp;subd=hamitenglish&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hi, I want to show you how to record video from your camera using jmf. I will not explain the full code, and you can get it by clicking <a href="http://hamitenglish.files.wordpress.com/2010/12/jmfvideocapture.doc">here</a>, I just want to talk about the jmf objects.</p>
<p>Our main class JVidCap is a frame class. You will see recording options when you run the application. You can choose video format, audio options, etc</p>
<p>Let me start telling you about the code. The startMonitoring() function will give you monitoring stream. It first closes the previous processor (if there is one). Processor is the object that records the video. And the function will initialize the class objects according to your choices. We get our processor object from Manager class. We will use the static method createRealizedProcessor of the class Manager. Afterwards we can add the monitor component, and we will see our face on the window.</p>
<p>The next function I will tell you is startCapture. We first get our datasource from processor object. The object that you should know here is the datasink object. It is the one that writes your data to your hard disc. After you have it, you will also say processor.start(); and it is now on.. I don&#8217;t want to tell the rest, it is a little bit long.</p>
<p>Please feel free to ask if you have any problems. See ya&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hamitenglish.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hamitenglish.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hamitenglish.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hamitenglish.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hamitenglish.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hamitenglish.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hamitenglish.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hamitenglish.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hamitenglish.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hamitenglish.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hamitenglish.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hamitenglish.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hamitenglish.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hamitenglish.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hamitenglish.wordpress.com&amp;blog=18286029&amp;post=21&amp;subd=hamitenglish&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hamitenglish.wordpress.com/2010/12/09/video/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3947baad6a86cf9603b87c7762d07acd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hamitsarmis</media:title>
		</media:content>
	</item>
		<item>
		<title>Image Capturing Using JMF</title>
		<link>http://hamitenglish.wordpress.com/2010/12/09/image-capturing/</link>
		<comments>http://hamitenglish.wordpress.com/2010/12/09/image-capturing/#comments</comments>
		<pubDate>Wed, 08 Dec 2010 23:09:47 +0000</pubDate>
		<dc:creator>hamitsarmis</dc:creator>
				<category><![CDATA[jmf]]></category>

		<guid isPermaLink="false">http://hamitenglish.wordpress.com/?p=17</guid>
		<description><![CDATA[In this article, we will create a java application to take pictures from our camera. First, we will start by creating an instance of javax.media.CaptureDeviceInfo class. We will get our instance using device name which can be found via JMFRegistry &#8230; <a href="http://hamitenglish.wordpress.com/2010/12/09/image-capturing/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hamitenglish.wordpress.com&amp;blog=18286029&amp;post=17&amp;subd=hamitenglish&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In this article, we will create a java application to take pictures from our camera. First, we will start by creating an instance of javax.media.CaptureDeviceInfo class. We will get our instance using device name which can be found via JMFRegistry (Mostly <code>vfw:Microsoft WDM Image Capture (Win32):0</code> in Windows).</p>
<p>Another object we will use is MediaLocator. It is used to locate media and will be needed to create a player object which will provide us a visual component that can be displayed in a Frame.</p>
<p><code>CaptureDeviceInfo di = CaptureDeviceManager.getDevice(deviceString); //Get the device info</code><br />
<code>MediaLocator ml = new MediaLocator(deviceString); //Get the media locator</code><br />
<code>Player player = Manager.createRealizedPlayer(ml);</code></p>
<p>Right now, if we are successful to create the player object without any exception raised, then I can proudly say we are so close to see ourselves on the camera. We will just start the player then get the visual component from it. Here you are:</p>
<p><code>player.start();<br />
Component comp = player.getVisualComponent();</code></p>
<p>And now, we will just add the comp to the frame and our face is now on the frame. But our goal is to take a picture from camera and save it as an image so let’s take care of that.</p>
<p><code>FrameGrabbingControl fgc = (FrameGrabbingControl) player.getControl("javax.media.control.FrameGrabbingControl");</code></p>
<p>In the code above, we used the FrameGrabbingControl of the player. That gives us the ability to create a buffer which can be converted to image.</p>
<p><code>Buffer = fgc.grabFrame();</code></p>
<p>We now have the buffer. We will use BufferToImage object to get the image. The code below does that:</p>
<p><code>BufferToImage btoi= new BufferToImage((VideoFormat)buf.getFormat());</code><br />
<code>Image imaj = btoi.createImage(buf);</code></p>
<p>Now at last, we do have the image object that can be saved as a file. You can download the full code by clicking <a href="http://hamitenglish.files.wordpress.com/2010/12/getimage.doc">here</a>. Please provide me feedback.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hamitenglish.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hamitenglish.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hamitenglish.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hamitenglish.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hamitenglish.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hamitenglish.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hamitenglish.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hamitenglish.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hamitenglish.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hamitenglish.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hamitenglish.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hamitenglish.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hamitenglish.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hamitenglish.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hamitenglish.wordpress.com&amp;blog=18286029&amp;post=17&amp;subd=hamitenglish&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hamitenglish.wordpress.com/2010/12/09/image-capturing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3947baad6a86cf9603b87c7762d07acd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hamitsarmis</media:title>
		</media:content>
	</item>
		<item>
		<title>JMF(Java Media Framework)</title>
		<link>http://hamitenglish.wordpress.com/2010/12/09/jmf/</link>
		<comments>http://hamitenglish.wordpress.com/2010/12/09/jmf/#comments</comments>
		<pubDate>Wed, 08 Dec 2010 23:03:38 +0000</pubDate>
		<dc:creator>hamitsarmis</dc:creator>
				<category><![CDATA[jmf]]></category>

		<guid isPermaLink="false">http://hamitenglish.wordpress.com/?p=15</guid>
		<description><![CDATA[JMF is an open source framework developed by Sun in order to manage media devices and play video or audio. So let’s get started with it by installing to our pc. Here are the steps: 1.       Download the software here: &#8230; <a href="http://hamitenglish.wordpress.com/2010/12/09/jmf/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hamitenglish.wordpress.com&amp;blog=18286029&amp;post=15&amp;subd=hamitenglish&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>JMF is an open source framework developed by Sun in order to manage media devices and play video or audio.</p>
<p>So let’s get started with it by installing to our pc. Here are the steps:</p>
<p>1.       Download the software here: <a href="http://www.oracle.com/technetwork/java/javase/download-142937.html">http://www.oracle.com/technetwork/java/javase/download-142937.html</a></p>
<p>2.       After your installation, you can see the devices JMF has recognized by using JMFRegistry. There, you can also edit the video, audio codecs and create jar libraries based on your needs.</p>
<p>In the next articles, I will show you how to capture images, videos using jmf.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hamitenglish.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hamitenglish.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hamitenglish.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hamitenglish.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hamitenglish.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hamitenglish.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hamitenglish.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hamitenglish.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hamitenglish.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hamitenglish.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hamitenglish.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hamitenglish.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hamitenglish.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hamitenglish.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hamitenglish.wordpress.com&amp;blog=18286029&amp;post=15&amp;subd=hamitenglish&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hamitenglish.wordpress.com/2010/12/09/jmf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3947baad6a86cf9603b87c7762d07acd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hamitsarmis</media:title>
		</media:content>
	</item>
		<item>
		<title>Paint Application Using Swing</title>
		<link>http://hamitenglish.wordpress.com/2010/12/09/paint-application-using-swing/</link>
		<comments>http://hamitenglish.wordpress.com/2010/12/09/paint-application-using-swing/#comments</comments>
		<pubDate>Wed, 08 Dec 2010 23:01:13 +0000</pubDate>
		<dc:creator>hamitsarmis</dc:creator>
				<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://hamitenglish.wordpress.com/?p=13</guid>
		<description><![CDATA[In this tutorial, I will show you how to use java swing to make a simple painting application. We will learn two basic operations: Implementing MouseListener and overriding paint method. The application will consist of two classes. Our first class &#8230; <a href="http://hamitenglish.wordpress.com/2010/12/09/paint-application-using-swing/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hamitenglish.wordpress.com&amp;blog=18286029&amp;post=13&amp;subd=hamitenglish&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In this tutorial, I will show you how to use java swing to make a simple painting application. We will learn two basic operations: Implementing MouseListener and overriding paint method.</p>
<p>The application will consist of two classes. Our first class will extend JFrame and the second one will be a JPanel class to be added to the first class. All the painting staff will be handled in our JPanel class.</p>
<p>We will create paintings by drawing lines between the points that mouse is clicked on. Here are the classes:</p>
<p><span style="text-decoration:underline;">Main.java</span>:</p>
<p><code>package paint;</code></p>
<p><code>import javax.swing.JFrame;<br />
import java.awt.event.WindowAdapter;<br />
import java.awt.event.WindowEvent;</code><br />
<code>public class Main extends JFrame {</code><br />
<code>public Main(){</code><br />
<code>super("Painting Application");</code><br />
<code>setSize(400, 500);<br />
setVisible(true);</code><br />
<code>addWindowListener(new WindowAdapter() {</code><br />
<code>@Override</code><br />
<code>public void windowClosing(WindowEvent e){</code><br />
<code>System.exit(0);</code><br />
<code>}</code><br />
<code>});</code><br />
<code>add(new MyPanel());</code><br />
<code>}</code><br />
<code>public static void main(String[] args) {</code><br />
<code>new Main();</code><br />
<code>}</code><br />
<code>}</code></p>
<p><span style="text-decoration:underline;">MyPanel.java</span>:</p>
<p><code>package paint;<br />
import java.awt.Graphics;<br />
import java.awt.event.MouseEvent;<br />
import java.awt.event.MouseListener;<br />
import java.awt.event.MouseMotionListener;<br />
import javax.swing.JPanel;</code></p>
<p><code>public class MyPanel extends JPanel{</code><br />
<code>MouseMotionListener theListener;<br />
Graphics g;<br />
MouseListener theListening;<br />
int x,y,x1,y1;<br />
boolean inside;</code><br />
<code>public MyPanel(){</code><br />
<code>x=0; y=0; x1=-99; y1=-99;<br />
inside=false;</code><br />
<code>theListener=new MouseMotionListener() {</code><br />
<code>public void mouseDragged(MouseEvent arg0) {</code><br />
<code>if(inside){</code><br />
<code>repaint();</code><br />
<code>}</code><br />
<code>}</code><br />
<code>public void mouseMoved(MouseEvent arg0) {</code><br />
<code>}</code><br />
<code>};</code><br />
<code>theListening=new MouseListener() {</code></p>
<p><code>public void mouseClicked(MouseEvent arg0) {</code><br />
<code>//Nothing to be done…</code><br />
<code>}</code></p>
<p><code>public void mousePressed(MouseEvent arg0) {</code><br />
<code>//Nothing to be done…</code><br />
<code>}</code></p>
<p><code>public void mouseReleased(MouseEvent arg0) {</code><br />
<code>x1=-99;y1=-99;//Mouse released. We need to make sure no last point for future use.</code><br />
<code>}</code></p>
<p><code>public void mouseEntered(MouseEvent arg0) {</code><br />
<code>inside=true; //Mouse has just entered</code><br />
<code>x1=-99;y1=-99; //No last point because the mouse was outside.</code><br />
<code>}</code></p>
<p><code>public void mouseExited(MouseEvent arg0) {</code><br />
<code>inside=false; //Mouse is now outside</code><br />
<code>x1=-99; y1=-99; //No last point, mouse is outside</code><br />
<code>}</code><br />
<code>};</code><br />
<code>this.setSize(400,500);<br />
this.setVisible(true);<br />
this.addMouseMotionListener(theListener);<br />
this.addMouseListener(theListening);</code><br />
<code>}</code><br />
<code>@Override</code><br />
<code>public void paint(Graphics g){</code></p>
<p><code>try{</code><br />
<code>if(x1==-99){ // if x equals to -99 then y also equals to -99. A point of (-99,-99) is not possible so nothing will be drawn.</code></p>
<p><code>x=getMousePosition().x; x1=x; //Getting the point so that we will be able to use it as the first point</code><br />
<code>y=getMousePosition().y; y1=y;  //of the line when another point is clicked.</code><br />
<code>}</code><br />
<code>else//Event just occurred at (x1,y1). Between (x,y) and (x1,y1) a line will be drawn</code><br />
<code>{</code><br />
<code>x=getMousePosition().x;<br />
y=getMousePosition().y;<br />
g.drawLine(x, y, x1, y1);<br />
x1=x; y1=y;</code><br />
<code>}</code><br />
<code>}</code><br />
<code>catch(Exception ex){</code><br />
<code>}</code><br />
<code>}</code><br />
<code>}</code></p>
<p>If you have any problem running or understanding the code please give me feedback.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hamitenglish.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hamitenglish.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hamitenglish.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hamitenglish.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hamitenglish.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hamitenglish.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hamitenglish.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hamitenglish.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hamitenglish.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hamitenglish.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hamitenglish.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hamitenglish.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hamitenglish.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hamitenglish.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hamitenglish.wordpress.com&amp;blog=18286029&amp;post=13&amp;subd=hamitenglish&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hamitenglish.wordpress.com/2010/12/09/paint-application-using-swing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3947baad6a86cf9603b87c7762d07acd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hamitsarmis</media:title>
		</media:content>
	</item>
		<item>
		<title>Http Connection Using Java</title>
		<link>http://hamitenglish.wordpress.com/2010/12/08/httpjava/</link>
		<comments>http://hamitenglish.wordpress.com/2010/12/08/httpjava/#comments</comments>
		<pubDate>Wed, 08 Dec 2010 22:37:48 +0000</pubDate>
		<dc:creator>hamitsarmis</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[http Url Connection]]></category>
		<category><![CDATA[java2se]]></category>

		<guid isPermaLink="false">http://hamitenglish.wordpress.com/?p=6</guid>
		<description><![CDATA[In this article, I want to show you how java can connect to a website and get source code of it. To do this, we are going to use java.net.HttpURLConnection class. We will need the URL of the location we &#8230; <a href="http://hamitenglish.wordpress.com/2010/12/08/httpjava/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hamitenglish.wordpress.com&amp;blog=18286029&amp;post=6&amp;subd=hamitenglish&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In this article, I want to show you how java can connect to a website and get source code of it. To do this, we are going to use java.net.HttpURLConnection class. We will need the URL of the location we want to connect and we will use http request properties. So here is the code to connect to <a href="http://www.google.com/">http://www.google.com</a> I will explain the code inside.</p>
<p><span style="text-decoration:underline;">Main.java:</span></p>
<p><code>import java.io.BufferedReader;<br />
import java.io.IOException;<br />
import java.io.InputStreamReader;<br />
import java.net.HttpURLConnection;<br />
import java.net.MalformedURLException;<br />
import java.net.ProtocolException;<br />
import java.net.URL;<br />
import java.util.logging.Level;<br />
import java.util.logging.Logger;</code></p>
<p><code>public class Main {</code></p>
<p><code>private BufferedReader reader;</code></p>
<p><code>private HttpURLConnection huc;</code></p>
<p><code>private URL url;</code></p>
<p><code>public Main(){</code><br />
<code>try {</code></p>
<p><code>url=new URL("http://www.google.com");<br />
</code><br />
<code>}</code></p>
<p><code>catch (MalformedURLException ex) {</code><br />
<code>Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);</code><br />
<code>}</code></p>
<p><code>try {</code><br />
<code>huc = (HttpURLConnection) url.openConnection();</code><br />
<code>} catch (IOException ex) {</code><br />
<code>Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);</code><br />
<code>}</code><br />
<code>try {</code><br />
<code>huc.setRequestMethod("GET");</code><br />
<code>} catch (ProtocolException ex) {</code><br />
<code>Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);</code><br />
<code>}</code><br />
<code>huc.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; JVM)");<br />
huc.setRequestProperty("Pragma", "no-cache");</code><br />
<code>try {</code><br />
<code>huc.connect();</code><br />
<code>} catch (IOException ex) {</code><br />
<code>Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);</code><br />
<code>}</code><br />
<code>try {</code><br />
<code>reader = new BufferedReader(new InputStreamReader(huc.getInputStream()));</code><br />
<code>} catch (IOException ex) {</code><br />
<code>Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);</code><br />
<code>}</code><br />
<code>String line = "", fullPage = "";</code><br />
<code>try {</code><br />
<code>while ((line = reader.readLine()) != null) {</code><br />
<code>fullPage += line;</code><br />
<code>}</code><br />
<code>} catch (IOException ex) {</code><br />
<code>Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);</code><br />
<code>}</code></p>
<p><code>System.out.println(fullPage);</code></p>
<p><code>}</code></p>
<p><code>public static void main(String[] args) {</code><br />
<code>new Main();</code><br />
<code>}</code></p>
<p><code>}</code></p>
<p>So this code will let you see the html content of any website just like you are connecting via web browser.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hamitenglish.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hamitenglish.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hamitenglish.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hamitenglish.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hamitenglish.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hamitenglish.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hamitenglish.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hamitenglish.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hamitenglish.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hamitenglish.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hamitenglish.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hamitenglish.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hamitenglish.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hamitenglish.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hamitenglish.wordpress.com&amp;blog=18286029&amp;post=6&amp;subd=hamitenglish&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hamitenglish.wordpress.com/2010/12/08/httpjava/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3947baad6a86cf9603b87c7762d07acd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hamitsarmis</media:title>
		</media:content>
	</item>
		<item>
		<title>Java Glossary</title>
		<link>http://hamitenglish.wordpress.com/2010/12/08/javaglossary/</link>
		<comments>http://hamitenglish.wordpress.com/2010/12/08/javaglossary/#comments</comments>
		<pubDate>Wed, 08 Dec 2010 22:28:53 +0000</pubDate>
		<dc:creator>hamitsarmis</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[java glossary]]></category>

		<guid isPermaLink="false">http://hamitenglish.wordpress.com/?p=1</guid>
		<description><![CDATA[Java is a language that is used by many developers in many platforms. It is object oriented and has the ability to be used in any platform which has java virtual machine. I want to tell you about some object-oriented &#8230; <a href="http://hamitenglish.wordpress.com/2010/12/08/javaglossary/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hamitenglish.wordpress.com&amp;blog=18286029&amp;post=1&amp;subd=hamitenglish&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Java is a language that is used by many developers in many platforms. It is object oriented and has the ability to be used in any platform which has java virtual machine. I want to tell you about some object-oriented notions of java in this article. Let’s begin:</p>
<p><span style="text-decoration:underline;">Java Access Modifiers</span></p>
<p>Public: A public member can be accessed by any other java classes.</p>
<p>Private: A private member can only be accessed from the class in which it is defined.</p>
<p>Protected: A protected variable cannot be assigned from another package. It is<strong> </strong>accessible outside the package only through inheritance. I should give an example. The code below is in a package2 class:</p>
<p>Package1.Class1 class1 = new Package1.Class1();<br />
class1.theProtectedNumber = 5; // This is not ok.</p>
<p>If Package2.Class1 extends package1.Class1 then it can access the protected members by using super methods.</p>
<p>Default:  It also means package-level access. So a default member can be accessed only inside the same package in which it is declared.</p>
<p><span style="text-decoration:underline;">Other notions</span></p>
<p>Static: A static member can be used without creating an instance of a class in which it is declared.</p>
<p>Getter: If a private class member is needed to provide its value to the other classes, then getter methods are used. They are usually declared as “public Member getMember()” and returns the value of the member.</p>
<p>Setter: Just like getters, setters are used to set values. They are usually declared as “public void setMember(MemberClass member)” and changes the member value of the instance.</p>
<p>Interface: Using interface will provide different implementations of an interface. So, classes which implement the same interface will be able to be used as one class. Any class which implements an interface will have to implement all of the interface methods.</p>
<p>Abstract class: An abstract class is used as a super class. Its abstract methods have to be implemented by the subclasses. Any other members of an abstract class can be used by its subclasses without overriding.</p>
<p>Final: Value of a final member cannot be changed.</p>
<p>I know there are so many things to tell, but I am a little bit lazy here, so if you want me to tell more notions, you can just make a comment, and I will reply as fast as I can.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hamitenglish.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hamitenglish.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hamitenglish.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hamitenglish.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hamitenglish.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hamitenglish.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hamitenglish.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hamitenglish.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hamitenglish.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hamitenglish.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hamitenglish.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hamitenglish.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hamitenglish.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hamitenglish.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hamitenglish.wordpress.com&amp;blog=18286029&amp;post=1&amp;subd=hamitenglish&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hamitenglish.wordpress.com/2010/12/08/javaglossary/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3947baad6a86cf9603b87c7762d07acd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hamitsarmis</media:title>
		</media:content>
	</item>
	</channel>
</rss>
