• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Writing byte data to a random access file

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to write a record to a random access file, I was trying this with(rowOfData.getBytes("UTF-8")) even though the correct number of spaces for each field was correctly input into the database, when I try to look at the record thur the UI the record comes out as gibberish, I then tried the writebytes() method which converts a string into a byte array, the same thing is happening, when I manually go into the database and cut a original record out and cut an input record out they match up exactly, does anybody know what I am doing wrong?

Thanks, in advance.
Tom


 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tom,

I don't think there is anything wrong with your method of writing to file (except for the obvious lack of explicitly ensuring US-ASCII or UTF-8 is used). In which case it is more likely to be your method of creating the string that is problematic.

To test this, I wrote some code (that is deliberately bad code - it is better for you to find a good solution to your own problem than to copy my code). My program is When run, I can see the file looks reasonable:Regards, Andrew
[ July 14, 2005: Message edited by: Andrew Monkhouse ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic