EldoS | Feel safer!

Software components for data protection, secure storage and transfer

More Java Examples / Context and GCHandle "Big Picture"

Posted: 03/06/2012 09:35:12
by Ralf Ulrich (Basic support level)
Joined: 03/06/2012
Posts: 3

Hi, I just started with CBFS in Java. The example you provided is working fine, I can see the drive and react on events.
But I don't understand how to work with the context right. Maybe because I know little about C++ and pointers.
I want to add some virtual files at startup. So I tested to add them via g_DiskContext.AddFile(). So far it works, but how do I use the context right and how can I write some actual data into my files?

Are there some other samples in Java so I can look it up there?
Or some documentation on how the EnumerationContext works and how to use it the right way?

Posted: 03/06/2012 10:54:49
by Eugene Mayevski (Team)

Context is a placeholder for your data, that's all. There's nothing to know about them. For example, you can have a global hash map of opened files and when the file is opened, add a reference to the actual data class in the hash map and store the key in the context. Now in file read or write event handler you use the context which is passed back to your event handler to access the data reference in the hash map.

Context classes in the sample just demonstrate how contexts can be used, but they should not be used as is (especially if you don't understand from code what they do). I.e. if you need to understand them - just ignore them and invent your own scheme of keeping the data and references.

As for more samples - we have more samples in C# and C++. There are no plans to make more samples for Java.

Sincerely yours
Eugene Mayevski



Topic viewed 786 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!