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 @@
|
||||
/* 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.
|
||||
|
||||
Reference in New Issue
Block a user