本文整理了Java中at.o2xfs.win32.ZSTR
类的一些代码示例,展示了ZSTR
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZSTR
类的具体详情如下:
包路径:at.o2xfs.win32.ZSTR
类名称:ZSTR
[英]A null-terminated ASCII string.
[中]以null结尾的ASCII字符串。
代码示例来源:origin: AndreasFagschlunger/O2Xfs
private Buffer getFunctionAddress(final String name) {
try {
return getFunctionAddress0(moduleHandle, new ZSTR(name));
} catch (final NativeException e) {
throw new RuntimeException("Error getting function address: moduleHandle=" + moduleHandle + ",name=" + name, e);
}
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
/**
* Retrieves the data for the value with the specified name, within the
* specified open key.
*/
public String wfmQueryValue(final HKEY hKey, final String valueName) throws XfsException {
final ZSTR data = new ZSTR(SIZE_LIMIT, true);
final DWORD cchData = new DWORD(data.getSize());
final int errorCode = wfmQueryValue0(hKey, new ZSTR(valueName), data, cchData);
XfsException.throwFor(errorCode);
return data.toString();
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
public ZSTR(final int length, final boolean allocate) {
super(length);
if (length < 1) {
throw new IllegalArgumentException("Illegal length: " + length + ", must be >= 1");
}
if (allocate) {
allocate();
}
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
/**
* Enumerates the values of the specified open key. Retrieves the name and
* data for one value each time it is called.
*/
public Map.Entry<String, String> wfmEnumValue(final HKEY hKey, final DWORD iValue) throws XfsException {
ZSTR value = new ZSTR(SIZE_LIMIT, true);
ZSTR data = new ZSTR(SIZE_LIMIT, true);
DWORD cchValue = new DWORD(SIZE_LIMIT);
DWORD cchData = new DWORD(SIZE_LIMIT);
final int errorCode = wfmEnumValue0(hKey, iValue, value, cchValue, data, cchData);
XfsException.throwFor(errorCode);
return new ValuePair(value.toString(), data.toString());
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
public String getDescription() {
return description.toString();
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
public WFSVersion(WFSVersion copy) {
this();
allocate();
version.set(copy.version);
lowVersion.set(copy.lowVersion);
highVersion.set(copy.highVersion);
description.set(copy.description.get());
systemStatus.set(copy.systemStatus.get());
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
@Override
public byte[] get() {
return getBytes();
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
/**
* Enumerates the subkeys of the specified open key. Retrieves information
* about one subkey each time it is called.
*
* @param key
* Handle to a currently open key, or the predefined handle
* value: {@link #WFS_CFG_HKEY_XFS_ROOT}
* @return the name of the subkey
*/
public String wfmEnumKey(final HKEY key, final DWORD iSubKey) throws XfsException {
final ZSTR name = new ZSTR(SIZE_LIMIT, true);
DWORD cchName = new DWORD(name.length);
FILETIME lastWrite = new FILETIME();
final int errorCode = wfmEnumKey0(key, iSubKey, name, cchName, lastWrite);
XfsException.throwFor(errorCode);
return name.toString();
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
public String getSystemStatus() {
return systemStatus.toString();
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
@Override
public String toString() {
String result = new String(getBytes(), StandardCharsets.US_ASCII);
if (result.indexOf(NUL) != -1) {
result = result.substring(0, result.indexOf(NUL));
}
return result;
}
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
/**
* {@link #hsmVendor}
*/
public void setHSMVendor(final String hsmVendor) {
this.hsmVendor.pointTo(new ZSTR(hsmVendor));
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
@Test
public final void helloWorld() {
final String expected = "Hello World!";
ZSTR zString = new ZSTR(expected);
Assert.assertEquals(expected, zString.toString());
}
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
private static ZSTR toZZString(final Map<String, String> map, final char separator) {
StringBuilder zzString = new StringBuilder();
if (map.isEmpty()) {
zzString.append(NUL);
} else {
for (Map.Entry<String, String> entry : map.entrySet()) {
final String key = entry.getKey();
final String value = entry.getValue();
if (key.indexOf(separator) != -1) {
throw new IllegalArgumentException("Key '" + key + "' contains separator " + separator);
}
zzString.append(key);
zzString.append(separator);
zzString.append(value);
zzString.append(NUL);
}
}
return new ZSTR(zzString.toString());
}
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
public void setExpiryDate(String expiryDate) {
if (expiryDate == null) {
this.expiryDate.pointTo(Pointer.NULL);
} else {
this.expiryDate.pointTo(new ZSTR(expiryDate));
}
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
/**
* Opens the specified key.
*/
public HKEY wfmOpenKey(final HKEY hKey, final String subKey) throws XfsException {
HKEY hkResult = new HKEY();
final int errorCode = wfmOpenKey0(hKey, (subKey == null ? null : new ZSTR(subKey)), hkResult);
XfsException.throwFor(errorCode);
synchronized (openKeys) {
openKeys.add(hkResult);
}
return hkResult;
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
/**
* Makes this <code>Pointer</code> point to a {@link ZSTR} with the
* specified <code>String</code> value or points to <code>NULL</code> if no
* <code>String</code> is given.
*
* @param value
* a <code>String</code> or <code>null</code>
*/
@Override
public void set(String value) {
if (value == null) {
pointToNULL();
return;
}
pointTo(new ZSTR(value));
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
private void loadLibrary(final String fileName) {
final String method = "loadLibrary(String)";
if (LOG.isDebugEnabled()) {
LOG.debug(method, "fileName=" + fileName);
}
if (moduleHandle != null) {
throw new IllegalStateException();
}
try {
moduleHandle = new Pointer(loadLibrary0(new ZSTR(fileName)));
initFunctionAddress = new Pointer(getFunctionAddress("CT_init"));
dataFunctionAddress = new Pointer(getFunctionAddress("CT_data"));
closeFunctionAddress = new Pointer(getFunctionAddress("CT_close"));
} catch (final NativeException e) {
throw new RuntimeException("Error loading library: " + fileName, e);
}
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
private RequestId open(final XfsOpenCommand openCommand, final XfsEventNotification eventNotification)
throws XfsException {
final String method = "open(XFSOpenCommand, IXfsEventNotification)";
if (LOG.isDebugEnabled()) {
LOG.debug(method, "openCommand=" + openCommand + ",eventNotification=" + eventNotification);
}
final XfsService xfsService = openCommand.getXFSService();
final DWORD dwTraceLevel = null;
final DWORD timeOut = new DWORD(0L);
final RequestId requestId = xfsAPI.wfsAsyncOpen(new ZSTR(xfsService.getLogicalName()), hApp, null, dwTraceLevel,
timeOut, xfsService.getService(), hWnd, xfsService.getSrvcVersionsRequired(),
xfsService.getSrvcVersion(), xfsService.getSPIVersion());
requestQueue.addRequest(requestId, eventNotification, openCommand, Long.valueOf(timeOut.longValue()));
return requestId;
}
内容来源于网络,如有侵权,请联系作者删除!