Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

object writing?

  Asked By: James    Date: Nov 09    Category: Java    Views: 444
  

i am redeveloping an existing system(which is in c++).The new system
is in java ofcourse. i have existing classes in c++ for reading data
from file. which is something like this.
class myclass
{
char var1[10];
char var2[20];

...}
now in c++ i can read the entire class from a file directly if the
variable are in sequence by say
fin.read((char *) mc, sizeof(mc)); //fin is file pointer
if mc is an object of myclass then first 10 bytes of the files are
copied to var1, next to var2 and so on.
i want to write the same thing in java. without having to assign
values to each variable individually.
Serialization is an option but my input file is an ordinary binary
file and not a serialised file.
Is there anyway i can write bytes directly to the object.
Plz help. If this is possible it will same my 40% of coding time

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on object writing? Or get search suggestion and latest updates.




Tagged: