Skip to content

Instantly share code, notes, and snippets.

@ejknapp
Created October 13, 2010 17:26
Show Gist options
  • Select an option

  • Save ejknapp/624484 to your computer and use it in GitHub Desktop.

Select an option

Save ejknapp/624484 to your computer and use it in GitHub Desktop.
SuperAbbrevs script to generate a new Analyzer class.
package java112.analyzer;
import java.util.*;
import java.io.*;
/**
* class $1
*
*@author <#=AUTHOR#>
*/
public class ${1:name} implements Analyzer {
private Properties properties;
/**
* Basic constructor for $1
*/
public $1(Properties properties) {
this.properties = properties;
}
/**
* Process each token in input file.
*
*@param token Description of the Parameter
*/
public void processToken(String token) {
$end
}
/**
* Write report file for $1
*
*@param inputFilePath Input file that was analyzed
*@param outputFilePath Path to output file
*/
public void writeOutput(String inputFilePath) {
PrintWriter writer = null;
String outputFilePath = properties.getProperty("directory.output")
+ properties.getProperty("file.name.$2");
try {
writer = new PrintWriter(new BufferedWriter(new FileWriter(outputFilePath)));
} catch (IOException ioe) {
System.out.println ("Error creating $1 output file.");
ioe.printStackTrace();
} catch (Exception exception) {
System.out.println("Something really bad happened.");
exception.printStackTrace();
} finally {
try {
if (writer != null) {
writer.close();
}
} catch (Exception closeException) {
System.out.println("Something really bad happened.");
closeException.printStackTrace();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment