我想将一组坐标从字节数组中提取到 DoubleBuffer 中。
下面是我如何从主字节数组中提取一组坐标到另一个字节数组中的示例。
byte intPoints[] = new byte[4];
byte geomCoords[];
...
is = new ByteArrayInputStream(stmt.column_bytes(0)); //reads the polygon from db
...
is.read(intPoints); //intPoints now holds the number of points in the polygon
//After this is read the actual coordinate list is next
//Set the size of geomCoords to hold all coordinates,
//There are 2 coordinates per point and each coordinate is a double value(8 bytes)
geomCoords = new byte[ByteBuffer.wrap(intPoints).order(endian).getInt() * 2 * 8];
is.read(geomCoords); //geomCoords now holds all the coordinates for the polygon
我的问题是:
如何将 geomCoords 字节数组放入 DoubleBuffer?
或者
我可以在不创建 geomCoords 的情况下将这些数据放入 DoubleBuffer 吗?速度和效率是关键,因此欢迎任何捷径或优化!