Lets supose I define a class
public class PointFloat {
float x;
float y;
}
Then I instantiate an array
PointFloat[] points = new PointFloat[10];
At this point I have an array of ten PointFloat Objects. Lets supose that some code assigns values x and y to every pointfloats. What I need is to store that array in a VARBINARY in a Mysql database.
To accomplish this I would need to convert this array of PointFloats to byte[] so I can insert into the database using a PreparedStatement Nothing new for me to use a PreparedStatement but first time using objects serialization.
How do you convert an array of PointFloat of any size to a byte[]?. Please keep it as simple as possible.
Thank you very much for reading.
BLOBthen the only way to edit is to load the whole lot. If you can change the database schema, that's a win every time.