A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Certification
»
Developer Certification (SCJD/OCMJD)
Author
B&S: Problem -read field length in bytes
Vaishali Paramane
Ranch Hand
Joined: Mar 05, 2007
Posts: 106
posted
Aug 09, 2007 16:14:00
0
Hi
following is a code to read database.
I want to read field lenght.
right now i used hard coded.
Can anybody help me?
fieldsize = raf.readShort();//number of fields //Schema description section for( int i = 0 ; i< fieldsize ; i++){ //name of field skip=raf.readShort(); name = new byte[skip]; raf.readFully(name); fieldname = new String(name,"US-ASCII"); System.out.println(" \t" +fieldname); //length of field [B]skip=raf.readShort();[/B] //I have problem here I want to display this field size } short flag = raf.readShort(); System.out.println("byte flag " +flag);
[ August 09, 2007: Message edited by: Barry Gaunt ]
SCJP, SCJD
Preparing for SCWCD
Barry Gaunt
Ranch Hand
Joined: Aug 03, 2002
Posts: 7729
posted
Aug 09, 2007 22:46:00
0
I have edited your post because we do not allow such large amounts of code which can possibly tell how to read the datafile.
Now - what exactly to you expect? What is the result that you are getting that is confusing you?
//I have problem here I want to display this field size
Why don't you just print it out?
[ August 09, 2007: Message edited by: Barry Gaunt ]
Ask a Meaningful Question
and
HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Sanjeev Singh
Ranch Hand
Joined: Nov 01, 2006
Posts: 381
posted
Aug 10, 2007 02:26:00
0
following is a code to read database.
It is for reading the schema.
Why you are reading a short value though it is byte?
~Sanjeev Singh<br />SCJP 1.5
Vaishali Paramane
Ranch Hand
Joined: Mar 05, 2007
Posts: 106
posted
Aug 10, 2007 11:35:00
0
Thanks Barry & Sanjeev
Thanks for help
My problem solved
[ August 10, 2007: Message edited by: Vaishali Paramane ]
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: B&S: Problem -read field length in bytes
Similar Threads
NX:[URLyBird]How to use the specified Data File Format?
B&S: problem in the db file processing
DB file reading problem
B&S:db format question
still stuck in database
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter