1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
| import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.ProcessBuilder.Redirect;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
*
* @author ASUS
*/
public class rrcdecoder {
String protocol;
String msghexa;
String line = "";
// public static void main(String[] args) throws IOException {
final List<String> commands = new ArrayList<String>();
public rrcdecoder (String p,String m)
{protocol=p;
msghexa=m;}
public String getcomment() throws IOException{
// msghexa="6c00502ac8434b908081008b4ab0";
//protocol="RrcDl-DCCH";
String messageId = null;
String sens;
if (protocol=="RrcDl-DCCH" )
sens="4";
else
sens="10";
commands.add("decoderplugincli.exe");
commands.add("--d");
commands.add("-s");
commands.add(msghexa);
commands.add("-f");
commands.add("textfullfield ");
commands.add("-k");
commands.add("0401f763 ");
commands.add("-o");
commands.add(sens);
Runtime runtime = Runtime.getRuntime();
final Process process = runtime.exec(new String[] { "C:\\gatodecoder-1.3.3\\exe",commands.toString()}) ;
// Consommation de la sortie standard de l'application externe dans un Thread separe
new Thread() {
public void run() {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
try {
while((line = reader.readLine()) != null) {
// Traitement du flux de sortie de l'application si besoin est
System.out.println(line);
}
} finally {
reader.close();
}
} catch(IOException ioe) {
ioe.printStackTrace();
}
}
}.start();
new Thread() {
public void run() {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
//String line = "";
try {
while((line = reader.readLine()) != null) {
// Traitement du flux d'erreur de l'application si besoin est
System.out.println(line);
}
} finally {
reader.close();
}
} catch(IOException ioe) {
ioe.printStackTrace();
}
}
}.start();
return line;
}} |
Partager