Added code to toString() InetAddresses in dotted quad notation.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@844 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: StringUtil.java,v 1.35 2002/04/16 18:19:18 mdb Exp $
|
||||
// $Id: StringUtil.java,v 1.36 2002/09/24 01:00:03 mdb Exp $
|
||||
//
|
||||
// samskivert library - useful routines for java programs
|
||||
// Copyright (C) 2001 Michael Bayne
|
||||
@@ -27,6 +27,8 @@ import java.awt.geom.Rectangle2D;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
import java.net.InetAddress;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
@@ -299,6 +301,17 @@ public class StringUtil
|
||||
coordsToString(buf, (int)r.getX(), (int)r.getY());
|
||||
buf.append(closeBox);
|
||||
|
||||
} else if (val instanceof InetAddress) {
|
||||
byte[] ip = ((InetAddress)val).getAddress();
|
||||
if (ip != null) {
|
||||
buf.append(ip[0]).append(".");
|
||||
buf.append(ip[1]).append(".");
|
||||
buf.append(ip[2]).append(".");
|
||||
buf.append(ip[3]).append(".");
|
||||
} else {
|
||||
buf.append("<no addr>");
|
||||
}
|
||||
|
||||
} else {
|
||||
buf.append(val);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user