aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/java/net
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/java/net')
-rw-r--r--libjava/classpath/java/net/Inet4Address.java4
-rw-r--r--libjava/classpath/java/net/Inet6Address.java4
-rw-r--r--libjava/classpath/java/net/NetworkInterface.java54
-rw-r--r--libjava/classpath/java/net/SocketPermission.java4
-rw-r--r--libjava/classpath/java/net/URI.java20
-rw-r--r--libjava/classpath/java/net/URLClassLoader.java6
-rw-r--r--libjava/classpath/java/net/URLDecoder.java4
-rw-r--r--libjava/classpath/java/net/URLEncoder.java4
-rw-r--r--libjava/classpath/java/net/URLStreamHandler.java4
9 files changed, 84 insertions, 20 deletions
diff --git a/libjava/classpath/java/net/Inet4Address.java b/libjava/classpath/java/net/Inet4Address.java
index a8a726e..1a50a47 100644
--- a/libjava/classpath/java/net/Inet4Address.java
+++ b/libjava/classpath/java/net/Inet4Address.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package java.net;
+import gnu.java.lang.CPStringBuilder;
+
import java.io.ObjectStreamException;
/*
@@ -212,7 +214,7 @@ public final class Inet4Address extends InetAddress
*/
public String getHostAddress()
{
- StringBuffer sb = new StringBuffer(40);
+ CPStringBuilder sb = new CPStringBuilder(40);
int len = addr.length;
int i = 0;
diff --git a/libjava/classpath/java/net/Inet6Address.java b/libjava/classpath/java/net/Inet6Address.java
index f4893eb..9a1c4ea 100644
--- a/libjava/classpath/java/net/Inet6Address.java
+++ b/libjava/classpath/java/net/Inet6Address.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package java.net;
+import gnu.java.lang.CPStringBuilder;
+
import java.util.Arrays;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@@ -317,7 +319,7 @@ public final class Inet6Address extends InetAddress
*/
public String getHostAddress()
{
- StringBuffer sbuf = new StringBuffer(40);
+ CPStringBuilder sbuf = new CPStringBuilder(40);
for (int i = 0; i < 16; i += 2)
{
diff --git a/libjava/classpath/java/net/NetworkInterface.java b/libjava/classpath/java/net/NetworkInterface.java
index a3a6058..5ec64ff 100644
--- a/libjava/classpath/java/net/NetworkInterface.java
+++ b/libjava/classpath/java/net/NetworkInterface.java
@@ -1,5 +1,5 @@
/* NetworkInterface.java --
- Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,6 +40,8 @@ package java.net;
import gnu.classpath.SystemProperties;
+import gnu.java.lang.CPStringBuilder;
+
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Vector;
@@ -247,10 +249,10 @@ public final class NetworkInterface
public String toString()
{
// FIXME: check if this is correct
- StringBuffer result;
+ CPStringBuilder result;
String separator = SystemProperties.getProperty("line.separator");
- result = new StringBuffer();
+ result = new CPStringBuilder();
result.append("name: ");
result.append(getDisplayName());
@@ -265,4 +267,50 @@ public final class NetworkInterface
return result.toString();
}
+
+ /**
+ * Determines whether this interface is ready to transfer data.
+ *
+ * @return whether the interface is up
+ */
+ public boolean isUp()
+ throws SocketException
+ {
+ return VMNetworkInterface.isUp(netif.name);
+ }
+
+ /**
+ * Determines whether this interface does point to point
+ * transmission.
+ *
+ * @return whether the interface does point to point transmission
+ */
+ public boolean isPointToPoint()
+ throws SocketException
+ {
+ return VMNetworkInterface.isPointToPoint(netif.name);
+ }
+
+ /**
+ * Determines whether this interface is the loopback interface.
+ *
+ * @return whether the interface is the loopback interface
+ */
+ public boolean isLoopback()
+ throws SocketException
+ {
+ return VMNetworkInterface.isLoopback(netif.name);
+ }
+
+ /**
+ * Determines whether this interface supports multicast transmission.
+ *
+ * @return whether the interface supports multicast transmission.
+ */
+ public boolean supportsMulticast()
+ throws SocketException
+ {
+ return VMNetworkInterface.supportsMulticast(netif.name);
+ }
+
}
diff --git a/libjava/classpath/java/net/SocketPermission.java b/libjava/classpath/java/net/SocketPermission.java
index 6488543..a5a848e 100644
--- a/libjava/classpath/java/net/SocketPermission.java
+++ b/libjava/classpath/java/net/SocketPermission.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package java.net;
+import gnu.java.lang.CPStringBuilder;
+
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@@ -431,7 +433,7 @@ public final class SocketPermission extends Permission implements Serializable
*/
public String getActions()
{
- StringBuffer sb = new StringBuffer("");
+ CPStringBuilder sb = new CPStringBuilder("");
for (int i = 0; i < ACTIONS.length; i++)
{
diff --git a/libjava/classpath/java/net/URI.java b/libjava/classpath/java/net/URI.java
index 85e0e04..933e4f4 100644
--- a/libjava/classpath/java/net/URI.java
+++ b/libjava/classpath/java/net/URI.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package java.net;
+import gnu.java.lang.CPStringBuilder;
+
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@@ -483,7 +485,7 @@ public final class URI
*/
private static String quote(String str, String legalCharacters)
{
- StringBuilder sb = new StringBuilder(str.length());
+ CPStringBuilder sb = new CPStringBuilder(str.length());
for (int i = 0; i < str.length(); i++)
{
char c = str.charAt(i);
@@ -778,8 +780,8 @@ public final class URI
This follows the algorithm in section 5.2.4. of RFC3986,
but doesn't modify the input buffer.
*/
- StringBuilder input = new StringBuilder(relativePath);
- StringBuilder output = new StringBuilder();
+ CPStringBuilder input = new CPStringBuilder(relativePath);
+ CPStringBuilder output = new CPStringBuilder();
int start = 0;
while (start < input.length())
{
@@ -853,7 +855,7 @@ public final class URI
*
* @param buffer the buffer containing the path.
*/
- private void removeLastSegment(StringBuilder buffer)
+ private void removeLastSegment(CPStringBuilder buffer)
{
int lastSlash = buffer.lastIndexOf("/");
if (lastSlash == -1)
@@ -899,7 +901,7 @@ public final class URI
path = "";
if (! (path.startsWith("/")))
{
- StringBuilder basepath = new StringBuilder(this.path);
+ CPStringBuilder basepath = new CPStringBuilder(this.path);
int i = this.path.lastIndexOf('/');
if (i >= 0)
@@ -1388,8 +1390,8 @@ public final class URI
{
String strRep = toString();
boolean inNonAsciiBlock = false;
- StringBuilder buffer = new StringBuilder();
- StringBuilder encBuffer = null;
+ CPStringBuilder buffer = new CPStringBuilder();
+ CPStringBuilder encBuffer = null;
for (int i = 0; i < strRep.length(); i++)
{
char c = strRep.charAt(i);
@@ -1406,7 +1408,7 @@ public final class URI
{
if (!inNonAsciiBlock)
{
- encBuffer = new StringBuilder();
+ encBuffer = new CPStringBuilder();
inNonAsciiBlock = true;
}
encBuffer.append(c);
@@ -1428,7 +1430,7 @@ public final class URI
{
try
{
- StringBuilder sb = new StringBuilder();
+ CPStringBuilder sb = new CPStringBuilder();
// this is far from optimal, but it works
byte[] utf8 = str.getBytes("utf-8");
for (int j = 0; j < utf8.length; j++)
diff --git a/libjava/classpath/java/net/URLClassLoader.java b/libjava/classpath/java/net/URLClassLoader.java
index e1db2a1..52d297a 100644
--- a/libjava/classpath/java/net/URLClassLoader.java
+++ b/libjava/classpath/java/net/URLClassLoader.java
@@ -39,6 +39,8 @@ exception statement from your version. */
package java.net;
+import gnu.java.lang.CPStringBuilder;
+
import gnu.java.net.loader.FileURLLoader;
import gnu.java.net.loader.JarURLLoader;
import gnu.java.net.loader.RemoteURLLoader;
@@ -452,7 +454,7 @@ public class URLClassLoader extends SecureClassLoader
{
// Compute the name of the package as it may appear in the
// Manifest.
- StringBuilder xform = new StringBuilder(name);
+ CPStringBuilder xform = new CPStringBuilder(name);
for (int i = xform.length () - 1; i >= 0; --i)
if (xform.charAt(i) == '.')
xform.setCharAt(i, '/');
@@ -641,7 +643,7 @@ public class URLClassLoader extends SecureClassLoader
{
if (thisString == null)
{
- StringBuilder sb = new StringBuilder();
+ CPStringBuilder sb = new CPStringBuilder();
sb.append(this.getClass().getName());
sb.append("{urls=[" );
URL[] thisURLs = getURLs();
diff --git a/libjava/classpath/java/net/URLDecoder.java b/libjava/classpath/java/net/URLDecoder.java
index ca40c38..fb7ab59 100644
--- a/libjava/classpath/java/net/URLDecoder.java
+++ b/libjava/classpath/java/net/URLDecoder.java
@@ -37,6 +37,8 @@ exception statement from your version. */
package java.net;
+import gnu.java.lang.CPStringBuilder;
+
import java.io.UnsupportedEncodingException;
@@ -127,7 +129,7 @@ public class URLDecoder
int start = 0;
byte[] bytes = null;
int length = str.length();
- StringBuffer result = new StringBuffer(length);
+ CPStringBuilder result = new CPStringBuilder(length);
while ((i = str.indexOf('%', start)) >= 0)
{
// Add all non-encoded characters to the result buffer
diff --git a/libjava/classpath/java/net/URLEncoder.java b/libjava/classpath/java/net/URLEncoder.java
index 2f11c50..89d9a0b 100644
--- a/libjava/classpath/java/net/URLEncoder.java
+++ b/libjava/classpath/java/net/URLEncoder.java
@@ -37,6 +37,8 @@ exception statement from your version. */
package java.net;
+import gnu.java.lang.CPStringBuilder;
+
import java.io.UnsupportedEncodingException;
@@ -113,7 +115,7 @@ public class URLEncoder
int start = 0;
int i = 0;
- StringBuilder result = new StringBuilder(length);
+ CPStringBuilder result = new CPStringBuilder(length);
while (true)
{
while (i < length && isSafe(s.charAt(i)))
diff --git a/libjava/classpath/java/net/URLStreamHandler.java b/libjava/classpath/java/net/URLStreamHandler.java
index 9a5d73ad..4748191 100644
--- a/libjava/classpath/java/net/URLStreamHandler.java
+++ b/libjava/classpath/java/net/URLStreamHandler.java
@@ -37,6 +37,8 @@ exception statement from your version. */
package java.net;
+import gnu.java.lang.CPStringBuilder;
+
import java.io.File;
import java.io.IOException;
@@ -510,7 +512,7 @@ public abstract class URLStreamHandler
// Guess a reasonable size for the string buffer so we have to resize
// at most once.
int size = protocol.length() + authority.length() + file.length() + 24;
- StringBuffer sb = new StringBuffer(size);
+ CPStringBuilder sb = new CPStringBuilder(size);
if (protocol.length() > 0)
{