For example, in C and C ++, I pass a buffer, this buffer was built from a structure. And for example, I get this buffer over the network, impose a pointer to the structure and get the data structure.
struct i { int i; char s; }; struct i *i = &buf[0]; printf ( "%d\n", i->i ); What is the alternative in java? I looked a bit in the book and found that I could parlize an object, but I found only a file. The documentation did not find information about a function like this putObject () , which could buffer into a buffer for transmission over the network. And somewhere else I read that the serialization is wanted or removed already in new versions of java. In general, I do not understand how you can process data over the network in java, it's some kind of nightmare if there are no pointers. With pointers, I could do so.
struct number { int n; }; struct ver { int n; int v; }; struct her { int n; short v; }; struct number *n = &buf[0]; switch ( n->n ) { case 0: struct ver *v = &buf[0]; printf ( "%d\n", v->v ); break; case 1: struct her *h = &buf[0]; printf ( "%d\n", h->v ); break; } }