File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes reading 6 bytes? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "reading 6 bytes?" Watch "reading 6 bytes?" New topic
Author

reading 6 bytes?

Howard lyee
Greenhorn

Joined: Apr 15, 2006
Posts: 1
in my database Scheme(Bodgitt and Scarper) the size fields is worth 6 bytes. What method do I use to read it in the randomAccess File Class. Thanks.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11503
    
  95

Hi Howard,

Welcome to JavaRanch and this forum.

Just above the "Database schema" section there is usually a sentence such as "All text values, and all fields (which are text only), contain only 8 bit characters..." - do you have this sentence?

If you do have this sentence, then it means that the size field is stored as the text representation of the number. So you can use the methods you are using to read all the other text fields.

Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
That been said, you can read 6 bytes using the read(byte[]) or read(byte[], int off, int len) method signatures.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
I think it would be worthwhile to study the difference between the read(byte[]) and readFully(byte[]) methods. For an array as small as 6 bytes it's fairly unlikely that the difference will be noticed, most of the time. However this is the sort of little detail that can lead to rare unexplained errors, so it's good to avoid this problem in the first place if possible.


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: reading 6 bytes?