void getfield( Class theType, Object obj, byte[] barray, int offset ) throws HDFException {

    String type = theType.getName();

    byte arow[];
    if (type.equals("int")) {
        arow = ncsa.hdf.hdflib.HDFNativeData.intToByte((Integer)obj);
        System.arraycopy(arow,0,barray,offset,4);
        return ;
    } else  if (type.equals("byte")) {
        byte f = ((Byte)obj).byteValue();
        barray[offset] = f;
        return ;
    } else  if (type.equals("short")) {
        arow = ncsa.hdf.hdflib.HDFNativeData.shortToByte((Short)obj);
        System.arraycopy(arow,0,barray,offset,2);
        return ;
    } else  if (type.equals("float")) {
        /* 32 bit float */
        arow = ncsa.hdf.hdflib.HDFNativeData.floatToByte((Float)obj);
        System.arraycopy(arow,0,barray,offset,4);
        return ;
    } else  if (type.equals("long")) {
        arow = ncsa.hdf.hdflib.HDFNativeData.longToByte((Long)obj);
        System.arraycopy(arow,0,barray,offset,8);
        return ;
    } else  if (type.equals("double")) {
        arow = ncsa.hdf.hdflib.HDFNativeData.doubleToByte((Double)obj);
        System.arraycopy(arow,0,barray,offset,8);
        return ;
    } else if (type.equals("java.lang.String")) {
        arow = ((String)obj).getBytes();
        System.arraycopy(arow,0,barray,offset,
            java.lang.reflect.Array.getLength(arow));
        return ;
    } else if (type.startsWith("[")) {
        if ((obj.getClass().isArray()) == false) {
            HDFException ex =
            new HDFJavaException("HDFTable: getfield not an array?: "+theType+" "+type);
            throw(ex);
        }
        HDFArray aa = new HDFArray(obj);
        arow = aa.byteify();
        System.arraycopy(arow,0,barray,offset,
            java.lang.reflect.Array.getLength(arow));

        return;
    } else {
        HDFException ex =
        new HDFJavaException("HDFTable: getfield unsupported type?: "+theType+" "+type);
        throw(ex);
    }
}