Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
URL Connection Reader 
 

In this section, you will learn about the url connection reader. Here, first of all we are going to define class named "URLConnectionReader".

 

URL Connection Reader

                         

In this section, you will learn about the url connection reader. Here, first of all we are going to define class named "URLConnectionReader". After that we make a URL object passing a url "http://www.javajazzup.com" as string in its constructor.

openConnection():
This is the method that returns a URLConnection object that represents a connection to the remote object referred to by the URL. A new connection is opened every time by calling the openConnection() method of the protocol handler for this URL. 

InputStreamReader(): An InputStreamReader is a bridge from byte stream to character stream, It reads bytes and decodes them into character using a specified charset.

BufferedReader: This constructor reads text from a character-input stream, buffering characters so as to provide for the efficient reading of characters. A BufferedReader creates a buffering character-input stream that uses a default sized input buffer.


Here is the code of  this program.

import java.net.*;
import java.io.*;

public class URLConnectionReader{
  public static void main(String[] argsthrows Exception {
    URL javajazzup = new URL("http://www.javajazzup.com/");
    URLConnection javajazzupConnection = javajazzup.openConnection();
    System.out.println(javajazzupConnection);
    InputStreamReader inp=new InputStreamReader(System.in);
    BufferedReader br = new BufferedReader(inp);
    System.out.println("Enter the text: ");
    String str = br.readLine();
    System.out.println("You entered String is: ");
    System.out.println(str);
  }
}


Here is  the Output  of above program:

C:\rose>java URLConnectionReader
URLConnection:http://www.javajazzup.com/
Enter the text:
This is simple program.
You entered String is:
This is simple program.

C:\rose>


Download of this program.

 

                         

» View all related tutorials
Related Tags: c com forms server orm form network socket io sed request return opera ai for work wait to base pos

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.