×

Discussion Board

Results 1 to 3 of 3

Thread: RecordStore...

  1. #1
    Regular Contributor
    Join Date
    Oct 2003
    Posts
    75

    RecordStore...

    From the MIDP api:

    setRecord
    public void setRecord(int recordId,
    byte[] newData,
    int offset,
    int numBytes)
    throws RecordStoreNotOpenException,
    InvalidRecordIDException,
    RecordStoreException,
    RecordStoreFullExceptionSets the data in the given record to that passed in. After this method returns, a call to getRecord(int recordId) will return an array of numBytes size containing the data supplied here.
    Parameters:
    recordId - The ID of the record to use in this operation.
    newData - The new data to store in the record.
    offset - The index into the data buffer of the first relevant byte for this record.
    numBytes - The number of bytes of the data buffer to use for this record.





    Actually what "offset" means?
    I still dunno what it means after reading the api...

    thanks

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395
    "offset" is the index in the byte array of the data you want to store.

    So, if you:
    Code:
    byte [] ao = "these are my data".getBytes ();
    
    rs.setRecord (1, ao, 4, 7);
    then you have stored the byte-values for "e are m" in record 1. If you want to store the entire array, you can:
    Code:
    rs.setRecord (1, ao, 0, ao.length);
    Graham.

  3. #3
    Regular Contributor
    Join Date
    Oct 2003
    Posts
    75
    thanks

Posting Permissions

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