@Test @Override public void toStringTest() { SockAddr addr4 = new SockAddr(SockAddr.Family.AF_INET.getValue(), Inet4Address.LOCALHOST.getAddress()); SockAddr addr6 = new SockAddr(SockAddr.Family.AF_INET6.getValue(), Inet6Address.LOCALHOST.getAddress()); assert addr4.toString().equals(Inet4Address.LOCALHOST.toString()); assert addr4.getSaFamily().toString() != ""; assert addr6.toString().equals(Inet6Address.LOCALHOST.toString()); assert addr6.getSaFamily().toString() != ""; }
@Override public String toString() { final Family family = this.getSaFamily(); if (family.equals(Family.AF_INET)) { return Inet4Address.valueOf(this.getData()).toString(); } else if (family.equals(Family.AF_INET6)) { return Inet6Address.valueOf(this.getData()).toString(); } else { return ""; } }
SockAddr implements Cloneable { @Override public String toString() { final Family family = this.getSaFamily(); if (family.equals(Family.AF_INET)) { return Inet4Address.valueOf(this.getData()).toString(); } else if (family.equals(Family.AF_INET6)) { return Inet6Address.valueOf(this.getData()).toString(); } else { return ""; } } }
SockAddr implements Cloneable { @Override public String toString() { final Family family = this.getSaFamily(); if (family.equals(Family.AF_INET)) { return Inet4Address.valueOf(this.getData()).toString(); } else if (family.equals(Family.AF_INET6)) { return Inet6Address.valueOf(this.getData()).toString(); } else { return ""; } } protected  SockAddr(); protected  SockAddr(short saFamily, byte[] data); }
SockAddr implements Cloneable { @Override public String toString() { final Family family = this.getSaFamily(); if (family.equals(Family.AF_INET)) { return Inet4Address.valueOf(this.getData()).toString(); } else if (family.equals(Family.AF_INET6)) { return Inet6Address.valueOf(this.getData()).toString(); } else { return ""; } } protected  SockAddr(); protected  SockAddr(short saFamily, byte[] data); static SockAddr newInstance(); Family getSaFamily(); byte[] getData(); @Override boolean equals(final Object o); @Override int hashCode(); @Override SockAddr clone(); @Override String toString(); }
SockAddr implements Cloneable { @Override public String toString() { final Family family = this.getSaFamily(); if (family.equals(Family.AF_INET)) { return Inet4Address.valueOf(this.getData()).toString(); } else if (family.equals(Family.AF_INET6)) { return Inet6Address.valueOf(this.getData()).toString(); } else { return ""; } } protected  SockAddr(); protected  SockAddr(short saFamily, byte[] data); static SockAddr newInstance(); Family getSaFamily(); byte[] getData(); @Override boolean equals(final Object o); @Override int hashCode(); @Override SockAddr clone(); @Override String toString();  }