Profile: Add helper to check name validity

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Samuel Holland 2017-08-08 05:54:35 -05:00
parent c59b3e1230
commit 99973a4b08

View File

@ -20,6 +20,11 @@ import java.nio.charset.StandardCharsets;
*/
public class Profile extends BaseObservable implements Copyable<Profile>, Observable {
public static boolean isNameValid(String name) {
final int IFNAMSIZ = 16;
return !name.contains(" ") && name.getBytes(StandardCharsets.UTF_8).length <= IFNAMSIZ;
}
private final Interface iface = new Interface();
private boolean isConnected;
private String name;