public void repackageJavaFile ( String name )
throws IOException
{
StringBuffer sb = readFile( new File( _sourceBase, name ) );
Match packageMatcher = new Match();
if (_packagePattern.matches(sb.toString(), packageMatcher))
{
String pkg = packageMatcher.getCapturedText( 1 );
int pkgStart = packageMatcher.getBeginning( 1 );
int pkgEnd = packageMatcher.getEnd( 1 );
//group 0 is the whole package statement, 1 is package name
if (packageMatcher.getNumberOfGroups() > 2)
throw new RuntimeException( "More than one package specifications found: "
+ name + ", numGroups=" + packageMatcher.getNumberOfGroups() );
List filePath = Arrays.asList(StringUtils.split( name, File.separatorChar ));
String srcDir = Repackager.dirForPath( name );
// Sort the repackage spec so that longer from's are first to match