Motorola E680 Technical Manual - Page 68
write data
View all Motorola E680 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 68 highlights
... } if (fc.isDirectory()) { // first item is directory } else { //first item is file } /* * Create a FileConnection object pointing to file */ FileConnection fc = null; try { fc = (FileConnection) Connector.open("file://"+root+"testfile.txt"); } catch (IOException ioe) { ... } /* * If file does not exists, create it */ if (! fc.exists() ) { try { fc.create(); } catch (SecurityException se) { ... } } /* * Open stream for writing data */ DataOutputStream dataOutputStream; try { dataOutputStream = fc.openDataOutputStream(); //write data dataOutputStream.close(); } catch (IOException ioe) { ... } /* * Open stream for reading data */ DataInputStream dataInputStream; try { dataInputStream = fc.openDataInputStream(); // read data dataInputStream.close(); } catch (IOException ioe) { 68