J2ME Writing PNG images to mobile phone file system usingFileConnection API JSR75

Discussion in 'Java' started by Juls, Jan 29, 2009.

  1. Juls

    Juls Guest

    Hi,
    is there an easy way how one can write an image file from a J2ME
    Midlet to the mobile phone's file system?

    My attempts so far are not very promissing:

    try {
    byte[] imageByte = myVideoControler.getSnapshot(null);

    FileConnection connection = (FileConnection) Connector
    .open("file:///C:/cameraTest.png");
    if (!connection.exists()) {
    connection.create();
    }

    OutputStream os = connection.openOutputStream();
    PrintStream ps = new PrintStream(os);

    for (int i = 0; i<imageByte.length; i++){
    ps.print(imageByte);
    }

    os.close();
    connection.close();
    ps.close();

    } catch (MediaException e) {
    e.printStackTrace();
    } catch (IOException e) {
    e.printStackTrace();
    }

    I really hope you can give me a hint how solve this problem how I can
    write an image file to the file system.

    Cheers
    Juls
     
    Juls, Jan 29, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Zouplaz

    J2ME on a real mobile phone

    Zouplaz, Sep 15, 2003, in forum: Java
    Replies:
    5
    Views:
    909
    Darryl L. Pierce
    Sep 23, 2003
  2. Zahoor
    Replies:
    1
    Views:
    812
    Darryl L. Pierce
    Nov 15, 2003
  3. Branko Kaucic

    J2ME: j9 & JSR75?

    Branko Kaucic, May 20, 2005, in forum: Java
    Replies:
    0
    Views:
    524
    Branko Kaucic
    May 20, 2005
  4. chen selina
    Replies:
    0
    Views:
    887
    chen selina
    Jul 7, 2010
  5. chen selina
    Replies:
    0
    Views:
    1,324
    chen selina
    Jul 13, 2010
Loading...

Share This Page