Package com.sun.jna.ptr

Examples of com.sun.jna.ptr.NativeLongByReference


    ret = nc4.nc_inq_unlimdims(grpid, nunlimdimsp, unlimdimids);

    int ndims = ndimsp.getValue();
    for (int i = 0; i < ndims; i++) {
      byte[] name = new byte[NCLibrary.NC_MAX_NAME + 1];
      NativeLongByReference lenp = new NativeLongByReference();
      ret = nc4.nc_inq_dim(grpid, dimids[i], name, lenp);
      if (ret != 0) throw new IOException(nc4.nc_strerror(ret));
      String dname = makeString(name);

      boolean isUnlimited = containsInt(nunlimdimsp.getValue(), unlimdimids, i);
      Dimension dim = new Dimension(dname, lenp.getValue().intValue(), true, isUnlimited, false);
      ncfile.addDimension(g4.g, dim);
      if (debug) System.out.printf(" add Dimension %s (%d) %n", dim, dimids[i]);
    }
  }
View Full Code Here


      IntByReference xtypep = new IntByReference();
      ret = nc4.nc_inq_atttype(grpid, varid, attname, xtypep);
      if (ret != 0)
        throw new IOException(nc4.nc_strerror(ret) + " varid=" + varid + "attnum=" + attnum);

      NativeLongByReference lenp = new NativeLongByReference();
      ret = nc4.nc_inq_attlen(grpid, varid, attname, lenp);
      if (ret != 0) throw new IOException(nc4.nc_strerror(ret));
      int len = lenp.getValue().intValue();

      Array values = null;
      int type = xtypep.getValue();
      switch (type) {
        case NCLibrary.NC_UBYTE:
View Full Code Here

    if (ret != 0) throw new IOException(nc4.nc_strerror(ret));

    // for each defined "user type", get information, store in Map
    for (int typeid : xtypes) {
      byte[] nameb = new byte[NCLibrary.NC_MAX_NAME + 1];
      NativeLongByReference sizep = new NativeLongByReference();
      IntByReference baseType = new IntByReference();
      NativeLongByReference nfieldsp = new NativeLongByReference();
      IntByReference classp = new IntByReference();

      ret = nc4.nc_inq_user_type(grpid, typeid, nameb, sizep, baseType, nfieldsp, classp); // size_t
      if (ret != 0) throw new IOException(nc4.nc_strerror(ret));

      String name = makeString(nameb);
      int utype = classp.getValue();
      System.out.printf(" user type=%d name=%s size=%d baseType=%d nfields=%d class=%d %n ",
          typeid, name, sizep.getValue().longValue(), baseType.getValue(), nfieldsp.getValue().longValue(), utype);

      UserType ut = new UserType(grpid, typeid, name, sizep.getValue().longValue(), baseType.getValue(),
          nfieldsp.getValue().longValue(), classp.getValue());
      userTypes.put(typeid, ut);

      if (utype == NCLibrary.NC_ENUM) {
        Map<Integer, String> map = makeEnum(grpid, typeid);
        EnumTypedef e = new EnumTypedef(name, map);
        g.addEnumeration(e);
        ut.setEnum(e);

     } else if (utype == NCLibrary.NC_OPAQUE) {
        byte[] nameo = new byte[NCLibrary.NC_MAX_NAME + 1];
        NativeLongByReference sizep2 = new NativeLongByReference();
        ret = nc4.nc_inq_opaque(grpid, typeid, nameo, sizep2);
        if (ret != 0) throw new IOException(nc4.nc_strerror(ret));
        String nameos = makeString(nameo);

        // doesnt seem to be any new info
        System.out.printf("   opaque type=%d name=%s size=%d %n ",
            typeid, nameos, sizep2.getValue().longValue());
      }
    }
  }
