Package javax.microedition.rms

Examples of javax.microedition.rms.RecordStore


        }
    }

    public static void updateContacts() throws RecordStoreException, IOException
    {
        RecordStore rs = null;
        try{
            byte[] data = serial.serializeKVPVector(getRecentContacts());
            rs = RecordStore.openRecordStore(userSettingsStore, true);
            if(rs.getNumRecords() != 0){
                try{
                    rs.setRecord(2, data, 0, data.length);
                }
                catch(InvalidRecordIDException ire)
                {
                    rs.addRecord(data, 0, data.length);
                }
            }
        }
        catch(RecordStoreException rse)
        {
            Logger.add("settings", "updateSettings", rse.getMessage());
            rse.printStackTrace();
        }
        finally{
            try{
                rs.closeRecordStore();
            }
            catch(Exception e)
            {}
        }
    }
View Full Code Here


        }
    }

    public static void updateSettings() throws RecordStoreException
    {
        RecordStore rs = null;
        try{
            String[] fields = {username, password, interval, callFrom};
            byte[] data = null;
            data = serial.serialize(fields);
            rs = RecordStore.openRecordStore(userSettingsStore, true);
            if(rs.getNumRecords() != 0)
            {
                rs.setRecord(1, data, 0, data.length);
            }
            else
            {
                rs.addRecord(data, 0, data.length);
            }
        }
        catch(Exception ex)
        {
            Logger.add("settings", "updateSettings", ex.getMessage());
            ex.printStackTrace();
        }
        finally{
            rs.closeRecordStore();
        }
    }
View Full Code Here

        try{
        RecordStore.deleteRecordStore(rsName);
        }
        catch(Exception ignore)
        {}
        RecordStore rs = null;
        try{
            rs = RecordStore.openRecordStore(rsName, true);
           
            for(int i = list.size()-1; i >= 0; i--)
            {
                textConvo crnt = (textConvo)list.elementAt(i);
                byte[] data = crnt.serialize();
                rs.addRecord(data, 0, data.length);
            }
        }
        catch(Exception ignore)
        {}
        finally{
            try {
                rs.closeRecordStore();
            } catch (Exception ignore)
            {}
        }
    }
View Full Code Here

     * @throws RecordStoreException
     */
    public Vector vectFromRS() throws InvalidRecordIDException, IOException, RecordStoreException
    {
        Vector vectOfRS = new Vector(10);
        RecordStore rs = null;
        RecordEnumeration re = null;
        try{
            rs = RecordStore.openRecordStore(rsName, true);
            re = rs.enumerateRecords(null, null, false);

            while(re.hasNextElement())
            {
                textConvo crnt = textConvo.deserialize(re.nextRecord());
                vectOfRS.addElement(crnt);
            }
        }
        finally{
            rs.closeRecordStore();
            re.destroy();
            return vectOfRS;
        }
    }
View Full Code Here

    {
        try{
        RecordStore.deleteRecordStore(rsName);
        }
        catch(Exception ignore){}
        RecordStore rs = null;
        try{
            rs = RecordStore.openRecordStore(rsName, true);
           
            for(int i = list.size()-1; i >= 0; i--)
            {
                textConvo crnt = (textConvo)list.elementAt(i);
                byte[] data = crnt.serialize();
                rs.addRecord(data, 0, data.length);
            }
        }
        catch(Exception ignore){}
        finally{
            try {
                rs.closeRecordStore();
            } catch (Exception ignore){}
        }
    }
View Full Code Here

     * @throws RecordStoreException
     */
    public Vector vectFromRS() throws InvalidRecordIDException, IOException, RecordStoreException
    {
        Vector vectOfRS = new Vector(10);
        RecordStore rs = null;
        RecordEnumeration re = null;
        try{
            rs = RecordStore.openRecordStore(rsName, true);
            re = rs.enumerateRecords(null, null, false);

            while(re.hasNextElement())
            {
                textConvo crnt = textConvo.deserialize(re.nextRecord());
                vectOfRS.addElement(crnt);
            }
        }
        finally{
            try{
                rs.closeRecordStore();
                re.destroy();
            }
            catch(Exception ignore){}
            return vectOfRS;
        }
View Full Code Here

            menuScreen.save(dout);
            wc.setProgress(20);
            timeSystem.save(dout);
            wc.setProgress(30);
            byte[] data = baos.toByteArray();
            RecordStore rs = RecordStore.openRecordStore(rsStateName, true);
            try {
                rs.setRecord(1, data, 0, data.length);
            } catch (InvalidRecordIDException e) {
                rs.addRecord(data, 0, data.length);
            }
            rs.closeRecordStore();
        } catch (Exception e) {
            //#if debug
            e.printStackTrace();
            //#endif
        }
View Full Code Here

        wc.setProgress(50);

        menuScreen.probUpdateFromPDB();

        try {
            RecordStore rs = RecordStore.openRecordStore(rsStateName, false);
            byte[] data = rs.getRecord(1);
            rs.closeRecordStore();
            DataInputStream din = new DataInputStream(new ByteArrayInputStream(data));
            wc.setProgress(65);
            if (!din.readUTF().equals(version))
                throw new Exception("Version mismatch!");
            gobanCanvas.restore(din);
View Full Code Here

    Vector genres;
    Vector paths;

    public void open() {
        try {
            RecordStore rs = RecordStore.openRecordStore(rsName, false);
            byte[] data = rs.getRecord(1);
            rs.closeRecordStore();

            restore(new ByteArrayInputStream(data));
        } catch (RecordStoreNotFoundException e) {
            // DO NOTHING
        } catch (Exception e) {
View Full Code Here

        try {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            save(baos);

            byte[] data = baos.toByteArray();
            RecordStore rs = RecordStore.openRecordStore(rsName, true);
            try {
                rs.setRecord(1, data, 0, data.length);
            } catch (InvalidRecordIDException e) {
                rs.addRecord(data, 0, data.length);
            }
            rs.closeRecordStore();
        } catch (Exception e) {
            //#ifdef debug
            e.printStackTrace();
            //#endif
        }
View Full Code Here

TOP

Related Classes of javax.microedition.rms.RecordStore

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.