You wrote File dataStorageDirectory = new File(argPath); File toWrite = new File(argPath + argFileName);
Do you intent to write File dataStorageDirectory = new File(argPath); File toWrite = new File(argPath, argFileName); ',' instead of '+' for appending a filename to the path? See JavaDoc for File(String parent, String child). BTW: If you open an existing file for writing again it will be overwritten if you write to it. Run the following to see what I mean: <code> import java.io.*; public class Test { public static void main(String [] args) throws IOException { String filename = "test.txt"; File file = new File(filename); FileOutputStream out = new FileOutputStream(filename); byte msg [] = new byte[10]; out.write(msg); out.close(); System.out.println("first: " + file.length()); out = new FileOutputStream(filename); msg = new byte [1]; out.write(msg); out.close(); System.out.println("second: " + file.length()); } } </code> - Sascha Sunburned Surveyor schrieb: > I had a few minutes after my wife went to bed tonight to work on my > FeatureCache. I'm currently writing code for the BOFFFeatureWriter. In > this class I have a method that sets up a DataOutputStream so I can > write bytes representing the feature to a binary file. > > I need to see if a binary file representing the Feature already > exists. If it does exist I need to delete it so the file can be > "overwritten". (In the FeatureCache each Feature is saved to a binary > file that has a unique name. This unique name is the same as the > unique number that identifies the Feature object. I don't want to > append the data being written to an existing file, nor do I want to > have two (2) files with different names representing the same Feature > object.) > > I haven't written a lot of Java I/O code, so I was hoping one of you > more experienced developers might look at the method I wrote that > prepares the DataOutputStream to see if I had any obvious mistakes or > bugs. I have pasted the method statements in the attached text file. > > Thank you for the help. > > The Sunburned Surveyor > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel