Collections.java (UnmodifiableMap.toArray): Imported changes from Classpath.
libjava/classpath * java/util/Collections.java (UnmodifiableMap.toArray): Imported changes from Classpath. libjava * sources.am, Makefile.in: Rebuilt. * java/lang/Socket.java: Removed override. * java/lang/DatagramSocket.java: Removed override. * gnu/java/net/PlainSocketImpl.java (localSocketAddress): New field. (getLocalAddress): New method. * gnu/java/net/PlainDatagramSocketImpl.java (PlainDatagramSocketImpl): Throws IOException. * gnu/java/net/natPlainSocketImplPosix.cc (write): Remove 'sizeof'. (read): Likewise. From-SVN: r121866
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/* PlainDatagramSocketImpl.java -- Default DatagramSocket implementation
|
||||
Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
@@ -119,7 +119,7 @@ public final class PlainDatagramSocketImpl extends DatagramSocketImpl
|
||||
/**
|
||||
* Default do nothing constructor
|
||||
*/
|
||||
public PlainDatagramSocketImpl()
|
||||
public PlainDatagramSocketImpl() throws IOException
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* PlainSocketImpl.java -- Default socket implementation
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
@@ -110,6 +110,9 @@ public final class PlainSocketImpl extends SocketImpl
|
||||
// localAddress cache
|
||||
InetAddress localAddress;
|
||||
|
||||
// Local address as an InetSocketAddress.
|
||||
InetSocketAddress localSocketAddress;
|
||||
|
||||
/**
|
||||
* A cached copy of the in stream for reading from the socket.
|
||||
*/
|
||||
@@ -325,6 +328,24 @@ public final class PlainSocketImpl extends SocketImpl
|
||||
|
||||
protected native void sendUrgentData(int data) throws IOException;
|
||||
|
||||
public synchronized InetSocketAddress getLocalAddress()
|
||||
{
|
||||
if (localSocketAddress == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
localSocketAddress
|
||||
= new InetSocketAddress ((InetAddress) getOption(SocketOptions.SO_BINDADDR),
|
||||
localport);
|
||||
}
|
||||
catch (SocketException _)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return localSocketAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an InputStream object for reading from this socket. This will
|
||||
* be an instance of SocketInputStream.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation
|
||||
/* Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
@@ -364,7 +364,7 @@ gnu::java::net::PlainSocketImpl$SocketOutputStream::write(jbyteArray b, jint off
|
||||
if (offset < 0 || len < 0 || offset + len > JvGetArrayLength (b))
|
||||
throw new ::java::lang::ArrayIndexOutOfBoundsException;
|
||||
|
||||
write_helper (this$0->native_fd, elements (b) + offset * sizeof (jbyte), len);
|
||||
write_helper (this$0->native_fd, elements (b) + offset, len);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -435,8 +435,7 @@ gnu::java::net::PlainSocketImpl$SocketInputStream::read(jbyteArray buffer,
|
||||
if (offset < 0 || count < 0 || offset + count > bsize)
|
||||
throw new ::java::lang::ArrayIndexOutOfBoundsException;
|
||||
|
||||
return read_helper (this$0,
|
||||
elements (buffer) + offset * sizeof (jbyte), count);
|
||||
return read_helper (this$0, elements (buffer) + offset, count);
|
||||
}
|
||||
|
||||
static jint
|
||||
|
||||
Reference in New Issue
Block a user