• 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
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Database update problem URLybird

 
Ranch Hand
Posts: 114
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a problem with the db-1x2.db while updating the filed "size"(Maximum occupancy) .
4 bytes I can see in the hex editor as 32 20 20 20 for a value 2
when I write it back , it becomes 00 01 34 20 for a value 4
I think it should be 34 20 20 20


I have used
dbFile.writeUTF(new Integer(size).toString()); for writing
and


dbFile.readFully(input);
String str = new String(input, offset, length, "UTF-8"); for reading


Is there any byte alignment thing working here , or going to show some indifferent behavior later ?
 
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try changing your 4th argument to "US-ASCII" for the read operation. Hope this helps.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!