static String getOutputName(String resource)
    {
        String filename = FilenameUtil.getFileName(resource);
        int secondToTheLastDot = filename.lastIndexOf('.', filename.length() - 5);
        return filename.substring(0, secondToTheLastDot);
    }
Returns "foo" from "path/to/foo.java.stg"
protostuff-compiler/src/main/java/io/protostuff/compiler/PluginProtoCompiler.java