int code = getopt.getopt();
while (code != -1) {
switch (code) {
case ':':
case '?':
throw new CommandLineParseException("Invalid option");
case 1:
break;
case 'f':
recordArgs.file = new File(getopt.getOptarg());
break;
case 'a':
recordArgs.append = true;
break;
case 'b':
if (recordArgs.recordState == null) {
recordArgs.recordState = RecordState.START;
}
break;
case 'e':
if (recordArgs.recordState == null) {
recordArgs.recordState = RecordState.STOP;
}
break;
}
code = getopt.getopt();
}
if (recordArgs.file == null) {
throw new CommandLineParseException("The file option must be specified.");
}
if (recordArgs.recordState == null) {
throw new CommandLineParseException("Either the start or stop option must be specified.");
}
return recordArgs;
}