ExecPty implements Pty { static Attributes doGetAttr(String cfg) throws IOException { Attributes attributes = new Attributes(); for (Attributes.InputFlag flag : Attributes.InputFlag.values()) { Boolean value = doGetFlag(cfg, flag); if (value != null) { attributes.setInputFlag(flag, value); } } for (Attributes.OutputFlag flag : Attributes.OutputFlag.values()) { Boolean value = doGetFlag(cfg, flag); if (value != null) { attributes.setOutputFlag(flag, value); } } for (Attributes.ControlFlag flag : Attributes.ControlFlag.values()) { Boolean value = doGetFlag(cfg, flag); if (value != null) { attributes.setControlFlag(flag, value); } } for (Attributes.LocalFlag flag : Attributes.LocalFlag.values()) { Boolean value = doGetFlag(cfg, flag); if (value != null) { attributes.setLocalFlag(flag, value); } } for (Attributes.ControlChar cchar : Attributes.ControlChar.values()) { String name = cchar.name().toLowerCase().substring(1); if ("reprint".endsWith(name)) { name = "(?:reprint|rprnt)"; } Matcher matcher = Pattern.compile("[\\s;]" + name + "\\s*=\\s*(.+?)[\\s;]").matcher(cfg); if (matcher.find()) { attributes.setControlChar(cchar, parseControlChar(matcher.group(1).toUpperCase())); } } return attributes; } protected  ExecPty(String name); static Pty current(); @Override void close(); String getName(); @Override InputStream getMasterInput(); @Override OutputStream getMasterOutput(); @Override InputStream getSlaveInput(); @Override OutputStream getSlaveOutput(); @Override Attributes getAttr(); @Override void setAttr(Attributes attr); @Override Size getSize();  }
@Test public void testParseAttributesLinux() throws IOException { Attributes attributes = ExecPty.doGetAttr(linuxSttySample); checkAttributestLinux(attributes); }
@Test public void testParseAttributesUbuntu() throws IOException { if(Config.isOSPOSIXCompatible()) { Attributes attributes = ExecPty.doGetAttr(ubuntuSttySample); checkAttributestUbuntu(attributes); } }