Java
  Home arrow Java arrow Page 4 - J2ME and Unicode
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

J2ME and Unicode
By: Jason Lam
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 87
    2003-12-26

    Table of Contents:
  • J2ME and Unicode
  • Enabling the J2ME Emulator with Unicode
  • Simple Unicode Test
  • Read Unicode File
  • Reading a Text File with Unicode Codes
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    J2ME and Unicode - Read Unicode File


    (Page 4 of 6 )

    The next step in module code separation would be to load language definitions from an external source.  One option would be to read in language definitions from a text file, more appropriately a Unicode file.  Here is a method you can use to read a Unicode text file:

    To create a test file you can use the free application, Simredo, from http://www4.vc-net.ne.jp/~klivo/sim/simeng.htm


       public String readUnicodeFile(String filename) {
         StringBuffer buffer = null;
         InputStream is = null;
         InputStreamReader isr = null;
         try {
           Class c = this.getClass();
           is = c.getResourceAsStream(filename);     
           if (is == null)
             throw new Exception("File Does Not Exist");
           
           isr = new InputStreamReader(is,"UTF8");     
         
           buffer = new StringBuffer();
           int ch;
           while ((ch = isr.read()) > -1) {
             buffer.append((char)ch);
           }      
           if (isr != null) 
             isr.close();              
         } catch (Exception ex) {
           System.out.println(ex);
         }
         return buffer.toString();      
       }

    More Java Articles
    More By Jason Lam


     

    JAVA ARTICLES

    - Deploying Multiple Java Applets as One
    - Deploying Java Applets
    - Understanding Deployment Frameworks
    - Database Programming in Java Using JDBC
    - Extension Interfaces and SAX
    - Entities, Handlers and SAX
    - Advanced SAX
    - Conversions and Java Print Streams
    - Formatters and Java Print Streams
    - Java Print Streams
    - Wildcards, Arrays, and Generics in Java
    - Wildcards and Generic Methods in Java
    - Finishing the Project: Java Web Development ...
    - Generics and Limitations in Java
    - Getting Started with Java Web Development in...







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway