|
|
Subject:
ByteArray to String in J2ME (Java Micro Edition)
Category: Computers > Programming Asked by: spinal-ga List Price: $2.00 |
Posted:
25 May 2006 16:08 PDT
Expires: 24 Jun 2006 16:08 PDT Question ID: 732424 |
|
There is no answer at this time. |
|
Subject:
Re: ByteArray to String in J2ME (Java Micro Edition)
From: zoiber-ga on 09 Jun 2006 08:41 PDT |
You could try something like... public byte[] readUnicodeFile(String filename) throws Exception { 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("Exception="+ex); } return buffer.toString().getBytes(); } |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |