×

Discussion Board

Results 1 to 12 of 12

Hybrid View

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    41

    Question read strings of a file

    hi,

    i found a lot of examples how to read data from one file but i can't understand how i do it by of InputStream and method read.

    someone could give me a example ??

  2. #2
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: read strings of a file

    Hello stein,

    here's an example (under the 'Solution' title):

    http://wiki.forum.nokia.com/index.ph...rom_a_JAR_file

    Regards,
    r2j7
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    41

    Re: read strings of a file

    but now i have another problem case i can't access to the file i use this url = "file:///C:/myfile.txt"; but exception tells me that i have no permission to write there, can explain me how work directories on n70, i see a tutorial but only specifies the mai drive don´t talk about the directories that can be used
    ty,

  4. #4
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: read strings of a file

    Hello stein,

    Below's a quote from:

    http://www.forum.nokia.com/info/sw.n..._0_en.zip.html

    An example of a typical file URL in a S60 device looks as follows:
    file:///C:/data/Images/Image(001).jpg
    Based on the above, try something like:

    C:/data/myfile.txt

    Regards,
    r2j7
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

  5. #5
    Registered User
    Join Date
    Jul 2007
    Posts
    41

    Question Re: read strings of a file

    ty for your help, but i try what you suggest and don´t work, my code to save info on file:

    Code:
     String url = "file:///c:/nokia/myfile.txt";
            FileConnection conn = null;
            
            try {
                System.out.println("\na guardar informação-------------------------------------->1\n");
                conn = (FileConnection) Connector.open( url,Connector.READ_WRITE );
                
                if( conn.exists()==false )
                    conn.create();// create the file
                
                OutputStream out = conn.openOutputStream();
                
                for (int i = 0; i < horaMiranda.length; i++) {
                    out.write(this.horaMiranda[i].toString().getBytes());
                    System.out.println("\na guardar informação-------------------------------------->2\n");
                }
                
                conn.close();
            } catch( IOException e ){
                System.out.println("\nERRO\n");
            } catch( SecurityException e ){
                System.out.println("\nNo permissions to write \n");
            }
    can someone tell me what is wrong for the code give me exception and don´t let me write on file..



    ty,

  6. #6
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: read strings of a file

    Hello stein,

    String url = "file:///c:/nokia/myfile.txt";

    Did you try using

    String url = "file:///C:/data/myfile.txt";

    or

    String url = "file:///C:/Data/myfile.txt";

    ?

    Regards,
    r2j7
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

Similar Threads

  1. Read from a text file
    By razas in forum Symbian
    Replies: 4
    Last Post: 2010-12-06, 05:53
  2. [announce] PyUIQ. Python for UIQ 2.1 and 3.x
    By OscarBernabeu in forum Symbian
    Replies: 35
    Last Post: 2008-01-17, 09:12
  3. Unable to read file DRM forward lock
    By gpalvia in forum Symbian
    Replies: 0
    Last Post: 2007-11-21, 03:58
  4. File reading & writing help, wav file redaing help
    By shubhamlahoti in forum Mobile Java General
    Replies: 6
    Last Post: 2007-06-27, 09:07
  5. How to read file and get token?
    By seera in forum Symbian
    Replies: 5
    Last Post: 2006-10-10, 10:16

Posting Permissions

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