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

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
EncoderTest 
 

This is a simple program of java network and supports the java.net package. Here, we have defined the class named EncoderTest.java. This class contains static methods for converting a String to the application-urlencoded MIME format.

 

EncoderTest

                         

This is a simple program of java network and supports the java.net package. Here, we have defined the class named EncoderTest.java. This class contains static methods for converting a String to the application-urlencoded MIME format.

The alphanumeric characters "a" through "z", "A" through "Z" and "0" through "9" remain the same. And the space characters ".", "-", "*", and "_" remain the same. The encoding string supports to the space character “ ” is converted into a plus sign “+”. All other characters are unsafe and are first converted into one or more bytes using some encoding scheme. 


Here is the code of this program:

import java.net.*;
import java.net.URLEncoder;

public class EncoderTest{
  public static void main(String[] args){
    System.out.println(URLEncoder.encode("This string has spaces"));
    System.out.println(URLEncoder.encode("This*string*has*stars"));
    System.out.println(URLEncoder.encode("This%string%has%percent%signs"));
    System.out.println(URLEncoder.encode("This.is.first.program.of.encoder"));
    System.out.println(URLEncoder.encode("This/is/simple/Encoder/test/program"));
  }
}


Output of this program:

C:\amar>javac EncoderTest.java

C:\amar>java EncoderTest
This+string+has+spaces
This*string*has*stars
This%25string%25has%25percent%25signs
This.is.first.program.of.encoder
This%2Fis%2Fsimple%2FEncoder%2Ftest%2Fprogram

C:\amar>

 

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.