Scrivere un record

Listato 8. Scrivere un record

public void writeString(String s)
{
    byte[] b = s.getBytes();
    try
    {
    
        RecordStore rs = RecordStore.openRecordStore("my_rms", true);
        if (rs != null)
        {
            rs.addRecord(b, 0, b.length);
            rs.closeRecordStore();
        }
    }
    catch (RecordStoreNotOpenException e)
    {
        e.printStackTrace();
    }
    catch (RecordStoreFullException e)
    {
        e.printStackTrace();
    }
    catch (RecordStoreException e)
    {
        e.printStackTrace();
    }
}