commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwins...@apache.org
Subject svn commit: r761979 - /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java
Date Sat, 04 Apr 2009 18:21:42 GMT
Author: rwinston
Date: Sat Apr  4 18:21:42 2009
New Revision: 761979

URL: http://svn.apache.org/viewvc?rev=761979&view=rev
Log:
NET-263: Add toString() to SubnetUtils

Modified:
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java?rev=761979&r1=761978&r2=761979&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java
(original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java
Sat Apr  4 18:21:42 2009
@@ -100,6 +100,19 @@
             }
             return addresses;
         }
+        
+        @Override
+        public String toString() {
+        	final StringBuilder buf = new StringBuilder();
+        	buf.append("CIDR Signature:\t[").append(getCidrSignature()).append("]")
+        		.append(" Netmask: [").append(getNetmask()).append("]\n")
+        		.append("Network:\t[").append(getNetworkAddress()).append("]\n")
+        		.append("Broadcast:\t[").append(getBroadcastAddress()).append("]\n")
+        	 	.append("First Address:\t[").append(getLowAddress()).append("]\n")
+        	 	.append("Last Address:\t[").append(getHighAddress()).append("]\n")
+        	 	.append("# Addresses:\t[").append(getAddressCount()).append("]\n");        	 

+        	return buf.toString();
+        }
     }
 
     /**



Mime
View raw message