private void writeCompoundData(Structure s, UserType userType, int grpid, int varid, int typeid, Section section, ArrayStructure values) throws IOException, InvalidRangeException { SizeT[] origin = convertSizeT(section.getOrigin()); SizeT[] shape = convertSizeT(section.getShape()); SizeT[] stride = convertSizeT(section.getStride()); ArrayStructureBB valuesBB = StructureDataDeep.copyToArrayBB(s, values, ByteOrder.nativeOrder()); // LOOK embedded strings getting lost ?? ByteBuffer bbuff = valuesBB.getByteBuffer(); if (debugCompound) System.out.printf("writeCompoundData variable %s (grpid %d varid %d) %n", s.getShortName(), grpid, varid); // write the data // int ret = nc4.nc_put_var(grpid, varid, bbuff); int ret; if(section.isStrided()) ret = nc4.nc_put_vars(grpid, varid, origin, shape, stride, bbuff.array()); else ret = nc4.nc_put_vara(grpid, varid, origin, shape, bbuff.array()); if (ret != 0) throw new IOException(errMessage("nc_put_vars", ret, grpid, varid)); }
private void writeCompoundData(Structure s, UserType userType, int grpid, int varid, int typeid, Section section, ArrayStructure values) throws IOException, InvalidRangeException { SizeT[] origin = convertSizeT(section.getOrigin()); SizeT[] shape = convertSizeT(section.getShape()); SizeT[] stride = convertSizeT(section.getStride()); ArrayStructureBB valuesBB = StructureDataDeep.copyToArrayBB(s, values, ByteOrder.nativeOrder()); // LOOK embedded strings getting lost ?? ByteBuffer bbuff = valuesBB.getByteBuffer(); if (debugCompound) System.out.printf("writeCompoundData variable %s (grpid %d varid %d) %n", s.getShortName(), grpid, varid); //IntByReference val = new IntByReference(); //int ret2 = nc4.nc_inq_var_fletcher32(grpid, varid, val); //System.out.printf("%d = %d%n", ret2, val.getValue()); // write the data // int ret = nc4.nc_put_var(grpid, varid, bbuff); int ret; if (section.isStrided()) ret = nc4.nc_put_vars(grpid, varid, origin, shape, stride, bbuff.array()); else ret = nc4.nc_put_vara(grpid, varid, origin, shape, bbuff.array()); if (ret != 0) throw new IOException(errMessage("nc_put_vars", ret, grpid, varid)); }