Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   File Reading and Writing (http://www.chiefdelphi.com/forums/showthread.php?t=96677)

james7132 05-08-2011 02:31

File Reading and Writing
 
I need to read and write to files found inside the executable jar sent to the cRIO. Does anyone know how I might do that? The java.io package available doesn't have any of the necessary classes or interfaces to do so, niether does the java.util package.

JesseK 05-08-2011 09:13

Re: File Reading and Writing
 
Doing anything with files inside an executable jar isn't trivial. Just loading a library that's packaged within a jar file takes more code than one would think it should (via Class.getResourceAsStream)

What files are you try to write to exactly?

Tom Bottiglieri 05-08-2011 11:20

Re: File Reading and Writing
 
I can assume you are trying to do this: load configuration in static files bundled in the jar, then change configuration data later?

If my wild guess is correct, I would use the bundled files as defaults, and then copy them out of the jar into the flash FS. Then, when the jar loads it can check the FS and either A) load the default if an existing config doesn't exist, B) leave it alone, or C) selectively replace components based on some method you figure out. Your app can then load off the local config rather than the bundled one.

iPhone apps often do things like this as bundled files are code signed and therefore non-writable.

derekwhite 06-08-2011 10:38

Re: File Reading and Writing
 
You could also loosen the restriction that the file has to be in a jar.

You can use ftp to copy any file you want to the cRIO, then use "regular" Java ME file io (see http://www.chiefdelphi.com/forums/sh...d.php?t=85012).

The SDK uses ftp itself to copy your jar file to the cRIO (actually a "suite" file, but similar contents). You can poke around the ant scripts (deploy.xml if I recall) to see how to script ftp copies.


All times are GMT -5. The time now is 01:20.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi