• 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
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Able to save File but unable to write to file  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Im having this weird problem where im able to save a new file but im unable to write into the saved file.

care to explain where and what went wrong with my code?

Thanks in advance!
cheers!

 
Sheriff
Posts: 23714
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you know you are unable to write to the file?
 
Kim wee
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because the file size is 1KB everytime i save the files and when i open the file its empty.
 
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Kim wee wrote:because the file size is 1KB everytime i save the files and when i open the file its empty.


1 kb is not an empty file... try opening it in a text editor. Writing an object information will take that much size only I think.
 
Saloon Keeper
Posts: 4867
117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the "file" object that you're writing to the file?
 
Sheriff
Posts: 21503
96
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And how do you open the file? The file will contain binary contents, not text. That means that a text editor will most likely not be very good at displaying the file. A HEX editor is a better choice.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!