View Full Code Here

  }

  private Map<Integer, String> makeEnum(int grpid, int xtype) throws IOException {
    byte[] nameb = new byte[NCLibrary.NC_MAX_NAME + 1];
    IntByReference baseType = new IntByReference();
    NativeLongByReference baseSize = new NativeLongByReference();
    NativeLongByReference numMembers = new NativeLongByReference();

    int ret = nc4.nc_inq_enum(grpid, xtype, nameb, baseType, baseSize, numMembers);
    if (ret != 0) throw new IOException(nc4.nc_strerror(ret));
    int nmembers = numMembers.getValue().intValue();
    String name = makeString(nameb);

    //System.out.printf(" type=%d name=%s baseType=%d baseType=%d numMembers=%d %n ",
    //    xtype, name, baseType.getValue(), baseSize.getValue().longValue(), nmembers);
    Map<Integer, String> map = new HashMap<Integer, String>(2 * nmembers);
 
View Full Code Here

      for (int fldidx=0; fldidx<nfields; fldidx++) {
        byte[] fldname = new byte[NCLibrary.NC_MAX_NAME + 1];
        IntByReference field_typeidp = new IntByReference();
        IntByReference ndimsp = new IntByReference();
        IntByReference dim_sizesp = new IntByReference();
        NativeLongByReference offsetp = new NativeLongByReference();

        int[] dims = new int[NCLibrary.NC_MAX_DIMS];
        int ret = nc4.nc_inq_compound_field(grpid, typeid, fldidx, fldname, offsetp, field_typeidp, ndimsp, dims);
        if (ret != 0) throw new IOException(nc4.nc_strerror(ret));

        Field fld = new Field(grpid, typeid, fldidx, makeString(fldname), offsetp.getValue().intValue(),
                field_typeidp.getValue(), ndimsp.getValue(), dims);

        addField( fld);
        System.out.println(" add field= "+fld);
      }
View Full Code Here

   * readProcessMemory to memory.
   */
  long readProcessMemory(Pointer baseAddress, Memory goal)
  {
    NativeLong sizeAvalaible = new NativeLong(goal.size());
    NativeLongByReference bytesReadRefernce = new NativeLongByReference();
    boolean ret = MyKernel32.INSTANCE.ReadProcessMemory(_processInformation.hProcess.getPointer(), baseAddress, goal,
        sizeAvalaible, bytesReadRefernce);
    if (!ret)
      log("pid " + _pid + " ReadProcessMemory returns " + ret);
    long bytesRead = bytesReadRefernce.getValue().longValue();
    return bytesRead;

  }
View Full Code Here

         * @throws X11Exception thrown if X11 window errors occurred
         */
        public byte[] getProperty(X11.Atom xa_prop_type, X11.Atom xa_prop_name) throws X11Exception {
            X11.AtomByReference xa_ret_type_ref = new X11.AtomByReference();
            IntByReference ret_format_ref = new IntByReference();
            NativeLongByReference ret_nitems_ref = new NativeLongByReference();
            NativeLongByReference ret_bytes_after_ref = new NativeLongByReference();
            PointerByReference ret_prop_ref = new PointerByReference();

            NativeLong long_offset = new NativeLong(0);
            NativeLong long_length = new NativeLong(MAX_PROPERTY_VALUE_LEN / 4);

View Full Code Here

            throw new NullPointerException(LIB_NAME+" could not be loaded");
    }

    static public /*synchronized*/ void initContext() throws ScardException {
  if (contextId == 0) {
            NativeLongByReference phContext = new NativeLongByReference();
            phContext.setValue(new NativeLong((long) 0));
            NativeLong status = win32PCSC.SCardEstablishContext(SCARD_SCOPE_USER, Pointer.NULL, Pointer.NULL, phContext);
            Runtime.getRuntime().addShutdownHook(new Thread() {
                @Override
                public void run() {
                    if(0!=contextId)
                        win32PCSC.SCardReleaseContext(new NativeLong(contextId));
                }
            });
            if (0 != status.longValue()) {
                throw new PcScException(status.intValue());
            }
      contextId = phContext.getValue().longValue();
  }
    }
View Full Code Here

        }
        return phContext.getValue().longValue();
    }*/

    static long SCardConnect(long contextId, String readerName, int shareMode, int preferredProtocols) throws PcScException {
        NativeLongByReference phCard = new NativeLongByReference();
        IntByReference pdwActiveProtocol = new IntByReference();
        NativeLong status = win32PCSC.SCardConnectW(new NativeLong(contextId), new WString(readerName), shareMode, preferredProtocols,
                phCard,
                pdwActiveProtocol);
        if (SCARD_S_SUCCESS != status.longValue()) {
            throw new PcScException(status.intValue());
        }
        return phCard.getValue().longValue();
    }
View Full Code Here

        }
        return phCard.getValue().longValue();
    }

    static long SCardReconnect(long cardId, int shareMode, int preferredProtocols, int activationPolicy) throws PcScException {
        NativeLongByReference phCard = new NativeLongByReference();
        IntByReference pdwActiveProtocol = new IntByReference();
        NativeLong status = win32PCSC.SCardReconnect(new NativeLong(cardId), shareMode, preferredProtocols,
                activationPolicy,
                pdwActiveProtocol);
        if (SCARD_S_SUCCESS != status.longValue()) {
            throw new PcScException(status.intValue());
        }
        return phCard.getValue().longValue();
    }
View Full Code Here

TOP

Related Classes of com.sun.jna.ptr.NativeLongByReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.