I have been thrown into an assignment in an area where I have VERY little experience.
I need to create a class that manipulates a file using .nio. Some parts of this class include create, get, put etc. To get started, I need to divide the file into blocks. Every other method revloves around this. The problem is, I do not know what a block is. I dont know if it is figurative or literal.
If figurative would some have some advice on what a block should be?
I hope you and understand what I am trying to say...
Using nio one can lock a portion of a file, this means that no other program will be able to lock that portion of the file(if it is not a shared lock). So, the lock owner can modify the contents of that portion of the file without worrying whether someone else(provided it also uses locks) is working on the file or not. This provides a way of multiple threads working on different portions of the file simultaneously. Probably, this is what you mean when you say "block" of a file. You can refer to the FileChannel API to get details on how to lock a file portion. Yeah, the concept of this lock is just figurative and there is no literal partitionof the file on the file system.
[ August 06, 2007: Message edited by: Nitesh Kant ] [ August 06, 2007: Message edited by: Nitesh Kant ]
[Ryan Waggoner: ] The problem is, I do not know what a block is. I dont know if it is figurative or literal.
The definition of exactly what a block is leads into discussions that can be dicey to work through. In general,a block is something you define or work with yourself, in code, and no matter how many critics lead you to superficial solutions to your question, only write some code and test it will provide meaningful, reliable answers that you can use for later thought.
A block is some sort of portion of the file. Files do not have intrinsic blocks, from Java's viewpoint. Anytime you hear the word block, you need to consider the possibility that there are two blind cooks in the kitchen, in which case you get wording like that in the comments on the short code snippet above.
The entire purpose of creating some sort of block - as in FileBlock, or any other representation of this idea - is that there appears often in real practice a need to set some portion of a file apart for work by the program. There can be other programs running. If two or more programs write to a file, they may change the file while another program is reading the file.
The result may look funny to the student. It looks hideous to someone who paid money for the machine to do some work in a real business.
"The differential equations that describe dynamic interactions of power generators are similar to that of the gravitational interplay among celestial bodies, which is chaotic in nature."
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com