1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| public class MyThread2 extends Thread {
public String s = "";
public void run() {
execute("operation.txt", "operation");
execute("agent.txt", "agent");
execute("client.txt", "client");
execute("compte.txt", "compte");
execute("produit.txt", "produit");
execute("dossier_credit.txt", "dossier_credit");
execute("echeancier.txt", "echeancier");
}
public void execute(String filename, String db) {
try {
FileConnection fc = (FileConnection) Connector.open("file:///c:/predefgallery/predefphotos/" + filename);// file:///root1/ecrit file:///c:/predefgallery/predefphotos/
if (!fc.exists()) {
fc.create();
}
OutputStream os = fc.openOutputStream();
RecordStore rs = RecordStore.openRecordStore(db, false);
RecordEnumeration re = rs.enumerateRecords(null, null, false);
String contenu = "";
String sep = "\n";
while (re.hasNextElement()) {
byte[] s0 = re.nextRecord();
System.out.println("voici " + s0.toString());
os.write(s0);
}
fc.close();
rs.closeRecordStore();
} catch (IOException ioe) {
afficheException(ioe.getMessage());
} catch (RecordStoreNotOpenException rnoe) {
afficheException(rnoe.getMessage());
} catch (RecordStoreNotFoundException rnfe) {
afficheException(rnfe.getMessage());
} catch (InvalidRecordIDException irie) {
afficheException(irie.getMessage());
} catch (RecordStoreException are) {
afficheException(are.getMessage());
}
}
} |
Partager