×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    27

    Size (in KB) used to store a record in RecordSet

    Hi.
    I'm a writing an app which allows the user to decide how big (in KB) the images can be stored in the phone.

    Just write to verify whether what i understand is correct. I just write out the part which is relevant below. Referring to below, is it correct to say that the size (in KB) that will be used is imageFileSize (in bytes)? :

    .
    .
    .
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DataOutputStream dos = new DataOutputStream(baos);
    dos.writeUTF(imageCid);

    for (int i = 0; i < imgRgbData.length; i++) {
    dos.writeInt(imgRgbData[i]);
    }

    imageFileSize = baos.toByteArray().length;
    System.out.println("Image Size " + imageFileSize);


    rs.addRecord(baos.toByteArray(), 0,
    baos.toByteArray().length); // Add record
    .
    .
    .

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: Size (in KB) used to store a record in RecordSet

    imageFileSize = baos.toByteArray().length; will give you the filesize,

    now you want to compare it with user entered value and then store if its lower then that.. correct?

    If yes, put rs.addRecord(baos.toByteArray(), 0,baos.toByteArray().length); // Add record in a if block something like this:

    PHP Code:
    if(imageFileSize <= UsergiveFilesize)
    {
     
    // add record to RMS  
    }else{
      
    // show filesize too big to store in RMS

    thanks,
    ~Amitabh

  3. #3
    Registered User
    Join Date
    Mar 2010
    Posts
    27

    Re: Size (in KB) used to store a record in RecordSet

    Thanks, that clears my doubt. The doubt arises because i notice that the storage of image in the phone takes larger size compared to in PC.

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: Size (in KB) used to store a record in RecordSet

    The doubt arises because i notice that the storage of image in the phone takes larger size compared to in PC.
    When you store images in RMS you store all uncompressed bytes of image raw data to RMS, while when you store the same image on PC as .JPG its a compressed and then stored.

    thanks,
    ~Amitabh

  5. #5
    Registered User
    Join Date
    Mar 2010
    Posts
    27

    Re: Size (in KB) used to store a record in RecordSet

    Thanks a lot, Amitabh.

    I notice that a 4KB image on PC needs about 30KB in the phone. Is there a way which we can reduce the file size of the image stored in the phone?

  6. #6
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: Size (in KB) used to store a record in RecordSet

    I notice that a 4KB image on PC needs about 30KB in the phone. Is there a way which we can reduce the file size of the image stored in the phone?
    You can compress(defalte) the image byte array which you store on phone in RMS, by using gzip (j2me - jcarft inplementation) http://j2me.ngphone.com/opensource/other.htm
    After reading the compressed byte array you will then require to uncompress it using gzip(inflate).

    thanks,
    ~Amitabh

Similar Threads

  1. search for a text but not in record store??
    By yatibawri in forum Mobile Java General
    Replies: 1
    Last Post: 2010-01-22, 12:23
  2. Maximum Record size problem in j2me
    By harshalpatil in forum Mobile Java General
    Replies: 4
    Last Post: 2007-05-30, 03:16
  3. Record Store vs JDBC. How to store data?
    By 180ºrevolution in forum Mobile Java General
    Replies: 0
    Last Post: 2004-09-17, 15:24
  4. Using protocol file:// with object connector
    By afinistr in forum Mobile Java General
    Replies: 2
    Last Post: 2002-06-24, 07:12
  5. 30 KB, 50 KB MMS File Size Limits???
    By rmsj in forum General Messaging
    Replies: 2
    Last Post: 1970-01-01, 02:00

Posting Permissions

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