dap4/d4lib/src/main/java/dap4/dap4lib/netcdf/Nc4DMRCompiler.java
protected void
    errcheck(int ret)
            throws DapException
    {
        if(ret != 0) {
            String msg = String.format("TestNetcdf: errno=%d; %s", ret, nc4.nc_strerror(ret));
            if(DEBUG)
                System.err.println(msg);
            throw new DapException(msg);
        }
    }
protected void
    errcheck(int ret)
            throws DapException
    {
        if(ret != 0) {
            String msg = String.format("TestNetcdf: errno=%d; %s", ret, nc4.nc_strerror(ret));
            if(DEBUG)
                System.err.println(msg);
            throw new DapException(msg);
        }
    }
/*Object[]
convert(int count, Object src, TypeNotes basetype)
throws DapException
{
boolean isenum = isenumtype(basetype);
boolean isopaque = basetype.isOpaque();
TypeNotes truetype = basetype;
if(isenum)
truetype = enumbasetype(basetype);

Object[] dst;
if(ischartype(basetype))
dst = new Character[count];
else
dst = new Object[count];
try {
for(int i = 0; i < dst.length; i++) {
switch (basetype.getType().getTypeSort()) {
case Char:
if(src instanceof char[])
dst[i] = ((char[]) src)[i];
else
dst[i] = (char) (((byte[]) src)[i]);
break;
case Int8:
case UInt8:
dst[i] = ((byte[]) src)[i];
break;
case Int16:
case UInt16:
dst[i] = ((short[]) src)[i];
break;
case Int32:
case UInt32:
dst[i] = ((int[]) src)[i];
break;
case Int64:
case UInt64:
dst[i] = ((long[]) src)[i];
break;
case Float32:
dst[i] = ((float[]) src)[i];
break;
case Float64:
dst[i] = ((double[]) src)[i];
break;
case String:
dst[i] = ((String[]) src)[i];
break;
case Opaque:
byte[] alldata = (byte[]) src;
int oplen = alldata.length / count;
for(i = 0; i < count; i++) {
dst[i] = new byte[oplen];
System.arraycopy(alldata, oplen * i, dst[i], 0, oplen);
}
break;
case Enum:
dst = convert(count, src, truetype);
break;
default:
throw new IllegalArgumentException("Unexpected sort: " + basetype.getType().getShortName());
}
}
return dst;
} catch (IllegalArgumentException |
ArrayIndexOutOfBoundsException e
) {
throw new DapException(e);
}
}