[gdal-dev] GDAL-Java: How to write Flot32, Int16?

Even Rouault even.rouault at mines-paris.org
Tue Nov 3 17:18:37 EST 2009


Selon Ivan <ivan.lucena at pmldnet.com>:

The Java API only uses ByteBuffer. But you can use the asDoubleBuffer(),
asFloatBuffer(), asIntBuffer() or asShortBuffer() methods to create views of the
byte buffer as double, float, int or short buffer.

For example :

ByteBuffer byteBuffer = ByteBuffer.allocateDirect(8 * buf_xsize * buf_ysize);
band.ReadRaster_Direct(0, 0, xsize, ysize, buf_xsize, buf_ysize,
gdal.GDT_Float64, byteBuffer);
DoubleBuffer doubleBuffer = byteBuffer.asDoubleBuffer();

> Hi,
>
> Does anybody know how to write a FloatBuffer, IntBuffer or ShotBuffer using
> the Java API?
>
> Thanks,
>
> Ivan
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>




More information about the gdal-dev mailing list