KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > io > UnsupportedEncodingException

java.io
Class UnsupportedEncodingException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.io.IOException
              extended by java.io.UnsupportedEncodingException
All Implemented Interfaces:
Serializable
See Also:
Top Examples, Source Code

public UnsupportedEncodingException()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1431]Output french characters to the console
By Anonymous on 2005/05/17 11:29:20  Rate
Output french characters to the console 
  
  
 //start the JVM and pass on the command line the default file  
 //encoding to be used. Then you will be able to use regular  
 //System.out.println (  ) .  
 //javac MyApp.java 
 //java -Dfile.encoding=Cp850 MyApp 
  
  
 import java.io.*; 
  
  
 public class test  {  
    public static void main ( String [  ]  args )   {  
      PrintStream ps = null; 
      String javaString =  
       "caract??res fran??ais : ?? ?? \u00e9"; // Unicode for "??" 
  
  
      try  {  
        ps = new PrintStream ( System.out, true, "Cp850" ) ; 
       }  catch  ( UnsupportedEncodingException error )   {  
        System.err.println ( error ) ; 
        System.exit ( 0 ) ; 
       }  
  
  
      ps.println ( javaString ) ; 
     }  
  }  
   
 


[1615]Getting UnsupportedEncodingException
By Anonymous on 2005/11/04 20:23:08  Rate
/** 
 * Simiple checksum generator 
 */
 
 short checksum  ( String value )  
  {  
  
  
 short checksum = STARTING_VALUE; 
 short multiplier = 1; 
  
  
 short STARTING_VALUE = -631; 
 String ENCODING = "UTF-8"; 
  
  
 try 
  {  
     byte [  ]  data = value.getBytes  ( ENCODING ) ; 
     for  ( int b = 0; b  <  data.length; ++b )  
   checksum += data [ b ]  * multiplier++; 
  }  
 catch  ( java.io.UnsupportedEncodingException ex )  
  {  
     ex.printStackTrace (  ) ; 
  }  
  
  
 return checksum; 
  
  
  } 


public UnsupportedEncodingException(String s)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags