}
@Override
protected IPv4Address doAccept(Token value, int flags) throws CommandSyntaxException {
if (value.text.equals("default")) {
return new IPv4Address(new byte[]{0, 0, 0, 0}, 0);
}
final StringTokenizer tok = new StringTokenizer(value.text, ".");
if (tok.countTokens() != 4) {
throw new CommandSyntaxException("wrong number of components for an IPv4 address");
}
try {
final byte b1 = parseUnsignedByte(tok.nextToken());
final byte b2 = parseUnsignedByte(tok.nextToken());
final byte b3 = parseUnsignedByte(tok.nextToken());
final byte b4 = parseUnsignedByte(tok.nextToken());
return new IPv4Address(new byte[]{b1, b2, b3, b4}, 0);
} catch (NumberFormatException ex) {
throw new CommandSyntaxException("invalid component in IPv4 address");
}
}