Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Feb 2013

    File Reading in s40

    I am developing an app in eclipse ide

    I want to read a text file which is in res folder line by line and initialise a HashTable whenever the app starts

    All the file handing codes I found read char by char

    Kindly help

    private String file(){
    		  InputStream is = getClass().getResourceAsStream("/database.txt");
    		  StringBuffer sb = new StringBuffer();
    		  int chars, i = 0;
    		  while ((chars = is.read()) != -1){
    		  sb.append((char) chars);
    		  return sb.toString();
    		  }catch (Exception e){}
    		  return null;

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003

    Re: File Reading in s40


    Have you already checked this Wiki page:


    Please let us know if it helps.


Similar Threads

  1. Replies: 2
    Last Post: 2007-12-28, 15:53
  2. Replies: 3
    Last Post: 2007-11-17, 10:31
  3. File reading & writing help, wav file redaing help
    By shubhamlahoti in forum Mobile Java General
    Replies: 6
    Last Post: 2007-06-27, 09:07
  4. Reading a .txt file from jar without knowing the size of the file !
    By ionutianasi in forum Mobile Java General
    Replies: 12
    Last Post: 2004-06-24, 00:27
  5. reading text file from a jar file -> file not found!
    By iecomdev in forum Mobile Java General
    Replies: 1
    Last Post: 2002-09-30, 12:27

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts