CDE
This commit is contained in:
parent
518da4a923
commit
764da6cbbb
6144 changed files with 83610 additions and 11 deletions
|
|
@ -0,0 +1,39 @@
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class MainEntry {
|
||||
public static void main(String[] args) {
|
||||
executeCmd("ls -oa");
|
||||
}
|
||||
|
||||
private static void executeCmd(String string) {
|
||||
InputStream pipedOut = null;
|
||||
try {
|
||||
Process aProcess = Runtime.getRuntime().exec(string);
|
||||
aProcess.waitFor();
|
||||
|
||||
pipedOut = aProcess.getInputStream();
|
||||
byte buffer[] = new byte[2048];
|
||||
int read = pipedOut.read(buffer);
|
||||
// Replace following code with your intends processing tools
|
||||
while(read >= 0) {
|
||||
System.out.write(buffer, 0, read);
|
||||
|
||||
read = pipedOut.read(buffer);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InterruptedException ie) {
|
||||
ie.printStackTrace();
|
||||
} finally {
|
||||
if(pipedOut != null) {
|
||||
try {
|
||||
pipedOut.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue