File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reading database file - B&S

 
Dan Murphy
Ranch Hand
Posts: 126
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'd be intereseted to know which class(es) others have found most useful for reading the database file. The prime candidate to me seems to be RandomAccessFile. In my assignment is says that all text values:

"contain only 8 bit characters, null terminated if less than the maximum length for the field. The characterr encoding is 8 bit US ASCII".

Can I use the readUTF() method of RandomAccessFile to read these string or is there another (better) way?

Thanks in Advance,
Dan
 
Paul Bourdeaux
Ranch Hand
Posts: 783
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dan,

There is no such thing as "8 bit US ASCII". This is a known mistake in the assignment, and you should mention it in your choices.txt. The general consensus here is to use ISO-8859-1 encoding instead.

As far as reading the file, you can use the RAF's read(byte[] b) method and convert it into a String. For example:
 
Janelle Smith
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've found the File, FileInputStream and DataInputStream classes to work very well for reading the db file.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic