Hello guys,
as it seems to be that some guys are interested in exchange information between j2me and the underlaying linux I will post my rms j2me class here. This class ist to be able with the demon (u may find the demon in the cy4th app in dl section as included bash script file) together exchange data. As the demon has all permissions of linux it is possible from j2me that u have access to the whole underlaying linux if the demon is running. This undermines the security of the java sand box seriously and u must know what u are doing! Don't ask me to get ur files back if u mistaken deleted them! 
But, please hold the code secret and don't spread it to guys which have no permission to this area, as I don't know @ the moment what to do next with the code. It's my own code and copyrighted, but anyone has access to this section here are given permission to use this code for any use (commercial or private), as long as the code itself is not visible to other people. No guarantee - using of own risk! Enjoy!
Code:
/*
* rms.java
*
* Created on July 11, 2005, 1:01 AM
*
* To change this template, choose Tools | Options and locate the template under
* the Source Creation and Management node. Right-click the template and choose
* Open. You can then make changes to the template in the Source Editor.
*/
/**
*
* @author Gottfried J. M. Grosshans
*
*Description of static class api:
*rms.loadres(string) returns a string with file contents as stream. Input string is the filename
* while in rms class, this is no rms function. It reads a file from the jar file.
*rms.delete(string) deletes rms file. input string is filename
*rms.list() returns a list of all rms files
*rms.save(string1, string2) saves string1 in file with filename string2
*rms.load(string) returns a string with file contents from a rms file. Input string is the filename
*/
import javax.microedition.rms.*;
import javax.microedition.midlet.*;
import java.lang.*;
import java.io.*;
import java.util.*;
public class rms {
public static final String loadres(String datei) {
try {
InputStream is = rms.class.getResourceAsStream(datei);
StringBuffer str = new StringBuffer();
byte b[] = new byte[1];
while ( is.read(b) != -1 ) {
str.append(new String(b));
}
is.close();
return str.toString();
}
catch (IOException e) {
e.printStackTrace();
return null;
}
}
public static final void delete(String delete) {
try {
RecordStore.deleteRecordStore(delete);
} catch (Exception e) {
// Do some exception handling here
}
}
public static final String[] list() {
try {
String[] output = RecordStore.listRecordStores();
return output;
} catch (Exception e) {
return null;
}
}
public static final void save(String input, String datei) {
RecordStore SettingStore;
ByteArrayOutputStream baos;
DataOutputStream dos;
byte[] data;
try {
SettingStore = RecordStore.openRecordStore(datei,true);
if(SettingStore==null) return;
baos = new ByteArrayOutputStream();
dos = new DataOutputStream(baos);
dos.writeUTF(input);
// dos.writeInt(mScore);
data = baos.toByteArray();
if(SettingStore.getNumRecords()==0)
SettingStore.addRecord(data,0,data.length);
else
SettingStore.setRecord(1, data, 0, data.length);
SettingStore.closeRecordStore();
dos.close();
baos.close();
} catch (Exception e) {
// System.out.println("rms settings ex:" + e);
// e.printStackTrace();
}
}
public static final String load(String datei) {
RecordStore SettingStore;
ByteArrayInputStream bais;
DataInputStream dis;
byte[] data;
int i;
String output;
try {
SettingStore = RecordStore.openRecordStore(datei,false);
if(SettingStore==null) return "";
data = SettingStore.getRecord(1);
bais = new ByteArrayInputStream(data);
dis = new DataInputStream(bais);
output=dis.readUTF();
// mScore=dis.readInt();
dis.close();
bais.close();
return output;
} catch (Exception e) { };
return "";
}
/**
* Creates a new instance of rms
*/
public rms() {
}
}