Does this constrain me to using DataInputStream to read in the header ?
Also are filechannel writes are atomic if you say move to the start of a record, then write the whole record ?
caching all records and then sycronizing on the cache while updating the underlying file
Also has anyone got any good links to filechannel/nio tutorials/documentation.
Eric S: Are there any good online tutorials or other references for learning about NIO?
Michael McCloskey: There is the O'Reilly book on NIO by Ron Hitchens (mentioned earlier), and I have seen others, such as the early adopter book for J2SE 1.4.
charltony: I've noticed problems with the old I/O, but haven't experimented with NIO yet. I don't understand the design ideas behind NIO; they seem much more complex.
Mark Reinhold: Yes, New I/O is more complex than old I/O. If you only need to solve simple I/O problems and performance is not a super-critical issue for you, continuing to use java.io may well be preferable.
ms<br />SCJP, SCJD
"I'm not back." - Bill Harding, Twister
Originally posted by Tony Collins:
I'm using a file channel to read record fields into a ByteBuffer array. This seems to work quite well, not sure if the API for RandomAccessFile's supports this.
For updating a record I wish to write a byte buffer array( representing a record) to the file, I (think I)need to encode the string to US 8-Bit ASCII before adding it to a byte buffer and then writing the byte buffer. I believe I need an encoder but how do I get one of these ?
Any ideas how to convert a string to 8-bit US ASCII ?
Tony
1) If I use a cache I do not read a record from the file (as described) but from the cache. So does this match the requirements?
2) It is described that each element of the returned String[] is a record value. So am I not allowed to put the recNo to the returned [] cause its no record value?
but I'm german, my english is rather bad and therefore I'm sometimes not sure how strict things are meant.
A last question:
Is it right that the method deleteRecord have to be implemented but aren't used in the application?
Consider Paul's rocket mass heater. |