>
Recordstore (mobile datastore ) methods to store d...
Welcome, Guest

by dhanendra on Saturday, 22 November 2008
Recordstore (mobile datastore ) methods to store delete retrieve data


import javax.microedition.lcdui.Ticker; import javax.microedition.rms.*; import de.enough.polish.ui.ChoiceGroup; import de.enough.polish.ui.List; /** * * @author dhanendra */ public class recordStore { private RecordStore rs = null; private static recordStore rsRecords=null; static final String[] REC_STORE = {"db_friends","db_advertisement","db_user_preferences","user_info","db_bluetoothfriend_address"}; private recordStore() { } public void destroyApp( boolean unconditional ) { } public void startApp() { // There is no user interface, go ahead and shutdown destroyApp(false); } public void pauseApp() { } public void openRecStore(int rec_type) { try { // The second parameter indicates that the record store // should be created if it does not exist rs = RecordStore.openRecordStore(REC_STORE[rec_type], true ); } catch (Exception e) { } } public void closeRecStore() { try { rs.closeRecordStore(); } catch (Exception e) { } } public void deleteRecStore(int rec_type) { try { rs=RecordStore.openRecordStore(REC_STORE[rec_type], true); rs.closeRecordStore(); RecordStore.deleteRecordStore(REC_STORE[rec_type]); } catch (RecordStoreException ex) { } } public void writeRecord(String str,int rec_type) { byte[] rec = str.getBytes(); this.openRecStore(rec_type); try { rs.addRecord(rec, 0, rec.length); } catch (Exception e) { } finally { this.closeRecStore(); } } public void modifyRecord(String str,int rec_type,int index) { byte[] rec = str.getBytes(); this.openRecStore(rec_type); try { rs.setRecord(index, rec, 0, rec.length); } catch (Exception e) { } finally { this.closeRecStore(); } } public void readRecordList(ChoiceGroup vectrev,int rec_type) { String ret=""; try { this.openRecStore(rec_type); byte[] recData = null;// = new byte[5]; int len; for(int i=1;i recData.length) { recData = new byte[rs.getRecordSize(0)]; } len = rs.getRecord(0, recData, 0); ret = new String(recData, 0, len); } catch (RecordStoreNotOpenException ex) { } catch (InvalidRecordIDException ex) { } catch (RecordStoreException ex) { } finally { this.closeRecStore(); return ret; } } public int getTotalRecords(int rec_type) { int rec=0; this.openRecStore(rec_type); try { rec= rs.getNumRecords(); } catch (RecordStoreNotOpenException ex) { } finally { this.closeRecStore(); return rec; } } public static recordStore getRecordStoreInstance() { if(rsRecords==null) rsRecords=new recordStore(); return rsRecords; } }



Blogger Image
My Blog Title

Product Engineering, software engineering company, Product Development, Product Migration, Product Re-engineering, Product Maintenance, Product Testing Commercial Application Development, Business Software development, commercial software for startups, Application Support and Maintenance, software testing Product Maintenance, Outsource product maintenance, product support and maintenance Product Migration, Product Re-engineering, product re-engineering services Product Research, Product Engineering, UI Prototyping Services Software Testing Services, Quality Assurance services, professional software testers, Load Testing, Functional Testing, Cross Platform, Browser Testing, Test Automation, Testing Tools, software quality analysis Functional Testing Services, software quality analysis, Software Testing Services, Application Testing Services, Functional Testing Types Automated Testing, Automated Testing Services, automation testing, test script development, Automation Test Tools, outsource automation testing Load Testing, Performance Testing Services, Load Testing Tools Offshore Software Development, Outsource software services, offshore outsourcing services, offshore software development services, IT outsourcing services, software quality assurance services, Offshore IT services, Custom Application Development Services, Offshore Product Engineering Benefits of IT Outsourcing, Offshore Software Development companies, offshore software development firms Outsource planning, IT outsourcing, IT development services, offshore IT companies, offshore software development Offshore Software Development, Outsource software services, offshore outsourcing services, offshore software development services, IT outsourcing services, software quality assurance services, Offshore IT services, Custom Application Development Services, Offshore Product Engineering Offshore Software Development, Outsource software services, offshore outsourcing services, offshore software development services, IT outsourcing services, software quality assurance services, Offshore IT services, Custom Application Development Services, Offshore Product Engineering