Reading/writing files

Greetings,
Does exists some workaround, how to read/write files on mobile filesystem? something like open it like url "file://mobileROOT/..." ;-)
I'm afraid if something like this is not possible, then java in MIDP is usable only for games, and that's question, if native c is not better for this reason :-(
Nowadays phones have MB of free 'persistent' memory, which can be used for storing images for example, but I won't be able to write a simple image viewer for it in java, unless images will be stored in RMS :-( Same for organizers, and 'office' software. Some news how this issue will be solved? Better profiles (like personal java) implemented in future phones? Or enhancement of MIDP 3.0? Doesn't it seem to you like dead end because of too big restriction? Have you seen any useful program written in java (I mean on mobile phones, of course ;-) )?

I am getting some kind of trouble like this:
I have a database on my destop and I must send it to my Palm via Cradle/Cable ONLY. To do this I have to implement some simple server that reads the database and generates data to send to my Palm via HotSync.
I think to solve this I have two ways:
-Generate a .pdb file that is recognizable by my javax.microedition.rms api. Problem: The .pdb file will have to be created by the Desktop application and will have to be exactly as the databases generated by the javax.microedition.rms package methods.
or
-Generate a .any file format that will be send to the Palm via HotSync and my MIDP application will have to read this data ANYWAY.
Troubles/Questions: Is this the case for using the getResourceAsStream() method? I still haven't figured out what is this method for..Can I create any file that can be read by my MIDP application?
Any help appreciated..
Thanks
Ricardo

