-
-
Save anonymous/c34268fec37aa438536ff374e6217375 to your computer and use it in GitHub Desktop.
test needed?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public long executeAndparseOutput(String [] args) { | |
// TODO Auto-generated method stub | |
long duration = 0L; | |
try { | |
String output = this.processExecutor.command(args) | |
.readOutput(true).execute().outputUTF8(); | |
try( Scanner scanner = new Scanner(output) ){ | |
scanner.useDelimiter("\n"); | |
while(scanner.hasNext()){ | |
String data = scanner.nextLine(); | |
Pattern pattern = Pattern.compile("Duration: (?<duration>[^,]+)"); | |
Matcher matcher = pattern.matcher(data); | |
if ( matcher.find()){ | |
System.out.println(matcher.group("duration")); | |
duration = this.dateFormatter.parse("1970-01-01 " + matcher.group("duration")).getTime(); | |
break; | |
} | |
} | |
} catch (ParseException e) { | |
// TODO Auto-generated catch block | |
e.printStackTrace(); | |
} | |
} | |
catch(TimeoutException | InterruptedException | IOException ex){ | |
ex.printStackTrace(); | |
} | |
return duration; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment