النتائج 1 إلى 1 من 1

الموضوع: Read and Write to RMS Using J2ME

  1. #1
    Wa7ed Men el NaSS الصورة الرمزية wa7edmenelnass
    تاريخ التسجيل
    Jun 2008
    الدولة
    CMasterZ
    المشاركات
    260
    معدل تقييم المستوى
    249

    Thumbs up Read and Write to RMS Using J2ME


    End Google Ads 201810 - BS.net 01 -->
    This Application specially tries to explain how to read and write the data using RecordStore class. In the RecordStore class the following methods are available:


    كود:
    addRecord(byte[] data, int offset, int numBytes)
     
    addRecordListener(RecordListener listener) 
     
    closeRecordStore() 
     
    deleteRecord(int recordId) 
     
    deleteRecordStore(String recordStoreName) 
     
    enumerateRecords(RecordFilter filter, RecordComparator comparator, boolean keepUpdated)
     
     
    getLastModified() 
     
    getName() 
     
    getNextRecordID()
    getNumRecords() 
    getRecord(int recordId)
     
    getRecord(int recordId, byte[] buffer, int offset) 
     
    getRecordSize(int recordId)
    getSize() 
    getSizeAvailable() 
    getVersion() 
    listRecordStores() 
    openRecordStore(String recordStoreName, boolean createIfNecessary)
    removeRecordListener(RecordListener listener)
    setRecord(int recordId, byte[] newData, int offset, int numBytes)




    The Application is as follows:



    كود:
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.io.*;
    import javax.microedition.rms.*;
     
    public class ReadWriteRMS extends MIDlet{
    private RecordStore rs = null;
    static final String REC_STORE = "ReadWriteRMS";
     
    public void startApp(){
    openRecStore();
    writeRecord("Core J2ME Technology");
    writeRecord("J2ME Wireless Toolkit");    
    readRecords();
    closeRecStore();
    deleteRecStore(); 
    }
     
    public void pauseApp(){}
     
    public void destroyApp(boolean unconditional){
    notifyDestroyed();
    }
     
    public void openRecStore(){
    try{
    rs = RecordStore.openRecordStore(REC_STORE, true );
    }catch (Exception e){}
    }    
     
    public void closeRecStore(){
    try{
    rs.closeRecordStore();
    }catch (Exception e){}
    }
     
    public void deleteRecStore(){
    if (RecordStore.listRecordStores() != null){
    try{
    RecordStore.deleteRecordStore(REC_STORE);
    }catch (Exception e){}
    }      
    }
     
    public void writeRecord(String str){
    byte[] rec = str.getBytes();
    try{
    rs.addRecord(rec, 0, rec.length);
    }catch (Exception e){}
    }
     
    public void readRecords(){
    try{
    byte[] recData = new byte[5]; 
    int len;
     
    for(int i = 1; i <= rs.getNumRecords(); i++){
    if(rs.getRecordSize(i) > recData.length){
    recData = new byte[rs.getRecordSize(i)];
    }
    len = rs.getRecord(i, recData, 0);
    System.out.println("------------------------------");
    System.out.println("Record " + i + " : " + new String(recData, 0, len));
    System.out.println("------------------------------");                        
    }
    }catch (Exception e){}
    }
    }

    The Code is in the Attachments

    الملفات المرفقة الملفات المرفقة
    CMasterZ...
    For Web Services
    Hosting, Domain, Design, Develop, VB Support
    منتديات سي ماسترز التقنية

معلومات الموضوع

الأعضاء الذين يشاهدون هذا الموضوع

الذين يشاهدون الموضوع الآن: 1 (0 من الأعضاء و 1 زائر)

المواضيع المتشابهه

  1. مشاركات: 26
    آخر مشاركة: 02-12-2010, 04:46 AM
  2. Error - Attempted to read or write protected memory
    بواسطة C# Programming في المنتدى General topics in C# - CSharp
    مشاركات: 0
    آخر مشاركة: 04-20-2009, 08:33 PM
  3. Help in J2me & database..
    بواسطة Java Programming في المنتدى General topics in Java
    مشاركات: 0
    آخر مشاركة: 04-17-2009, 04:58 AM
  4. How can I read from, and write to, files in Java?
    بواسطة A7med Baraka في المنتدى Java - جافا
    مشاركات: 2
    آخر مشاركة: 04-04-2009, 05:26 PM
  5. Game Development using J2ME
    بواسطة wa7edmenelnass في المنتدى Java - جافا
    مشاركات: 1
    آخر مشاركة: 01-16-2009, 07:05 PM

الكلمات الدلالية لهذا الموضوع

مواقع النشر (المفضلة)

ضوابط المشاركة

  • لا تستطيع إضافة مواضيع جديدة
  • لا تستطيع الرد على المواضيع
  • لا تستطيع إرفاق ملفات
  • لا تستطيع تعديل مشاركاتك
  •  
"وَقُل رَّبِّ زِدْنِي عِلْمًا"
أعلانات نصية أستضافة , ريسيلر - Best Hosting | BarakaSoft Web Solutions

BarakaSoft PageRank RSS RSS 2.0 XML MAP HTML 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 C/C++ | Java | C# | Network | Database | OS | Linux | Windows | Hacker & Security | Photoshop | Flash | Web Development | Free Programs | Mobile App | Free Java Course | Latest Technical News | Internet Programs | Antiviurse Programs | Graphics Programs | Network Programs | Portable Programs | vb Forums Development | Forums Development | CMS(Joomla-nuke-wordpress-mkportal...) | Photo | Anime |