Similar Messages

  • Error reading/writing file "com.garageband.cs":`≤Ć». message

    Hey all! Don't know if anyone can help but I keep getting the message...
    " Error reading/writing file "com.garageband.cs":`≤Ć». " with a cancel button.
    If you click on it it does go away, but after a time playback starts skipping and stuff.
    Anyone help please?
    Thanks
    Righini

    first two things to try for “oddball” probs:
    http://www.bulletsandbones.com/GB/GBFAQ.html#oddballprobs
    (Let the page FULLY load. The link to your answer is at the top of your screen)

  • Error reading/writing file message when opening garageband and/or files

    I've been recently getting this message when I open garageband and files
    "Error reading/writing file\U201Ccom.apple.garageband.cs\U201D
    I've been in and repaired disk permissions and all that it says it is all fine, reinstall garageband and message still comes up, weird.
    not only is garageband being a nuisance, Mac OS X 10.6.2 is being a pain when shutting down telling me to restart the computer. This only happened since upgrading to 10.6. No one as yet knows this promble so I'm gonna have to ring apple and see what is going on here.
    and also my other problem is that mac doesn't seem as snappy anymore I noticed this before upgrading to 10.6 and made no difference when "cleanly" installing 10.6. I get a colour wheel popping up and i'm having to wait with simple tasks. iMac only 2 years old.

    i give up with this discussion forum no no one knows anything

  • Keep getting message pop up "Error reading/writing file  "com.apple.logic.pro.cs": Logical end-of-file reached during read operation," and "The Preferences are not loaded completely. Save them to "com.apple.logic.pro.cs" anyway?" Using Logic pro 8. ???

    Logic froze while I was working on something so I forced quit.  Now every time I open LOGIC a message pops up that says:
    "Error reading/writing file
    “com.apple.logic.pro.cs”:
    Logical end-of-file reached during read operation."
    The only button option is cancel so I press it and another message appears that says:
    "The Preferences are not loaded completely.
    Do not save them, as you would overwrite the Preferences file with incomplete data."
    Then when i close logic a box appears saying:
    "The Preferences are not loaded completely.
    Save them to "com.apple.logic.pro.cs" anyway?"
    There are 3 button options to press; ok, cancel or dont save.
    I press "don’t save" cuz I don't want to ruin anything.
    I found a discussion located here: https://discussions.apple.com/message/9564253#9564253 that says if I delete the file "com.apple.logic.pro.cs" it will resolve the problem.  If I do this will I loose or mess anything up at all, automation, saved channel strips customizations, saved effects, synth, or ultrabeat customizations etc? Or especially will I loose any work I've done?  I have hundreds pieces of music files I've created.  I'm scared to mess anything up with all the hours and months of work I've done.  Is there anyway to fix this without loosing anything?  I'm using Logic Pro 8.
    Thank you

    You can safely delete this file - its the preference file for control surface settings - you haven't said whether you're actually using a control surface or not, if so, you will have to set it up again. A new file will be created when you fire Logic up again, but of course it will contain default settings. If you have a complicated control surface setup, remember to keep a backup copy somewhere in case any future problems arise.
    Other than that, you really have nothing to be scared about - hopefully your problem is as simple as that and there isn't an underlying problem (a corrupt hard drive, for example). You seem concerned about losing work, so I guess you want to think about backing that up on a regular basis too. If you're saving your projects to your system drive, do get an external one for this. And also check that you have plent of free space on your system drive - you need to keep about a quarter or third of it free for your OS and programs to run properly (some temporarily stored files can be quite large).

  • Reading writing file

    Hello
    i have a question. if you want to read a text file and then write to another text file within java, how do you pick what to send over ot the writing text file. for instance if i have from a text file goodbad.txt
    i am good
    i am baad
    i wish to read this inside java (which i know how to do) but then i want to only write i am baad to another text file.
    How do i do this
    thanks

    Tradeoff wrote:
    okay so theprogram requires the following:
    you have a text file with averaes for students with student number, class name and class average. you need to class name and class average of all entries and then splitt them into two text files as outputs depending on whether the average is 50 or more. So my question is, how do i only target the class name and average as the one the program will read from the text file and how do i assign the input of the mark to a double??
    ThanksThis will all depend very much on the format of the text file.
    Anyway. I think you are going to fail your assignment. What code have you written thus far? Any? Would you like to tell us about the format of the file? Are you reading it now line by line.
    The answer is something like, read the file line by line, split, take the results of the split and determine the class name (by index) and then parse the average value as a double and examine that, and then write it all out to another file.
    That's it. Your entire homework problem solved for you. So is that enough? If not then you need to back to the tutorials found here [http://java.sun.com/docs/books/tutorial/java/index.html]

  • Mutex shared lock while reading/writing files

    Hi,
    My application is a single threaded application. And I am trying to do the read/write file operation.  But there is a chance that other process may read/write the same file while i am using. So before reading or writing the file, i want to mutex shared
    lock.
    So can please some one tell me how to prevent this situation. Is there some sample code. I checked in net, how to use mutex shared lock, i got some example, but every where before using the mutex loxk, a thread needs to be created. Since my application is
    a single threaded, so i dont want to create a new thread.
    So please help me, how to prevent/stop other process to access the same file while my application is using.
    THanks a lot in advance.

    That's not something that a mutex can help with. Other processes won't know about your mutex and even if they know that's overkill. Normally you simply open that file without allowing read/write sharing - in the case of CreateFile that in general means that
    you pass 0 for the dwShareMode parameter.
    If you use the C runtime functions then you can use fopen_s instead of fopen as it automatically disallows sharing if you open the file for write (if you open for read when it allows shared read which is the normal thing to do).

  • Efficiency of reading/writing files character-by-character

    I've been assuming that when I do a file "open for access," that among the housekeeping functions set up behind the scenes, there is some sort of buffer created, the size of which is somehow related to the logical sector size of the disc in question, so that reading or writing short pieces of text, or even single characters, doesn't cause independent physical read/write actions at the disc drive.
    Does anyone know if this is true or false? Maybe the question would be clearer posed another way. Suppose I set up a loop to read or write 1024 characters, sequentially, but one at a time. Obviously the loop will require much more time to execute than a singe read or write statement calling for 1K of text all at once. But will there be significantly more activity at the disc drive itself? Will the data be read or written on 1024 successive spins of the platter, or will it be buffered down to one spin, or maybe a couple, depending on the exact location of sector boundaries and so on?
    Thanks.

    Thanks for this. I was sure some such facility was in operation, but I couldn't find anything explicit on the question. I have a task in which I'm trying to convert what looks like incredibly badly formed XML application files into properly tagged and well-formed XML so that I can then get them through a well-designed XML parser. To decode these utter shambles requires decision logic that goes nearly character-by-character. One tutorial page I found on Applescript file I/O suggested that reading/writing character-by-character was inherently inefficient, which I can see that it is, I just wanted to make sure the inefficiency didn't go all the way down to the mechanics of kicking the disc for every single character. The description in the tutorial was ambiguous, and a little disconcerting.
    The tutorial also suggested an alternative strategy of reading an entire file at once into a string and then working with the string. But my files are megabytes long, and I wonder how efficient operations are on megabyte strings, presuming there isn't a limit on string length. Short of trying to do some complex adaptive algorithm, which I might never get working right, I'm pretty sure that keeping to the KISS principal, and just going character-by-character, is a near-optimal strategy in my case.
    Cheers.

  • Reading / Writing files using Sockets

    Hi there guys,
    I am fairly new to this forum. I have been having a problem for the past three days. I am implementing a client/server implementation using Sockets which is a submodule of a project I am working on. What I want is that a files content are read and transferred over the network to the server that writes it down to a different file .
    What the code presently does is :
    <<<<Client Code >>>>
    It reads a file input.txt and sends the content over the network to the server.
    <<<< Server Code >>>
    It reads the incoming data from the client and writes the data out to a file called output.txt
    What I want now is that the server should read the file output.txt and send the contents to the client which reads it and then writes it down as a new file called serverouput.txt . After that I want to compare and see of the size of input.txt and serveroutput.txt . If both are same that means that data has been written reliably to the server.
    I have been trying to implement it for a long time and nothing seems to work out. I am posting the code for both client and server below. Any help in finalising things would be really appreciated.
    CLIENT CODE
    import java.awt.Color;
    import java.awt.BorderLayout;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.Date;
    import java.io.*;
    import java.net.*;
    class sc {
    static final int PORT = 4444;          //Change this to the relevant port
    static final String HOST = "127.0.0.1";
         //Change this to the relevant HOST,
    //(where Server.java is running)
    public static void main(String args[]) {
    try {
    System.out.print("Sending data...\n");
    Socket skt = new Socket(HOST, PORT);
                   // Set the socket option just in case server stalls
    skt.setSoTimeout ( 2000 );
                   skt.setSoKeepAlive(true);
    //Create a file input stream and a buffered input stream.
    FileInputStream fis = new FileInputStream("input.txt");
    BufferedInputStream in = new BufferedInputStream(fis);
    BufferedOutputStream out = new BufferedOutputStream( skt.getOutputStream() );
    //Read, and write the file to the socket
    int i;
    while ((i = in.read()) != -1) {
    out.write(i);
    //System.out.println(i);
                   // Enable SO_KEEPALIVE
    out.flush();
    out.close();
    in.close();
    skt.close();
    catch( Exception e ) {
    System.out.print("Error! It didn't work! " + e + "\n");
              catch( IOException e ) {
    System.out.print("Error! It didn't work! " + e + "\n");
    SERVER CODE
    import java.awt.Color;
    import java.awt.BorderLayout;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.Date;
    import java.io.*;
    import java.net.*;
    class ClientWorker implements Runnable {
    private Socket client;
    ClientWorker(Socket client) {
    this.client = client;
    public void run(){
    try      {
    FileOutputStream fos = new FileOutputStream("output.txt");
    BufferedOutputStream out = new BufferedOutputStream(fos);
    BufferedInputStream in = new BufferedInputStream( client.getInputStream() );
    //Read, and write the file to the socket
    int i;
    while ((i = in.read()) != -1) {
    out.write(i);
    //System.out.println(i);
    System.out.println("Receiving data...");
    out.flush();
    in.close();
    out.close();
    client.close();
    // srvr.close();
    System.out.println("Transfer complete.");
    catch(Exception e) {
    System.out.print("Error! It didn't work! " + e + "\n");
    class ss1 {
    ServerSocket server = null;
    ss1(){ //Begin Constructor
    } //End Constructor
    public void listenSocket(){
    try{
    server = new ServerSocket(4444);
    } catch (IOException e) {
    System.out.println("Could not listen on port 4444");
    System.exit(-1);
    while(true){
    ClientWorker w;
    try{
    w = new ClientWorker(server.accept());
    Thread t = new Thread(w);
    t.start();
    } catch (IOException e) {
    System.out.println("Accept failed: 4444");
    System.exit(-1);
    protected void finalize(){
    //Objects created in run method are finalized when
    //program terminates and thread exits
    try{
    server.close();
    } catch (IOException e) {
    System.out.println("Could not close socket");
    System.exit(-1);
    public static void main(String[] args){
    ss1 frame = new ss1();
         frame.listenSocket();
    }

    ............................................. After that I want to
    compare and see of the size of input.txt and
    serveroutput.txt . If both are same that means that
    data has been written reliably to the server.You don't need to do this. TCP/IP ensures the reliable transmition of data. By using a socket you are automaticaly sure that the data is reliably transmitted (Unless there is some sort of exception).
    To get the size of the files you can use a File object. Look it up in java.io package in API documentation.
    java-code-snippet (without error checking)
    File clientFile = new File("input.txt");
    clientFile.length();

  • Reading & Writing files with same extension(like ".sas", ".txt" , ".csv",and ".log" in Adobe AIR

    Hi Folks,
    How to read & write files with same extension(like ".sas", ".txt" , ".csv",and ".log" in Adobe AIR.
    Please let me tell if anybody knows asap.
    Thanks & Regards,
    Anderson

    Thanks Jon,
    But, I know how to read the file if we give exact file path
    I need to get the path  and  read file(s) with same extension files in the same folder using adobe air, not single file.
    Don't have file path even, i have folder path,  in that somany files are there. So i need to get which are the same extension(Ex: ".txt", ".sas") files
    If you have any idea , please help me out
    Regards,
    Vijay.

  • Reading Writing File Through JApplets on Client

    JApplet gives security Exception when reading or writing any file on client.
    The Java Policy is also changed and set to all permissions.
    Kindly Help.

    sign your applet

  • Reading / Writing Files ONLINE

    Well, i need to know a way to read and write files online with java.
    I am running a multiplayer online server thogh my computer, and want it to save the charecter files online
    to a storage somwhere (you can tell me where i should store it)
    All i need to save is txt online so i think it will probably be easier.
    Thanks.

    Your still not answering my question... My question is what function would i use in java...
    like this to read from an online txt
    public String checkVersion()
             String s1 = "";
                 try
                     URL url = new URL("http://URL.com/textfiles/version.txt");
                     URLConnection urlconnection = url.openConnection();
                     BufferedReader bufferedreader = null;
                     bufferedreader = new BufferedReader(new InputStreamReader(urlconnection.getInputStream()));
                     s1 = bufferedreader.readLine();
                     bufferedreader.close();
                 catch(Exception exception) { }
                 return s1;
             }is there a way to write online...

  • Reading Writing file MapInfo MIF / MID

    Hello People,
    Has some API / lib / Class for free to read and write file in MIF / MID.

    Did you find any source for a MIF/MID decoder? If so, please tell us.
    If you plan to write this yourself, how do you plan to do this?

  • Error reading/writing file "com.apple.logic.pro.cs"

    this is happening every time i save. any idea what's going on anyone?

    Quit logic and Manualy delete it
    the file is located in user/library/preferences
    G

  • Help with utl_file (read/write file from local directory)

    Need help reading/writing file on local machine from plsql using 10.2 DB.
    I am trying to read/write a file from a local directory(laptop) without success.
    I have been able to read/write to the database server directory but can't write to directory on local machine.
    The utl_file_dir parm has been set to * and the db restarted but I can't get it to work... Here's the plsql statement.
    out_file := UTL_FILE.FOPEN ( 'C:\PLSQL', 'TEST.TXT', 'W' ,32767);
    Whenever I run it continues to write to c:\PLSQL dir on the database server. Have looked at the "Directory" object and created MY_DIR = C:\PLSQL but it writes to the db server.
    Running 10.2 on a remote windows server, running PLSQL using sql*navigator.
    Thanks in advance for your help..

    I don't see how you expect the server to be able to see your laptop across the network, hack into it and start writing files. Even if it could, what if there is more than one laptop with a C: drive? How would it know which one to write to?
    Is there a shared drive on the server you can access via the laptop?

  • Read a file and write in different format

    Hi, I am new to Java, Please help me to do this.
    Just give me a hint as to what I should use to solve the problem below.
    Please suggest me what to do in Java.
    1. Read from a text file that has name in the following format:
    FirstName LastName
    Carol Bender
    Peter Milton
    Harish M. Mondol
    karen J. Funny
    2. Convert that file in the following format:
    Lastname, FirstName
    Bender, Carol
    Milton, Peter
    Mondol, Harish M.
    Program should read the <input-file-name> and
    <output-file-name> from the command promt as a parameter.

    What part are you having trouble with?
    Reading/writing files? http://java.sun.com/docs/books/tutorial/essential/io/Converting after reading? I'd suggest regex. http://java.sun.com/docs/books/tutorial/extra/regex/
    http://www.javaregex.com/I'd suggest using BufferedReader to read a line at a time. Once you've read that line use either String.replaceAll or java.util.regex.Matcher.replaceAll to replace A B with B, A

Maybe you are looking for

  • If then Else using DAX Calculation

    Hi all, new to DAX. I am trying to replicate a Oracle SQL column using DAX functions in SSAS Tabular. My Oracle column is defined like below: If STATE_CODE Not in('A','B','C','D')          And Not (substr(PK_ID,4,2) = 'XY' And DIV_CODE in('YU','SD'))

  • Disk Repair and Installation?

    Lately my Mac has been acting slow and some applications crash a lot more often then they should be. I want to give it a new clean slate but I still want to have those files. When I go to install it from the CD, under the options, it says that I can

  • After installing iOS5 i am unable to move built-in icons from one screen to another.

    Any ideas?  It works just fine on my iPhone4.  Just not on the iPad2.  I''m thinking there is a switch or something that I must have set incorrectly. Thanx! Al

  • Keynote 09 files not recognized as "Presentations" by Spotlight

    I have folders with various presentations in Powerpoint, Keynote 08 and Keynote 09 formats. I have setup Smart Folders with search criteria that show me these presentations in a single view. I use the search criteria "Kind = Presentations" to narrow

  • Data transfer from R3 and BW TO external system

    Hi experts I got one question which I couldnt find good answer. it concerns...data transfer from both R3 system and BW(here data is master data) to an external system. what are the various options to do this both from BW side and R3 side? which of th