• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

write problem in text file  RSS feed

 
Ranch Hand
Posts: 251
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello everyone!!

i have completed one project on segmentation. when i click on a button to write the data in a text file then there are no write operation perform on the file...after writing file is blank...can anyone tell me why this happen to me.
 
Sheriff
Posts: 21745
102
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you flushing and closing the stream / writer?
 
Thakur Sachin Singh
Ranch Hand
Posts: 251
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is code of my recontruct button...i write my segment data in a file from this button.
 
Thakur Sachin Singh
Ranch Hand
Posts: 251
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but problem is...when i write the data in this file then no data write to this file.
 
author
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thakur Sachin Singh wrote:but problem is...when i write the data in this file then no data write to this file.



You close them in the backwards order. You need to close dos first, fos last. The way it's now, first you close the file then you close the intermediate filters, telling them to flush the data. They try to flush but the file is already closed, so they have nowhere to write to.
 
Thakur Sachin Singh
Ranch Hand
Posts: 251
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but problem is same if i change the order like this.



what you want to say about filters and flush.
 
Popeye has his spinach. I have this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!