import java.io.*; import javax.microedition.rms.*; /* Автор: Writer */ public class RMS { static String DBNAME = "MyRMS"; //Имя БД. static String s = "Текст"; //Заносим в БД. static String s1 = ""; //Сюда будем извлекать. //Конструктор класса. public RMS(){} //Запись. 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){} } //Чтение. 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){} } }