背景: 我继承了一个嵌入式的基于Linux的系统,它包含一个SMTP代理和一些我不得不忍受的古怪约束.它位于SMTP客户端和服务器之间.当SMTP客户端连接时,代理会打开与服务器的连接,并在进行一些即时处理后将客户端的数据传递给服务器.
挑战:我需要在使用标准PKI技术和S/MIME格式(例如,参见RFC2311)的途中签署和/或加密电子邮件.我可以从相应的证书中访问所有必需的公钥.
古怪的约束(请接受它们,因为它们远远超出我的控制范围):
问题:
谢谢你的想法.
使用此代码,我尝试将包含数据的文件加载到对象数组中.我没有正确地对象中的字段,因为当我运行此代码时,我得到一个NullPointerException.数组在那里,甚至是正确的大小,但字段没有初始化.我该怎么解决这个问题?
这是代码:
public class aJob {
public int job;
{
job = 0;
}
public int dead;
{
dead = 0;
}
public int profit;
{
profit = 0;
}
}
public class Main {
public static void main(String[]args) throws IOException {
File local = readLines();
Scanner getlength = new Scanner(local);
int lines = 0;
while (getlength.hasNextLine()) {
String junk = getlength.nextLine();
lines++;
}
getlength.close();
Scanner jobfile = new Scanner(local); // check if empty
aJob list[] = new aJob[lines];
aJob …Run Code Online (Sandbox Code Playgroud) 我想从4个方向中随机选择:
movePlayer(map, &positionPlayer, direction);
Run Code Online (Sandbox Code Playgroud)
其中方向是之一UP,DOWN,LEFT,和RIGHT.
我还没有找到如何使用该rand()功能执行此操作.
我怎样才能做到这一点?我是否需要为每个方向分配一个数字,然后在这些范围内选择一个随机数?
谢谢您的帮助.
我有这个奇怪的错误,我无法解决.谁能帮我?谢谢.
ArrayList<Choices> newSecurityChoicesList =
securityChoicesController.getChoicesList();
System.out.println("first-" + newSecurityChoicesList.size());
securityQuestion.getChoices().clear();
System.out.println("second-" + newSecurityChoicesList.size());
Run Code Online (Sandbox Code Playgroud)
一些解释:
我创造了这个newSecurityChoicesList ArrayList.它是方法中的局部变量.打印出的第一个系统给出了2的结果.
为什么第二次打印出来的结果为0?
当然这是因为这个securityQuestion.getChoices().clear();方法.但是为什么方法可以改变方法中的局部变量?此方法仅在应用程序的最后调用一次.
提前致谢.