예제 #1
0
 protected void parse() throws IOException {
   commands.clear();
   InputStream resourceStream = execution.getScriptResource();
   BufferedReader scriptReader = new BufferedReader(new InputStreamReader(resourceStream));
   String line;
   StringBuilder commandBuffer = new StringBuilder();
   long lineNumber = 0;
   while ((line = scriptReader.readLine()) != null) {
     ++lineNumber;
     line = line.trim();
     if (line.isEmpty()) {
       continue;
     }
     if (line.equals("/")) { // End of command
       commands.add(new Command(commandBuffer.toString(), lineNumber, this));
       commandBuffer.delete(0, commandBuffer.length());
     } else {
       if (commandBuffer.length() > 0) {
         commandBuffer.append("\n");
       }
       commandBuffer.append(line);
     }
   }
   if (commandBuffer.length() > 0) {
     commands.add(new Command(commandBuffer.toString(), lineNumber, this));
   }
   scriptReader.close();
 }
예제 #2
0
 public String getFullPath() {
   return execution.getFullPath();
 }