demo1
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
StringBuilder sb = new StringBuilder();
while (true){
String input = scanner.nextLine();
if ("".equals(input))
break;
sb.append(input);
}
System.out.println(sb.toString());
}
demo2
public static void main(String[] args){
System.out.println("输入加解密类型:");
Scanner scanner = new Scanner(System.in);
int type = scanner.nextInt();
System.out.println("输入加密报文:");
scanner.nextLine();
StringBuilder xml = new StringBuilder();
while (true){
String input = scanner.nextLine();
if ("".equals(input))
break;
xml.append(input);
}
if (1 == type) {
System.out.println("加密后的报文:");
System.out.println(EncryptionUtil.encryption(xml.toString()));
} else {
System.out.println("解密后的报文:");
System.out.println(EncryptionUtil.decryption(xml.toString()));
}
}