wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes read  n bytes field name 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 "read  n bytes field name" Watch "read  n bytes field name" New topic
Author

read n bytes field name

David Dong
Ranch Hand

Joined: Aug 15, 2004
Posts: 58
Hi ,

can anyone helpe me solve this.
I don't know how I can read an n byte field name, where n bytes come from s1 length of field name .

I am getting weird character output.
Anton Golovin
Ranch Hand

Joined: Jul 02, 2004
Posts: 476
Originally posted by Big Head Moose:
Hi ,

can anyone helpe me solve this.
I don't know how I can read an n byte field name, where n bytes come from s1 length of field name .

I am getting weird character output.


Welcome to the forum. I bet the bartender is going to ask you to change your name according to their naming policy. As to your question, I use a RandomAccessFile to read from an nth element. It also lets you specify the number of bytes to read.

If you are getting a weird character output, this may be due to the incorrect translation of the bytes into the correct character set. Try to use the new String(byte[] chars, Stirng characterSet) constructor for the String object.


Anton Golovin (anton.golovin@gmail.com) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11404
    
  81

Hi Big Head Moose,

Welcome to JavaRanch and this forum.

We don't have many rules here, but one we do have is the JavaRanch Official Policy On Displayed Names, which requires your displayed name to be a real name.

Could you please change your displayed name to meet this policy? You can change it here.

Thanks,

Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: read n bytes field name
 
Similar Threads
NX: URLyBird 1.3.3 -- EOFException
URLyBird: Reading the db-File
About the db file question.
NX: UrlyBird data file format question
Assignment on it's way.....