When I write a DataOutputStream, do I need to include the marker at the end of the file (ie. -1)?
For some reason I thought that Java did this for me, but I was reading back some of the variable length files I had written and keep getting an EndOfFile Exception (I was checking for -1). The data is a series of shorts.
Stefan is describing why having a physical byte that marks the end of a file is a bad idea. Simple enough to say there is no such thing. You do not have to add an EOF marker to your output. If you are getting an EOF exception the problem is in your program logic. Feel free to post your code and we can look it over.