Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX:DataInputStream Java IO

 
Zhi Gang
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there,
in my assignment it descripe
"All numeric values are stored in the header information use the formats of the DataInputStream and DataOutputStream classes. All text values, and all fields (which are text only), contain only 8 bit characters, null terminated if less than the maximum length for the field. The character encoding is 8 bit US ASCII."
-------------------------------------------------
i had writen method that retrieve data using via DataInputStream and write with DataOutputStream, and i heard from a friend said that i "must" use the latest feaure from 1.4 -- NIO. So my question is must we use NIO?
 
S. Ganapathy
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that is up to you. RandomAccessFile is enough to complete the project. requirement does not say that you should use nio.
 
Michael Sunny
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One question here:
Did you get the reasonable owner id from the db file? For this field, I got nothing but others looks fine!
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For my file (db-2x1.db for NX-Contractors) the customer ID field is initially blank for all records. Which is perfectly reasonable as far as I can see. Dunno if this applies to your assignment.
 
S. Ganapathy
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Data provided in "db-2x1.db for NX-Contractors" is fresh data. So only when the client/user books that particular record, then client id will be stored in that field, which is 8 digit number.
Regards,
Ganapathy.
 
Billy Tsai
Ranch Hand
Posts: 1304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI
is the recNo the owner ID?
because there is no record number field in the database file and there are only 6 fields so I am confused about the int recNo in the methods predefined and if recNo is not owner field with length of 8 then what is it
and where is it positioned and the database file
thanks
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is the recNo the owner ID?
No. recNo can be determined by the position of the record in the file; the first one is recNo = 0, the next is recNo = 1, etc. Or you can start with 1 if you prefer; this isn't specified. Actually very little is specified about how recNo is determined. But as you say, it's not one of the six fields, so it seems the only way left to determine it is by position.
 
Thomas Kijftenbelt
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Billy,
Although I'm not the moderator... a request: please don't put the same question in various threads.
Greetings,
TK
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic