public static class HTCSP_RSA_ST extends Structure{
public HTCSP_RSA_PUB_ST ht_RSA_pub_st;
public HTCSP_RSA_PRI_ST ht_RSA_pri_st;
public static class ByValue extends HTCSP_RSA_ST implements
Structure.ByValue {
} public static class ByReference extends HTCSP_RSA_ST implements
Structure.ByReference {
}
} public static class HTCSP_RSA_PUB_ST extends Structure {
public int dwbits;
public byte[] byModulus;
public byte[] bypublicExponent; public static class ByValue extends HTCSP_RSA_PUB_ST implements
Structure.ByValue {
} public static class ByReference extends HTCSP_RSA_PUB_ST implements
Structure.ByReference {
}
} public static class HTCSP_RSA_PRI_ST extends Structure {
public int dwbits;
public byte[] byModulus;
public byte[] bypublicExponent;
public byte[] byexponent;
public byte[][] byprime;
public byte[][] byprimeExponent;
public byte[] bycoefficient; public static class ByValue extends HTCSP_RSA_PRI_ST implements
Structure.ByValue {
} public static class ByReference extends HTCSP_RSA_PRI_ST implements
Structure.ByReference {
}
}
以上是结构体其中HTCSP_RSA_ST 中的属性为其他2个结构体
HTCSP_RSA_ST.ByReference phtcsp_rsa_st = new HTCSP_RSA_ST.ByReference();
在调用时报错java.lang.IllegalStateException: Array fields must be initialized
为什么new不出来?求助
public HTCSP_RSA_PUB_ST ht_RSA_pub_st;
public HTCSP_RSA_PRI_ST ht_RSA_pri_st;
public static class ByValue extends HTCSP_RSA_ST implements
Structure.ByValue {
} public static class ByReference extends HTCSP_RSA_ST implements
Structure.ByReference {
}
} public static class HTCSP_RSA_PUB_ST extends Structure {
public int dwbits;
public byte[] byModulus;
public byte[] bypublicExponent; public static class ByValue extends HTCSP_RSA_PUB_ST implements
Structure.ByValue {
} public static class ByReference extends HTCSP_RSA_PUB_ST implements
Structure.ByReference {
}
} public static class HTCSP_RSA_PRI_ST extends Structure {
public int dwbits;
public byte[] byModulus;
public byte[] bypublicExponent;
public byte[] byexponent;
public byte[][] byprime;
public byte[][] byprimeExponent;
public byte[] bycoefficient; public static class ByValue extends HTCSP_RSA_PRI_ST implements
Structure.ByValue {
} public static class ByReference extends HTCSP_RSA_PRI_ST implements
Structure.ByReference {
}
}
以上是结构体其中HTCSP_RSA_ST 中的属性为其他2个结构体
HTCSP_RSA_ST.ByReference phtcsp_rsa_st = new HTCSP_RSA_ST.ByReference();
在调用时报错java.lang.IllegalStateException: Array fields must be initialized
为什么new不出来?求助
解决方案 »
- javaFX中没有dialog类 它的功能被什么替代了?
- 非计算机专业想从事java所面对的困惑
- 关于appletviewer不能显示网页中的applet?
- 为什么在Eclipse写程序时找不到javax.microedition.midlet包呢?
- 关于文件的读和写-------如何在写入数据时换行?并把奇数行写入文件1,偶数行写入文件2
- 100分请教Locale类的基本使用方法!
- 是不是所有的操作系统平台上都支持unicode字符集?
- main 裡面 的(String a[]) 與 (String[] a) 有什麼區別
- 哪儿有bas4.5下载
- openoffice+jodconverter并发转换
- 想抓取网页上的Email地址,但是文件里面没写进任何内容
- 寻找知情人士,字面值整数常量类型问题
数组成员就是2个结构体已经初始化了现在是只要一new就报这个错
csppublic.dwbits = 256;
csppublic.byModulus = new byte[((2048 + 7) / 8)];
csppublic.bypublicExponent = new byte[((2048 + 7) / 8)]; HTCSP_RSA_PRI_ST cspprivate = new HTCSP_RSA_PRI_ST();
cspprivate.dwbits = 256;
cspprivate.byModulus = new byte[((2048 + 7) / 8)];
cspprivate.bypublicExponent = new byte[((2048 + 7) / 8)];
cspprivate.byexponent = new byte[((2048 + 7) / 8)];
cspprivate.byprime = new byte[2][((((2048 + 1) / 2) + 7) / 8)];
cspprivate.byprimeExponent = new byte[2][((((2048 + 1) / 2) + 7) / 8)];
cspprivate.bycoefficient = new byte[((((2048 + 1) / 2) + 7) / 8)]; HTCSP_RSA_ST phtcsp_rsa_st = new HTCSP_RSA_ST();
phtcsp_rsa_st.ht_RSA_pub_st = csppublic;
phtcsp_rsa_st.ht_RSA_pri_st = cspprivate;
代码
com.sun.jna.Structure
int calculateSize(boolean force)Calculate the amount of native memory required for this structure.
May return CALCULATE_SIZE if the size can not yet be determined (usually due to fields in the derived class not yet being initialized).
If the force parameter is true will throw an IllegalStateException if the size can not be determined. Throws: IllegalStateException - an array field is not initialized
HTCSP_RSA_ST phtcsp_rsa_st = new HTCSP_RSA_ST();这段报错
7L已经出文档说明了,也就是你的类的两个属性ht_RSA_pub_st和ht_RSA_pri_st的size都是未知的,你可以试试在构造函数里调用 super.calculateSize(false)试试看