Package javax.microedition.rms

Examples of javax.microedition.rms.RecordStore


    private void calcRsSizeLimit()
    {
        final byte[] record = new byte[100];
        try
        {
            RecordStore rs1 = RecordStore.openRecordStore( RSNAME1, true );
            final int size1_0 = rs1.getSizeAvailable();
            freeStorage = size1_0;
            rs1.addRecord( record, 0, 100 );
            rs1.closeRecordStore();

            RecordStore rs2 = RecordStore.openRecordStore( RSNAME2, true );
            final int size2_0 = rs2.getSizeAvailable();
            rs2.closeRecordStore();

            RecordStore.deleteRecordStore( RSNAME1 );
            RecordStore.deleteRecordStore( RSNAME2 );

            if( size1_0 == size2_0 )
View Full Code Here


        try
        {
            info.save();
            assertNotNull( info.recordId );
            RecordStore rs = RecordStore.openRecordStore( StoreInfo.RS_NAME, false );
            assertEquals( 1, rs.getNumRecords() );
            final byte[] data = rs.getRecord( info.recordId.intValue() );
            assertNotNull( data );
            assertEquals( 33, data.length );
            final ByteArrayInputStream bais = new ByteArrayInputStream( data );
            final SerializerInputStream in = new SerializerInputStream( bais );
            final StoreInfo info2 = new StoreInfo( "test2" );
View Full Code Here

     * @throws java.util.NoSuchElementException nunca
     * @throws java.io.IOException Error rms
     */
    public void borrar(String nombre) throws java.io.IOException, java.util.NoSuchElementException
    {
        RecordStore rs=null;
        try
        {
            rs=RecordStore.openRecordStore(RMS_ID,true);
            //buscar y borrar elemto con mismo nombre
            RecordFilter filtro=new RmsFiltro(nombre);
            RecordEnumeration re=rs.enumerateRecords(filtro,null,false);
            while(re.hasNextElement())
            {
                int el=re.nextRecordId();
                rs.deleteRecord(el);
            }
            rs.closeRecordStore();
        }
        catch (Exception e)
        {
            throw new java.io.IOException(e.getMessage());
        }
View Full Code Here

   
    /** obtiene una lista de las partidas existentes */
    public String [] getExistentes()
    {
        String[]result=null;
        RecordStore rs=null;
        try
        {
            rs=RecordStore.openRecordStore(RMS_ID,true);
            //buscar y borrar elemto con mismo nombre
            RecordEnumeration re=rs.enumerateRecords(null,null,false);
            result=new String[re.numRecords()];
            for(int i=0;i<result.length;i++)
            {
                String el=new String(re.nextRecord());
                result[i]=getId(el);
            }
            rs.closeRecordStore();
        }
        catch (Exception e)
        {
            //throw new java.io.IOException(e.getMessage());
        }
View Full Code Here

     * @param nombre nombre del slot
     * @param datos datos para introducir en el slot
     **/
    private void guardar(String nombre,byte[]datos)
    {
        RecordStore rs=null;
        try
        {
            //buscar y borrar elemto con mismo nombre
            borrar(nombre);
            rs=RecordStore.openRecordStore(AlmacenMicropocha.RMS_ID,true);
            //grabar elemento
            rs.addRecord(datos,0,datos.length);
            rs.closeRecordStore();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
View Full Code Here

     * @throws java.util.NoSuchElementException nunca
     * @throws java.io.IOException Error rms
     */
    public void borrar(String nombre) throws java.io.IOException, java.util.NoSuchElementException
    {
        RecordStore rs=null;
        try
        {
            rs=RecordStore.openRecordStore(AlmacenMicropocha.RMS_ID,true);
            //buscar y borrar elemto con mismo nombre
            RecordFilter filtro=new AlmacenMicropocha.RmsFiltro(nombre);
            RecordEnumeration re=rs.enumerateRecords(filtro,null,false);
            while(re.hasNextElement())
            {
                int el=re.nextRecordId();
                rs.deleteRecord(el);
            }
            rs.closeRecordStore();
        }
        catch (Exception e)
        {
            throw new java.io.IOException(e.getMessage());
        }
View Full Code Here

     * @param nombre nombre del slot
     * @param datos datos para introducir en el slot
     **/
    private void guardar(String nombre,byte[]datos)
    {
        RecordStore rs=null;
        try
        {
            //buscar y borrar elemto con mismo nombre
            borrar(nombre);
            rs=RecordStore.openRecordStore(AlmacenMicropocha.RMS_ID,true);
            //grabar elemento
            rs.addRecord(datos,0,datos.length);
            rs.closeRecordStore();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
View Full Code Here

     * @throws java.util.NoSuchElementException nunca
     * @throws java.io.IOException Error rms
     */
    public void borrar(String nombre) throws java.io.IOException, java.util.NoSuchElementException
    {
        RecordStore rs=null;
        try
        {
            rs=RecordStore.openRecordStore(AlmacenMicropocha.RMS_ID,true);
            //buscar y borrar elemto con mismo nombre
            RecordFilter filtro=new AlmacenMicropocha.RmsFiltro(nombre);
            RecordEnumeration re=rs.enumerateRecords(filtro,null,false);
            while(re.hasNextElement())
            {
                int el=re.nextRecordId();
                rs.deleteRecord(el);
            }
            rs.closeRecordStore();
        }
        catch (Exception e)
        {
            throw new java.io.IOException(e.getMessage());
        }
View Full Code Here

        try {
            final ByteArrayOutputStream da = new ByteArrayOutputStream();
            Properties.write(map, da);
            da.flush();
            final byte[] data = da.toByteArray();
            final RecordStore store = RecordStore.openRecordStore("settings", true);
            try {
                if (store.getNumRecords() == 0) {
                    store.addRecord(data, 0, data.length);
                } else {
                    store.setRecord(1, data, 0, data.length);
                }
            } finally {
                store.closeRecordStore();
            }
        } catch (Exception ex) {
        }
    }
View Full Code Here

        }
    }

    protected void load() {
        try {
            final RecordStore store = RecordStore.openRecordStore("settings", false);
            try {
                final byte[] data = store.getRecord(1);

                final ByteArrayInputStream in = new ByteArrayInputStream(data);
                final Hashtable map = Properties.read(in);
                txtUser.setString((String) map.get("user"));
                txtPass.setString((String) map.get("pass"));
            } finally {
                store.closeRecordStore();
            }
        } catch (Exception ex) {
        }
    }
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.