本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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));
}
示例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);
}
示例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));
}
示例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");
}
示例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));
}