当前位置: 首页>>代码示例>>Java>>正文


Java X11.Atom方法代码示例

本文整理汇总了Java中com.sun.jna.platform.unix.X11.Atom方法的典型用法代码示例。如果您正苦于以下问题:Java X11.Atom方法的具体用法?Java X11.Atom怎么用?Java X11.Atom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.jna.platform.unix.X11的用法示例。


在下文中一共展示了X11.Atom方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNullTerminatedProperty

import com.sun.jna.platform.unix.X11; //导入方法依赖的package包/类
/**
 * Returns the property value as a null terminated byte array.
 * 
 * @param xa_prop_type property type
 * @param xa_prop_name property name
 * @return property value as a null terminated byte array
 * @throws X11Exception thrown if X11 window errors occurred
 */
public byte[] getNullTerminatedProperty(X11.Atom xa_prop_type, X11.Atom xa_prop_name) throws X11Exception {
  byte[] bytesOrig = getProperty(xa_prop_type, xa_prop_name);
  byte[] bytesDest;

  // search for '\0'
  int i;
  for (i = 0; i < bytesOrig.length; i++) {
    if (bytesOrig[i] == '\0') break;
  }

  if (i < bytesOrig.length - 1) {
    bytesDest = new byte[i + 1];
    System.arraycopy(bytesOrig, 0, bytesDest, 0, i + 1);
  } else {
    bytesDest = bytesOrig;
  }

  return bytesDest;
}
 
开发者ID:xwizard,项目名称:1de,代码行数:28,代码来源:X.java

示例2: getAtom

import com.sun.jna.platform.unix.X11; //导入方法依赖的package包/类
/**
 * Get internal atoms by name.
 * 
 * @param name name of the atom
 * @return atom
 */
public X11.Atom getAtom(String name) {
  X11.Atom atom = atomsHash.get(name);
  if (atom == null) {
    atom = x11.XInternAtom(x11Display, name, false);
    atomsHash.put(name, atom);
  }
  return atom;
}
 
开发者ID:xwizard,项目名称:1de,代码行数:15,代码来源:X.java

示例3: getNullReplacedStringProperty

import com.sun.jna.platform.unix.X11; //导入方法依赖的package包/类
/**
 * Returns the property value as byte array where every '\0' character is replaced by '.'.
 * 
 * @param xa_prop_type property type
 * @param xa_prop_name property name
 * @return property value as byte array where every '\0' character is replaced by '.'
 * @throws X11Exception thrown if X11 window errors occurred
 */
public byte[] getNullReplacedStringProperty(X11.Atom xa_prop_type, X11.Atom xa_prop_name)
    throws X11Exception {
  byte[] bytes = getProperty(xa_prop_type, xa_prop_name);

  // search for '\0'
  int i;
  for (i = 0; i < bytes.length; i++) {
    if (bytes[i] == '\0') {
      bytes[i] = '.';
    }
  }

  return bytes;
}
 
开发者ID:xwizard,项目名称:1de,代码行数:23,代码来源:X.java

示例4: getUtf8Property

import com.sun.jna.platform.unix.X11; //导入方法依赖的package包/类
/**
 * Returns the property value as UTF8 string where every '\0' character is replaced by '.'.
 * 
 * @param xa_prop_type property type
 * @param xa_prop_name property name
 * @return property value as UTF8 string where every '\0' character is replaced by '.'
 * @throws X11Exception thrown if X11 window errors occurred
 */
public String getUtf8Property(X11.Atom xa_prop_type, X11.Atom xa_prop_name) throws X11Exception {
  try {
    return new String(getNullReplacedStringProperty(xa_prop_type, xa_prop_name), "UTF8");
  } catch (UnsupportedEncodingException e) {
    throw new X11Exception(e);
  }
}
 
开发者ID:xwizard,项目名称:1de,代码行数:16,代码来源:X.java

示例5: getUtf8ListProperty

