• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

File I/O

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm reading and writing to the same file in one class. It seems that the file input stream is not closed before i open the file output stream even though I do these things at different times in different methods in my code and always 'finally' close the streams after use.
Reading:

Writing:

How do I make sure these things happen one after the other instead of at the same time?
Thanks,
Brendan
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are the symptoms you're getting?
Have you tried explictly flushing the first stream before closing it?
You got threads somewhere in there?
-Barry
 
Brendan Kennedy
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply
The exception is as follows:-
java.io.FileNotFoundException: keno.xml (Permission denied)
I can write to a second file in the second part with no problems.
I get an error on compilation if I try to flush a fileinputstream and flushing the outputstream doesn't seem to do anything.
It's possible the marshal/unmarshal method is threaded.. I'll have to research it.
Brendan
reply
    Bookmark Topic Watch Topic
  • New Topic