import java.io.*; import javax.microedition.rms.*; /* Autor: Writer */ public class RMS { static String DBNAME = "MyRMS"; /* name bd */ static String s = "text"; /* write to bd */ static String s1; /* read line */ /** *Constructor */ public RMS(){} /** * Write */ static void output() { RecordStore recordStore = null; try { recordStore = RecordStore.openRecordStore(DBNAME, true); ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos); dos.writeUTF(s); byte[] record = baos.toByteArray(); recordStore.addRecord(record, 0, record.length); } catch(Exception ex){ } } /** * Read */ static void input() { try { RecordStore recordStore = RecordStore.openRecordStore(DBNAME, false); byte[] record = recordStore.getRecord(1); ByteArrayInputStream bais = new ByteArrayInputStream(record); DataInputStream dis = new DataInputStream(bais); s1 = dis.readUTF(); } catch(Exception ex){ } } }