import com.sun.jna.platform.unix.X11; //导入方法依赖的package包/类
/**
 * Returns the property value as UTF8 string list
 * 
 * @param xa_prop_type property type
 * @param xa_prop_name property name
 * @return property value as UTF8 string list
 * @throws X11Exception thrown if X11 window errors occurred
 */
public String[] getUtf8ListProperty(X11.Atom xa_prop_type, X11.Atom xa_prop_name) throws X11Exception {
  try {
    return new String(getProperty(xa_prop_type, xa_prop_name), "UTF8").split("\0");
  } catch (UnsupportedEncodingException e) {
    throw new X11Exception(e);
  }
}
 
开发者ID:xwizard,项目名称:1de,代码行数:16,代码来源:X.java

示例6: getIntProperty

import com.sun.jna.platform.unix.X11; //导入方法依赖的package包/类
/**
 * Returns the property value as integer.
 * 
 * @param xa_prop_type property type
 * @param xa_prop_name property name
 * @return property value as integer
 * @throws X11Exception thrown if X11 window errors occurred
 */
public int getIntProperty(X11.Atom xa_prop_type, X11.Atom xa_prop_name) throws X11Exception {
  return bytesToInt(getProperty(xa_prop_type, xa_prop_name));
}
 
开发者ID:xwizard,项目名称:1de,代码行数:12,代码来源:X.java

示例7: getWindowProperty

import com.sun.jna.platform.unix.X11; //导入方法依赖的package包/类
/**
 * Returns the property value as window.
 * 
 * @param xa_prop_type property type
 * @param xa_prop_name property name
 * @return property value as window
 * @throws X11Exception thrown if X11 window errors occurred
 */
public Window getWindowProperty(X11.Atom xa_prop_type, X11.Atom xa_prop_name) throws X11Exception {
  int windowId = getIntProperty(xa_prop_type, xa_prop_name);
  X11.Window x11Window = new X11.Window(windowId);
  return new Window(display, x11Window);
}
 
开发者ID:xwizard,项目名称:1de,代码行数:14,代码来源:X.java

示例8: getStringProperty

import com.sun.jna.platform.unix.X11; //导入方法依赖的package包/类
/**
 * Returns the property value as string where every '\0' character is replaced by '.'.
 * 
 * @param xa_prop_type property type
 * @param xa_prop_name property name
 * @return property value as string where every '\0' character is replaced by '.'
 * @throws X11Exception thrown if X11 window errors occurred
 */
public String getStringProperty(X11.Atom xa_prop_type, X11.Atom xa_prop_name) throws X11Exception {
  return new String(getNullReplacedStringProperty(xa_prop_type, xa_prop_name));
}
 
开发者ID:xwizard,项目名称:1de,代码行数:12,代码来源:X.java

示例9: getStringListProperty

import com.sun.jna.platform.unix.X11; //导入方法依赖的package包/类
/**
 * Returns the property value as string list.
 * 
 * @param xa_prop_type property type
 * @param xa_prop_name property name
 * @return property value as string list
 * @throws X11Exception thrown if X11 window errors occurred
 */
public String[] getStringListProperty(X11.Atom xa_prop_type, X11.Atom xa_prop_name) throws X11Exception {
  return new String(getProperty(xa_prop_type, xa_prop_name)).split("\0");
}
 
开发者ID:xwizard,项目名称:1de,代码行数:12,代码来源:X.java

示例10: getProperty

import com.sun.jna.platform.unix.X11; //导入方法依赖的package包/类
/**
 * Returns the property value as a byte array.
 * 
 * @param xa_prop_type property type
 * @param xa_prop_name property name
 * @return property value as a byte array
 * @throws X11Exception thrown if X11 window errors occurred
 */
public byte[] getProperty(X11.Atom xa_prop_type, String xa_prop_name) throws X11Exception {
  return getProperty(xa_prop_type, display.getAtom(xa_prop_name));
}
 
开发者ID:xwizard,项目名称:1de,代码行数:12,代码来源:X.java


注:本文中的com.sun.jna.platform.unix.X11.Atom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。