Merged gcj-eclipse branch to trunk.
From-SVN: r120621
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_Authenticator__
|
||||
#define __java_net_Authenticator__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class Authenticator;
|
||||
class InetAddress;
|
||||
class PasswordAuthentication;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::Authenticator : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
static void setDefault(::java::net::Authenticator *);
|
||||
static ::java::net::PasswordAuthentication * requestPasswordAuthentication(::java::net::InetAddress *, jint, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
|
||||
static ::java::net::PasswordAuthentication * requestPasswordAuthentication(::java::lang::String *, ::java::net::InetAddress *, jint, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
|
||||
Authenticator();
|
||||
public: // actually protected
|
||||
virtual ::java::net::InetAddress * getRequestingSite();
|
||||
virtual ::java::lang::String * getRequestingHost();
|
||||
virtual jint getRequestingPort();
|
||||
virtual ::java::lang::String * getRequestingProtocol();
|
||||
virtual ::java::lang::String * getRequestingPrompt();
|
||||
virtual ::java::lang::String * getRequestingScheme();
|
||||
virtual ::java::net::PasswordAuthentication * getPasswordAuthentication();
|
||||
private:
|
||||
static ::java::net::Authenticator * defaultAuthenticator;
|
||||
::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) host;
|
||||
::java::net::InetAddress * addr;
|
||||
jint port;
|
||||
::java::lang::String * protocol;
|
||||
::java::lang::String * prompt;
|
||||
::java::lang::String * scheme;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_Authenticator__
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_BindException__
|
||||
#define __java_net_BindException__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/SocketException.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class BindException;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::BindException : public ::java::net::SocketException
|
||||
{
|
||||
|
||||
public:
|
||||
BindException();
|
||||
BindException(::java::lang::String *);
|
||||
private:
|
||||
static const jlong serialVersionUID = -5945005768251722951LL;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_BindException__
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_ConnectException__
|
||||
#define __java_net_ConnectException__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/SocketException.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class ConnectException;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::ConnectException : public ::java::net::SocketException
|
||||
{
|
||||
|
||||
public:
|
||||
ConnectException();
|
||||
ConnectException(::java::lang::String *);
|
||||
private:
|
||||
static const jlong serialVersionUID = 3831404271622369215LL;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_ConnectException__
|
||||
@@ -0,0 +1,34 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_ContentHandler__
|
||||
#define __java_net_ContentHandler__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class ContentHandler;
|
||||
class URLConnection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::ContentHandler : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
ContentHandler();
|
||||
virtual ::java::lang::Object * getContent(::java::net::URLConnection *) = 0;
|
||||
virtual ::java::lang::Object * getContent(::java::net::URLConnection *, JArray< ::java::lang::Class * > *);
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_ContentHandler__
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_ContentHandlerFactory__
|
||||
#define __java_net_ContentHandlerFactory__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class ContentHandler;
|
||||
class ContentHandlerFactory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::ContentHandlerFactory : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
virtual ::java::net::ContentHandler * createContentHandler(::java::lang::String *) = 0;
|
||||
static ::java::lang::Class class$;
|
||||
} __attribute__ ((java_interface));
|
||||
|
||||
#endif // __java_net_ContentHandlerFactory__
|
||||
@@ -0,0 +1,60 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_DatagramPacket__
|
||||
#define __java_net_DatagramPacket__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class DatagramPacket;
|
||||
class InetAddress;
|
||||
class SocketAddress;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::DatagramPacket : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
DatagramPacket(JArray< jbyte > *, jint, jint);
|
||||
DatagramPacket(JArray< jbyte > *, jint);
|
||||
DatagramPacket(JArray< jbyte > *, jint, jint, ::java::net::InetAddress *, jint);
|
||||
DatagramPacket(JArray< jbyte > *, jint, ::java::net::InetAddress *, jint);
|
||||
DatagramPacket(JArray< jbyte > *, jint, jint, ::java::net::SocketAddress *);
|
||||
DatagramPacket(JArray< jbyte > *, jint, ::java::net::SocketAddress *);
|
||||
::java::net::InetAddress * getAddress();
|
||||
jint getPort();
|
||||
JArray< jbyte > * getData();
|
||||
jint getOffset();
|
||||
jint getLength();
|
||||
void setAddress(::java::net::InetAddress *);
|
||||
void setPort(jint);
|
||||
void setSocketAddress(::java::net::SocketAddress *);
|
||||
::java::net::SocketAddress * getSocketAddress();
|
||||
void setData(JArray< jbyte > *);
|
||||
void setData(JArray< jbyte > *, jint, jint);
|
||||
void setLength(jint);
|
||||
private:
|
||||
JArray< jbyte > * __attribute__((aligned(__alignof__( ::java::lang::Object)))) buffer;
|
||||
jint offset;
|
||||
public: // actually package-private
|
||||
jint length;
|
||||
jint maxlen;
|
||||
private:
|
||||
::java::net::InetAddress * address;
|
||||
jint port;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_DatagramPacket__
|
||||
@@ -0,0 +1,87 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_DatagramSocket__
|
||||
#define __java_net_DatagramSocket__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class DatagramPacket;
|
||||
class DatagramSocket;
|
||||
class DatagramSocketImpl;
|
||||
class DatagramSocketImplFactory;
|
||||
class InetAddress;
|
||||
class SocketAddress;
|
||||
}
|
||||
namespace nio
|
||||
{
|
||||
namespace channels
|
||||
{
|
||||
class DatagramChannel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::DatagramSocket : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public: // actually protected
|
||||
DatagramSocket(::java::net::DatagramSocketImpl *);
|
||||
public:
|
||||
DatagramSocket();
|
||||
DatagramSocket(jint);
|
||||
DatagramSocket(jint, ::java::net::InetAddress *);
|
||||
DatagramSocket(::java::net::SocketAddress *);
|
||||
public: // actually package-private
|
||||
virtual ::java::net::DatagramSocketImpl * getImpl();
|
||||
public:
|
||||
virtual void close();
|
||||
virtual ::java::net::InetAddress * getInetAddress();
|
||||
virtual jint getPort();
|
||||
virtual ::java::net::InetAddress * getLocalAddress();
|
||||
virtual jint getLocalPort();
|
||||
virtual jint getSoTimeout();
|
||||
virtual void setSoTimeout(jint);
|
||||
virtual jint getSendBufferSize();
|
||||
virtual void setSendBufferSize(jint);
|
||||
virtual jint getReceiveBufferSize();
|
||||
virtual void setReceiveBufferSize(jint);
|
||||
virtual void connect(::java::net::InetAddress *, jint);
|
||||
virtual void disconnect();
|
||||
virtual void receive(::java::net::DatagramPacket *);
|
||||
virtual void send(::java::net::DatagramPacket *);
|
||||
virtual void bind(::java::net::SocketAddress *);
|
||||
virtual jboolean isClosed();
|
||||
virtual ::java::nio::channels::DatagramChannel * getChannel();
|
||||
virtual void connect(::java::net::SocketAddress *);
|
||||
virtual jboolean isBound();
|
||||
virtual jboolean isConnected();
|
||||
virtual ::java::net::SocketAddress * getRemoteSocketAddress();
|
||||
virtual ::java::net::SocketAddress * getLocalSocketAddress();
|
||||
virtual void setReuseAddress(jboolean);
|
||||
virtual jboolean getReuseAddress();
|
||||
virtual void setBroadcast(jboolean);
|
||||
virtual jboolean getBroadcast();
|
||||
virtual void setTrafficClass(jint);
|
||||
virtual jint getTrafficClass();
|
||||
static void setDatagramSocketImplFactory(::java::net::DatagramSocketImplFactory *);
|
||||
private:
|
||||
static ::java::net::DatagramSocketImplFactory * factory;
|
||||
::java::net::DatagramSocketImpl * __attribute__((aligned(__alignof__( ::java::lang::Object)))) impl;
|
||||
jboolean implCreated;
|
||||
::java::net::InetAddress * remoteAddress;
|
||||
jint remotePort;
|
||||
jboolean bound;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_DatagramSocket__
|
||||
@@ -0,0 +1,939 @@
|
||||
/* DatagramSocket.java -- A class to model UDP sockets
|
||||
Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
package java.net;
|
||||
|
||||
import gnu.classpath.SystemProperties;
|
||||
|
||||
import gnu.java.net.PlainDatagramSocketImpl;
|
||||
import gnu.java.nio.DatagramChannelImpl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.channels.DatagramChannel;
|
||||
import java.nio.channels.IllegalBlockingModeException;
|
||||
|
||||
|
||||
/**
|
||||
* Written using on-line Java Platform 1.2 API Specification, as well
|
||||
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
|
||||
* Status: Believed complete and correct.
|
||||
*/
|
||||
/**
|
||||
* This class models a connectionless datagram socket that sends
|
||||
* individual packets of data across the network. In the TCP/IP world,
|
||||
* this means UDP. Datagram packets do not have guaranteed delivery,
|
||||
* or any guarantee about the order the data will be received on the
|
||||
* remote host.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @author Warren Levy (warrenl@cygnus.com)
|
||||
* @date May 3, 1999.
|
||||
*/
|
||||
public class DatagramSocket
|
||||
{
|
||||
/**
|
||||
* This is the user DatagramSocketImplFactory for this class. If this
|
||||
* variable is null, a default factory is used.
|
||||
*/
|
||||
private static DatagramSocketImplFactory factory;
|
||||
|
||||
/**
|
||||
* This is the implementation object used by this socket.
|
||||
*/
|
||||
private DatagramSocketImpl impl;
|
||||
|
||||
/**
|
||||
* True if socket implementation was created.
|
||||
*/
|
||||
private boolean implCreated;
|
||||
|
||||
/**
|
||||
* This is the address we are "connected" to
|
||||
*/
|
||||
private InetAddress remoteAddress;
|
||||
|
||||
/**
|
||||
* This is the port we are "connected" to
|
||||
*/
|
||||
private int remotePort = -1;
|
||||
|
||||
/**
|
||||
* True if socket is bound.
|
||||
*/
|
||||
private boolean bound;
|
||||
|
||||
/**
|
||||
* Creates a <code>DatagramSocket</code> from a specified
|
||||
* <code>DatagramSocketImpl</code> instance
|
||||
*
|
||||
* @param impl The <code>DatagramSocketImpl</code> the socket will be
|
||||
* created from
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
protected DatagramSocket(DatagramSocketImpl impl)
|
||||
{
|
||||
if (impl == null)
|
||||
throw new NullPointerException("impl may not be null");
|
||||
|
||||
this.impl = impl;
|
||||
this.remoteAddress = null;
|
||||
this.remotePort = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>DatagramSocket</code> that binds to
|
||||
* a random port and every address on the local machine.
|
||||
*
|
||||
* @exception SocketException If an error occurs.
|
||||
* @exception SecurityException If a security manager exists and
|
||||
* its <code>checkListen</code> method doesn't allow the operation.
|
||||
*/
|
||||
public DatagramSocket() throws SocketException
|
||||
{
|
||||
this(new InetSocketAddress(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>DatagramSocket</code> that binds to
|
||||
* the specified port and every address on the local machine.
|
||||
*
|
||||
* @param port The local port number to bind to.
|
||||
*
|
||||
* @exception SecurityException If a security manager exists and its
|
||||
* <code>checkListen</code> method doesn't allow the operation.
|
||||
* @exception SocketException If an error occurs.
|
||||
*/
|
||||
public DatagramSocket(int port) throws SocketException
|
||||
{
|
||||
this(new InetSocketAddress(port));
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>DatagramSocket</code> that binds to
|
||||
* the specified local port and address.
|
||||
*
|
||||
* @param port The local port number to bind to.
|
||||
* @param addr The local address to bind to.
|
||||
*
|
||||
* @exception SecurityException If a security manager exists and its
|
||||
* checkListen method doesn't allow the operation.
|
||||
* @exception SocketException If an error occurs.
|
||||
*/
|
||||
public DatagramSocket(int port, InetAddress addr) throws SocketException
|
||||
{
|
||||
this(new InetSocketAddress(addr, port));
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>DatagramSocket</code> that binds to
|
||||
* the specified local port and address.
|
||||
*
|
||||
* @param address The local address and port number to bind to.
|
||||
*
|
||||
* @exception SecurityException If a security manager exists and its
|
||||
* <code>checkListen</code> method doesn't allow the operation.
|
||||
* @exception SocketException If an error occurs.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public DatagramSocket(SocketAddress address) throws SocketException
|
||||
{
|
||||
String propVal = SystemProperties.getProperty("impl.prefix");
|
||||
if (propVal == null || propVal.equals(""))
|
||||
{
|
||||
if (factory != null)
|
||||
impl = factory.createDatagramSocketImpl();
|
||||
else
|
||||
impl = new PlainDatagramSocketImpl();
|
||||
}
|
||||
else
|
||||
try
|
||||
{
|
||||
impl =
|
||||
(DatagramSocketImpl) Class.forName("java.net." + propVal
|
||||
+ "DatagramSocketImpl")
|
||||
.newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.err.println("Could not instantiate class: java.net."
|
||||
+ propVal + "DatagramSocketImpl");
|
||||
impl = new PlainDatagramSocketImpl();
|
||||
}
|
||||
|
||||
if (address != null)
|
||||
bind(address);
|
||||
}
|
||||
|
||||
// This needs to be accessible from java.net.MulticastSocket
|
||||
DatagramSocketImpl getImpl() throws SocketException
|
||||
{
|
||||
try
|
||||
{
|
||||
if (! implCreated)
|
||||
{
|
||||
impl.create();
|
||||
implCreated = true;
|
||||
}
|
||||
|
||||
return impl;
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
SocketException se = new SocketException();
|
||||
se.initCause(e);
|
||||
throw se;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes this datagram socket.
|
||||
*/
|
||||
public void close()
|
||||
{
|
||||
if (isClosed())
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
getImpl().close();
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
// Ignore this case, just close the socket in finally clause.
|
||||
}
|
||||
finally
|
||||
{
|
||||
remoteAddress = null;
|
||||
remotePort = -1;
|
||||
impl = null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (getChannel() != null)
|
||||
getChannel().close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the remote address to which this socket is
|
||||
* connected. If this socket is not connected, then this method will
|
||||
* return <code>null</code>.
|
||||
*
|
||||
* @return The remote address.
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public InetAddress getInetAddress()
|
||||
{
|
||||
return remoteAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the remote port to which this socket is
|
||||
* connected. If this socket is not connected, then this method will
|
||||
* return -1.
|
||||
*
|
||||
* @return The remote port.
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public int getPort()
|
||||
{
|
||||
return remotePort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the local address this datagram socket is bound to.
|
||||
*
|
||||
* @return The local address is the socket is bound or null
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
public InetAddress getLocalAddress()
|
||||
{
|
||||
if (! isBound())
|
||||
return null;
|
||||
|
||||
InetAddress localAddr;
|
||||
|
||||
try
|
||||
{
|
||||
localAddr =
|
||||
(InetAddress) getImpl().getOption(SocketOptions.SO_BINDADDR);
|
||||
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
if (s != null)
|
||||
s.checkConnect(localAddr.getHostName(), -1);
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
localAddr = InetAddress.ANY_IF;
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
// This cannot happen as we are bound.
|
||||
return null;
|
||||
}
|
||||
|
||||
return localAddr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the local port this socket is bound to.
|
||||
*
|
||||
* @return The local port number.
|
||||
*/
|
||||
public int getLocalPort()
|
||||
{
|
||||
if (isClosed())
|
||||
return -1;
|
||||
|
||||
try
|
||||
{
|
||||
return getImpl().getLocalPort();
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
// This cannot happen as we are bound.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of the socket's SO_TIMEOUT setting. If this method
|
||||
* returns 0 then SO_TIMEOUT is disabled.
|
||||
*
|
||||
* @return The current timeout in milliseconds.
|
||||
*
|
||||
* @exception SocketException If an error occurs.
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
public synchronized int getSoTimeout() throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
Object buf = getImpl().getOption(SocketOptions.SO_TIMEOUT);
|
||||
|
||||
if (buf instanceof Integer)
|
||||
return ((Integer) buf).intValue();
|
||||
|
||||
throw new SocketException("unexpected type");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the socket's SO_TIMEOUT value. A value of 0 will
|
||||
* disable SO_TIMEOUT. Any other value is the number of milliseconds
|
||||
* a socket read/write will block before timing out.
|
||||
*
|
||||
* @param timeout The new SO_TIMEOUT value in milliseconds.
|
||||
*
|
||||
* @exception SocketException If an error occurs.
|
||||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
public synchronized void setSoTimeout(int timeout) throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
if (timeout < 0)
|
||||
throw new IllegalArgumentException("Invalid timeout: " + timeout);
|
||||
|
||||
getImpl().setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the value of the system level socket option
|
||||
* SO_SNDBUF, which is used by the operating system to tune buffer
|
||||
* sizes for data transfers.
|
||||
*
|
||||
* @return The send buffer size.
|
||||
*
|
||||
* @exception SocketException If an error occurs.
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public int getSendBufferSize() throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
Object buf = getImpl().getOption(SocketOptions.SO_SNDBUF);
|
||||
|
||||
if (buf instanceof Integer)
|
||||
return ((Integer) buf).intValue();
|
||||
|
||||
throw new SocketException("unexpected type");
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sets the value for the system level socket option
|
||||
* SO_SNDBUF to the specified value. Note that valid values for this
|
||||
* option are specific to a given operating system.
|
||||
*
|
||||
* @param size The new send buffer size.
|
||||
*
|
||||
* @exception SocketException If an error occurs.
|
||||
* @exception IllegalArgumentException If size is 0 or negative.
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public void setSendBufferSize(int size) throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
if (size < 0)
|
||||
throw new IllegalArgumentException("Buffer size is less than 0");
|
||||
|
||||
getImpl().setOption(SocketOptions.SO_SNDBUF, new Integer(size));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the value of the system level socket option
|
||||
* SO_RCVBUF, which is used by the operating system to tune buffer
|
||||
* sizes for data transfers.
|
||||
*
|
||||
* @return The receive buffer size.
|
||||
*
|
||||
* @exception SocketException If an error occurs.
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public int getReceiveBufferSize() throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
Object buf = getImpl().getOption(SocketOptions.SO_RCVBUF);
|
||||
|
||||
if (buf instanceof Integer)
|
||||
return ((Integer) buf).intValue();
|
||||
|
||||
throw new SocketException("unexpected type");
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sets the value for the system level socket option
|
||||
* SO_RCVBUF to the specified value. Note that valid values for this
|
||||
* option are specific to a given operating system.
|
||||
*
|
||||
* @param size The new receive buffer size.
|
||||
*
|
||||
* @exception SocketException If an error occurs.
|
||||
* @exception IllegalArgumentException If size is 0 or negative.
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public void setReceiveBufferSize(int size) throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
if (size < 0)
|
||||
throw new IllegalArgumentException("Buffer size is less than 0");
|
||||
|
||||
getImpl().setOption(SocketOptions.SO_RCVBUF, new Integer(size));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method connects this socket to the specified address and port.
|
||||
* When a datagram socket is connected, it will only send or receive
|
||||
* packets to and from the host to which it is connected. A multicast
|
||||
* socket that is connected may only send and not receive packets.
|
||||
*
|
||||
* @param address The address to connect this socket to.
|
||||
* @param port The port to connect this socket to.
|
||||
*
|
||||
* @exception IllegalArgumentException If address or port are invalid.
|
||||
* @exception SecurityException If the caller is not allowed to send
|
||||
* datagrams to or receive from this address and port.
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public void connect(InetAddress address, int port)
|
||||
{
|
||||
if (address == null)
|
||||
throw new IllegalArgumentException("Connect address may not be null");
|
||||
|
||||
if ((port < 1) || (port > 65535))
|
||||
throw new IllegalArgumentException("Port number is illegal: " + port);
|
||||
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkConnect(address.getHostName(), port);
|
||||
|
||||
try
|
||||
{
|
||||
getImpl().connect(address, port);
|
||||
remoteAddress = address;
|
||||
remotePort = port;
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
// This means simply not connected or connect not implemented.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method disconnects this socket from the address/port it was
|
||||
* connected to. If the socket was not connected in the first place,
|
||||
* this method does nothing.
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public void disconnect()
|
||||
{
|
||||
if (! isConnected())
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
getImpl().disconnect();
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
// This cannot happen as we are connected.
|
||||
}
|
||||
finally
|
||||
{
|
||||
remoteAddress = null;
|
||||
remotePort = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a datagram packet from the socket. Note that this method
|
||||
* will block until a packet is received from the network. On return,
|
||||
* the passed in <code>DatagramPacket</code> is populated with the data
|
||||
* received and all the other information about the packet.
|
||||
*
|
||||
* @param p A <code>DatagramPacket</code> for storing the data
|
||||
*
|
||||
* @exception IOException If an error occurs.
|
||||
* @exception SocketTimeoutException If setSoTimeout was previously called
|
||||
* and the timeout has expired.
|
||||
* @exception PortUnreachableException If the socket is connected to a
|
||||
* currently unreachable destination. Note, there is no guarantee that the
|
||||
* exception will be thrown.
|
||||
* @exception IllegalBlockingModeException If this socket has an associated
|
||||
* channel, and the channel is in non-blocking mode.
|
||||
* @exception SecurityException If a security manager exists and its
|
||||
* checkAccept method doesn't allow the receive.
|
||||
*/
|
||||
public synchronized void receive(DatagramPacket p) throws IOException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
if (remoteAddress != null && remoteAddress.isMulticastAddress())
|
||||
throw new IOException
|
||||
("Socket connected to a multicast address my not receive");
|
||||
|
||||
if (getChannel() != null && ! getChannel().isBlocking()
|
||||
&& ! ((DatagramChannelImpl) getChannel()).isInChannelOperation())
|
||||
throw new IllegalBlockingModeException();
|
||||
|
||||
getImpl().receive(p);
|
||||
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
if (s != null && isConnected())
|
||||
s.checkAccept(p.getAddress().getHostName(), p.getPort());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the specified packet. The host and port to which the packet
|
||||
* are to be sent should be set inside the packet.
|
||||
*
|
||||
* @param p The datagram packet to send.
|
||||
*
|
||||
* @exception IOException If an error occurs.
|
||||
* @exception SecurityException If a security manager exists and its
|
||||
* checkMulticast or checkConnect method doesn't allow the send.
|
||||
* @exception PortUnreachableException If the socket is connected to a
|
||||
* currently unreachable destination. Note, there is no guarantee that the
|
||||
* exception will be thrown.
|
||||
* @exception IllegalBlockingModeException If this socket has an associated
|
||||
* channel, and the channel is in non-blocking mode.
|
||||
*/
|
||||
public void send(DatagramPacket p) throws IOException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
// JDK1.2: Don't do security checks if socket is connected; see jdk1.2 api.
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
if (s != null && ! isConnected())
|
||||
{
|
||||
InetAddress addr = p.getAddress();
|
||||
if (addr.isMulticastAddress())
|
||||
s.checkMulticast(addr);
|
||||
else
|
||||
s.checkConnect(addr.getHostAddress(), p.getPort());
|
||||
}
|
||||
|
||||
if (isConnected())
|
||||
{
|
||||
if (p.getAddress() != null
|
||||
&& (remoteAddress != p.getAddress() || remotePort != p.getPort()))
|
||||
throw new IllegalArgumentException
|
||||
("DatagramPacket address does not match remote address");
|
||||
}
|
||||
|
||||
// FIXME: if this is a subclass of MulticastSocket,
|
||||
// use getTimeToLive for TTL val.
|
||||
if (getChannel() != null && ! getChannel().isBlocking()
|
||||
&& ! ((DatagramChannelImpl) getChannel()).isInChannelOperation())
|
||||
throw new IllegalBlockingModeException();
|
||||
|
||||
getImpl().send(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* Binds the socket to the given socket address.
|
||||
*
|
||||
* @param address The socket address to bind to.
|
||||
*
|
||||
* @exception SocketException If an error occurs.
|
||||
* @exception SecurityException If a security manager exists and
|
||||
* its checkListen method doesn't allow the operation.
|
||||
* @exception IllegalArgumentException If address type is not supported.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public void bind(SocketAddress address) throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
if (! (address instanceof InetSocketAddress))
|
||||
throw new IllegalArgumentException("unsupported address type");
|
||||
|
||||
InetAddress addr = ((InetSocketAddress) address).getAddress();
|
||||
int port = ((InetSocketAddress) address).getPort();
|
||||
|
||||
if (port < 0 || port > 65535)
|
||||
throw new IllegalArgumentException("Invalid port: " + port);
|
||||
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
if (s != null)
|
||||
s.checkListen(port);
|
||||
|
||||
if (addr == null)
|
||||
addr = InetAddress.ANY_IF;
|
||||
|
||||
try
|
||||
{
|
||||
getImpl().bind(port, addr);
|
||||
bound = true;
|
||||
}
|
||||
catch (SocketException exception)
|
||||
{
|
||||
getImpl().close();
|
||||
throw exception;
|
||||
}
|
||||
catch (RuntimeException exception)
|
||||
{
|
||||
getImpl().close();
|
||||
throw exception;
|
||||
}
|
||||
catch (Error error)
|
||||
{
|
||||
getImpl().close();
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the datagram socket is closed.
|
||||
*
|
||||
* @return True if socket is closed, false otherwise.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public boolean isClosed()
|
||||
{
|
||||
return impl == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the datagram channel assoziated with this datagram socket.
|
||||
*
|
||||
* @return The associated <code>DatagramChannel</code> object or null
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public DatagramChannel getChannel()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connects the datagram socket to a specified socket address.
|
||||
*
|
||||
* @param address The socket address to connect to.
|
||||
*
|
||||
* @exception SocketException If an error occurs.
|
||||
* @exception IllegalArgumentException If address type is not supported.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public void connect(SocketAddress address) throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
if (! (address instanceof InetSocketAddress))
|
||||
throw new IllegalArgumentException("unsupported address type");
|
||||
|
||||
InetSocketAddress tmp = (InetSocketAddress) address;
|
||||
connect(tmp.getAddress(), tmp.getPort());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the binding state of the socket.
|
||||
*
|
||||
* @return True if socket bound, false otherwise.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public boolean isBound()
|
||||
{
|
||||
return bound;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the connection state of the socket.
|
||||
*
|
||||
* @return True if socket is connected, false otherwise.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public boolean isConnected()
|
||||
{
|
||||
return remoteAddress != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the SocketAddress of the host this socket is conneted to
|
||||
* or null if this socket is not connected.
|
||||
*
|
||||
* @return The socket address of the remote host if connected or null
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public SocketAddress getRemoteSocketAddress()
|
||||
{
|
||||
if (! isConnected())
|
||||
return null;
|
||||
|
||||
return new InetSocketAddress(remoteAddress, remotePort);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the local SocketAddress this socket is bound to.
|
||||
*
|
||||
* @return The local SocketAddress or null if the socket is not bound.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public SocketAddress getLocalSocketAddress()
|
||||
{
|
||||
if (! isBound())
|
||||
return null;
|
||||
|
||||
return new InetSocketAddress(getLocalAddress(), getLocalPort());
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables/Disables SO_REUSEADDR.
|
||||
*
|
||||
* @param on Whether or not to have SO_REUSEADDR turned on.
|
||||
*
|
||||
* @exception SocketException If an error occurs.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public void setReuseAddress(boolean on) throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
getImpl().setOption(SocketOptions.SO_REUSEADDR, Boolean.valueOf(on));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if SO_REUSEADDR is enabled.
|
||||
*
|
||||
* @return True if SO_REUSEADDR is set on the socket, false otherwise.
|
||||
*
|
||||
* @exception SocketException If an error occurs.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public boolean getReuseAddress() throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
Object buf = getImpl().getOption(SocketOptions.SO_REUSEADDR);
|
||||
|
||||
if (buf instanceof Boolean)
|
||||
return ((Boolean) buf).booleanValue();
|
||||
|
||||
throw new SocketException("unexpected type");
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables/Disables SO_BROADCAST
|
||||
*
|
||||
* @param enable True if SO_BROADCAST should be enabled, false otherwise.
|
||||
*
|
||||
* @exception SocketException If an error occurs
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public void setBroadcast(boolean enable) throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
getImpl().setOption(SocketOptions.SO_BROADCAST, Boolean.valueOf(enable));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if SO_BROADCAST is enabled
|
||||
*
|
||||
* @return Whether SO_BROADCAST is set
|
||||
*
|
||||
* @exception SocketException If an error occurs
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public boolean getBroadcast() throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
Object buf = getImpl().getOption(SocketOptions.SO_BROADCAST);
|
||||
|
||||
if (buf instanceof Boolean)
|
||||
return ((Boolean) buf).booleanValue();
|
||||
|
||||
throw new SocketException("unexpected type");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the traffic class value
|
||||
*
|
||||
* @param tc The traffic class
|
||||
*
|
||||
* @exception SocketException If an error occurs
|
||||
* @exception IllegalArgumentException If tc value is illegal
|
||||
*
|
||||
* @see DatagramSocket#getTrafficClass()
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public void setTrafficClass(int tc) throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
if (tc < 0 || tc > 255)
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
getImpl().setOption(SocketOptions.IP_TOS, new Integer(tc));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current traffic class
|
||||
*
|
||||
* @return The current traffic class.
|
||||
*
|
||||
* @see DatagramSocket#setTrafficClass(int tc)
|
||||
*
|
||||
* @exception SocketException If an error occurs
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public int getTrafficClass() throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
Object buf = getImpl().getOption(SocketOptions.IP_TOS);
|
||||
|
||||
if (buf instanceof Integer)
|
||||
return ((Integer) buf).intValue();
|
||||
|
||||
throw new SocketException("unexpected type");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the datagram socket implementation factory for the application
|
||||
*
|
||||
* @param fac The factory to set
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
* @exception SocketException If the factory is already defined
|
||||
* @exception SecurityException If a security manager exists and its
|
||||
* checkSetFactory method doesn't allow the operation
|
||||
*/
|
||||
public static void setDatagramSocketImplFactory(DatagramSocketImplFactory fac)
|
||||
throws IOException
|
||||
{
|
||||
if (factory != null)
|
||||
throw new SocketException("DatagramSocketImplFactory already defined");
|
||||
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkSetFactory();
|
||||
|
||||
factory = fac;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_DatagramSocketImpl__
|
||||
#define __java_net_DatagramSocketImpl__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class DatagramPacket;
|
||||
class DatagramSocketImpl;
|
||||
class InetAddress;
|
||||
class NetworkInterface;
|
||||
class SocketAddress;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::DatagramSocketImpl : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
DatagramSocketImpl();
|
||||
public: // actually protected
|
||||
virtual void bind(jint, ::java::net::InetAddress *) = 0;
|
||||
virtual void close() = 0;
|
||||
virtual void create() = 0;
|
||||
virtual jint peek(::java::net::InetAddress *) = 0;
|
||||
virtual jint peekData(::java::net::DatagramPacket *) = 0;
|
||||
virtual void send(::java::net::DatagramPacket *) = 0;
|
||||
virtual void receive(::java::net::DatagramPacket *) = 0;
|
||||
virtual void connect(::java::net::InetAddress *, jint);
|
||||
virtual void disconnect();
|
||||
virtual void setTTL(jbyte) = 0;
|
||||
virtual jbyte getTTL() = 0;
|
||||
virtual void setTimeToLive(jint) = 0;
|
||||
virtual jint getTimeToLive() = 0;
|
||||
virtual void join(::java::net::InetAddress *) = 0;
|
||||
virtual void leave(::java::net::InetAddress *) = 0;
|
||||
virtual void joinGroup(::java::net::SocketAddress *, ::java::net::NetworkInterface *) = 0;
|
||||
virtual void leaveGroup(::java::net::SocketAddress *, ::java::net::NetworkInterface *) = 0;
|
||||
virtual ::java::io::FileDescriptor * getFileDescriptor();
|
||||
virtual jint getLocalPort();
|
||||
public:
|
||||
virtual void setOption(jint, ::java::lang::Object *) = 0;
|
||||
virtual ::java::lang::Object * getOption(jint) = 0;
|
||||
public: // actually protected
|
||||
jint __attribute__((aligned(__alignof__( ::java::lang::Object)))) localPort;
|
||||
::java::io::FileDescriptor * fd;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_DatagramSocketImpl__
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_DatagramSocketImplFactory__
|
||||
#define __java_net_DatagramSocketImplFactory__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class DatagramSocketImpl;
|
||||
class DatagramSocketImplFactory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::DatagramSocketImplFactory : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
virtual ::java::net::DatagramSocketImpl * createDatagramSocketImpl() = 0;
|
||||
static ::java::lang::Class class$;
|
||||
} __attribute__ ((java_interface));
|
||||
|
||||
#endif // __java_net_DatagramSocketImplFactory__
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_FileNameMap__
|
||||
#define __java_net_FileNameMap__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class FileNameMap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::FileNameMap : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
virtual ::java::lang::String * getContentTypeFor(::java::lang::String *) = 0;
|
||||
static ::java::lang::Class class$;
|
||||
} __attribute__ ((java_interface));
|
||||
|
||||
#endif // __java_net_FileNameMap__
|
||||
@@ -0,0 +1,101 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_HttpURLConnection__
|
||||
#define __java_net_HttpURLConnection__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/URLConnection.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class HttpURLConnection;
|
||||
class URL;
|
||||
}
|
||||
namespace security
|
||||
{
|
||||
class Permission;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::HttpURLConnection : public ::java::net::URLConnection
|
||||
{
|
||||
|
||||
public: // actually protected
|
||||
HttpURLConnection(::java::net::URL *);
|
||||
public:
|
||||
virtual void disconnect() = 0;
|
||||
virtual jboolean usingProxy() = 0;
|
||||
static void setFollowRedirects(jboolean);
|
||||
static jboolean getFollowRedirects();
|
||||
virtual jboolean getInstanceFollowRedirects();
|
||||
virtual void setInstanceFollowRedirects(jboolean);
|
||||
virtual void setRequestMethod(::java::lang::String *);
|
||||
virtual ::java::lang::String * getRequestMethod();
|
||||
virtual jint getResponseCode();
|
||||
virtual ::java::lang::String * getResponseMessage();
|
||||
private:
|
||||
void getResponseVals();
|
||||
public:
|
||||
virtual ::java::security::Permission * getPermission();
|
||||
virtual ::java::io::InputStream * getErrorStream();
|
||||
virtual jlong getHeaderFieldDate(::java::lang::String *, jlong);
|
||||
public: // actually package-private
|
||||
static const jint HTTP_CONTINUE = 100;
|
||||
public:
|
||||
static const jint HTTP_OK = 200;
|
||||
static const jint HTTP_CREATED = 201;
|
||||
static const jint HTTP_ACCEPTED = 202;
|
||||
static const jint HTTP_NOT_AUTHORITATIVE = 203;
|
||||
static const jint HTTP_NO_CONTENT = 204;
|
||||
static const jint HTTP_RESET = 205;
|
||||
static const jint HTTP_PARTIAL = 206;
|
||||
static const jint HTTP_MULT_CHOICE = 300;
|
||||
static const jint HTTP_MOVED_PERM = 301;
|
||||
static const jint HTTP_MOVED_TEMP = 302;
|
||||
static const jint HTTP_SEE_OTHER = 303;
|
||||
static const jint HTTP_NOT_MODIFIED = 304;
|
||||
static const jint HTTP_USE_PROXY = 305;
|
||||
static const jint HTTP_BAD_REQUEST = 400;
|
||||
static const jint HTTP_UNAUTHORIZED = 401;
|
||||
static const jint HTTP_PAYMENT_REQUIRED = 402;
|
||||
static const jint HTTP_FORBIDDEN = 403;
|
||||
static const jint HTTP_NOT_FOUND = 404;
|
||||
static const jint HTTP_BAD_METHOD = 405;
|
||||
static const jint HTTP_NOT_ACCEPTABLE = 406;
|
||||
static const jint HTTP_PROXY_AUTH = 407;
|
||||
static const jint HTTP_CLIENT_TIMEOUT = 408;
|
||||
static const jint HTTP_CONFLICT = 409;
|
||||
static const jint HTTP_GONE = 410;
|
||||
static const jint HTTP_LENGTH_REQUIRED = 411;
|
||||
static const jint HTTP_PRECON_FAILED = 412;
|
||||
static const jint HTTP_ENTITY_TOO_LARGE = 413;
|
||||
static const jint HTTP_REQ_TOO_LONG = 414;
|
||||
static const jint HTTP_UNSUPPORTED_TYPE = 415;
|
||||
static const jint HTTP_SERVER_ERROR = 500;
|
||||
static const jint HTTP_INTERNAL_ERROR = 500;
|
||||
static const jint HTTP_NOT_IMPLEMENTED = 501;
|
||||
static const jint HTTP_BAD_GATEWAY = 502;
|
||||
static const jint HTTP_UNAVAILABLE = 503;
|
||||
static const jint HTTP_GATEWAY_TIMEOUT = 504;
|
||||
static const jint HTTP_VERSION = 505;
|
||||
private:
|
||||
static jboolean followRedirects;
|
||||
static ::java::lang::String * valid_methods;
|
||||
public: // actually protected
|
||||
::java::lang::String * __attribute__((aligned(__alignof__( ::java::net::URLConnection)))) method;
|
||||
jint responseCode;
|
||||
::java::lang::String * responseMessage;
|
||||
jboolean instanceFollowRedirects;
|
||||
private:
|
||||
jboolean gotResponseVals;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_HttpURLConnection__
|
||||
@@ -0,0 +1,52 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_Inet4Address__
|
||||
#define __java_net_Inet4Address__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/InetAddress.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class Inet4Address;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::Inet4Address : public ::java::net::InetAddress
|
||||
{
|
||||
|
||||
::java::lang::Object * writeReplace();
|
||||
public: // actually package-private
|
||||
Inet4Address(JArray< jbyte > *, ::java::lang::String *);
|
||||
public:
|
||||
jboolean isMulticastAddress();
|
||||
jboolean isLoopbackAddress();
|
||||
jboolean isAnyLocalAddress();
|
||||
jboolean isLinkLocalAddress();
|
||||
jboolean isSiteLocalAddress();
|
||||
jboolean isMCGlobal();
|
||||
jboolean isMCNodeLocal();
|
||||
jboolean isMCLinkLocal();
|
||||
jboolean isMCSiteLocal();
|
||||
jboolean isMCOrgLocal();
|
||||
JArray< jbyte > * getAddress();
|
||||
::java::lang::String * getHostAddress();
|
||||
jint hashCode();
|
||||
jboolean equals(::java::lang::Object *);
|
||||
public: // actually package-private
|
||||
static const jlong serialVersionUID = 3286316764910316507LL;
|
||||
private:
|
||||
static const jint AF_INET = 2;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_Inet4Address__
|
||||
@@ -0,0 +1,66 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_Inet6Address__
|
||||
#define __java_net_Inet6Address__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/InetAddress.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class Inet6Address;
|
||||
class NetworkInterface;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::Inet6Address : public ::java::net::InetAddress
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
Inet6Address(JArray< jbyte > *, ::java::lang::String *);
|
||||
public:
|
||||
jboolean isMulticastAddress();
|
||||
jboolean isAnyLocalAddress();
|
||||
jboolean isLoopbackAddress();
|
||||
jboolean isLinkLocalAddress();
|
||||
jboolean isSiteLocalAddress();
|
||||
jboolean isMCGlobal();
|
||||
jboolean isMCNodeLocal();
|
||||
jboolean isMCLinkLocal();
|
||||
jboolean isMCSiteLocal();
|
||||
jboolean isMCOrgLocal();
|
||||
JArray< jbyte > * getAddress();
|
||||
static ::java::net::Inet6Address * getByAddress(::java::lang::String *, JArray< jbyte > *, jint);
|
||||
static ::java::net::Inet6Address * getByAddress(::java::lang::String *, JArray< jbyte > *, ::java::net::NetworkInterface *);
|
||||
::java::net::NetworkInterface * getScopedInterface();
|
||||
jint getScopeId();
|
||||
::java::lang::String * getHostAddress();
|
||||
jint hashCode();
|
||||
jboolean equals(::java::lang::Object *);
|
||||
jboolean isIPv4CompatibleAddress();
|
||||
private:
|
||||
void readObject(::java::io::ObjectInputStream *);
|
||||
void writeObject(::java::io::ObjectOutputStream *);
|
||||
public: // actually package-private
|
||||
static const jlong serialVersionUID = 6880410070516793377LL;
|
||||
JArray< jbyte > * __attribute__((aligned(__alignof__( ::java::net::InetAddress)))) ipaddress;
|
||||
private:
|
||||
jint scope_id;
|
||||
jboolean scope_id_set;
|
||||
jboolean scope_ifname_set;
|
||||
::java::lang::String * ifname;
|
||||
::java::net::NetworkInterface * nif;
|
||||
static const jint AF_INET6 = 10;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_Inet6Address__
|
||||
@@ -0,0 +1,76 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_InetAddress__
|
||||
#define __java_net_InetAddress__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class InetAddress;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::InetAddress : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
InetAddress(JArray< jbyte > *, ::java::lang::String *, jint);
|
||||
public:
|
||||
virtual jboolean isMulticastAddress();
|
||||
virtual jboolean isAnyLocalAddress();
|
||||
virtual jboolean isLoopbackAddress();
|
||||
virtual jboolean isLinkLocalAddress();
|
||||
virtual jboolean isSiteLocalAddress();
|
||||
virtual jboolean isMCGlobal();
|
||||
virtual jboolean isMCNodeLocal();
|
||||
virtual jboolean isMCLinkLocal();
|
||||
virtual jboolean isMCSiteLocal();
|
||||
virtual jboolean isMCOrgLocal();
|
||||
virtual ::java::lang::String * getHostName();
|
||||
public: // actually package-private
|
||||
virtual ::java::lang::String * internalGetCanonicalHostName();
|
||||
public:
|
||||
virtual ::java::lang::String * getCanonicalHostName();
|
||||
virtual JArray< jbyte > * getAddress();
|
||||
virtual ::java::lang::String * getHostAddress();
|
||||
virtual jint hashCode();
|
||||
virtual jboolean equals(::java::lang::Object *);
|
||||
virtual ::java::lang::String * toString();
|
||||
static ::java::net::InetAddress * getByAddress(JArray< jbyte > *);
|
||||
static ::java::net::InetAddress * getByAddress(::java::lang::String *, JArray< jbyte > *);
|
||||
public: // actually package-private
|
||||
static ::java::net::InetAddress * getByLiteral(::java::lang::String *);
|
||||
public:
|
||||
static ::java::net::InetAddress * getByName(::java::lang::String *);
|
||||
static JArray< ::java::net::InetAddress * > * getAllByName(::java::lang::String *);
|
||||
static ::java::net::InetAddress * getLocalHost();
|
||||
private:
|
||||
::java::lang::Object * readResolve();
|
||||
void readObject(::java::io::ObjectInputStream *);
|
||||
void writeObject(::java::io::ObjectOutputStream *);
|
||||
static const jlong serialVersionUID = 3286316764910316507LL;
|
||||
public: // actually package-private
|
||||
static ::java::net::InetAddress * ANY_IF;
|
||||
static ::java::net::InetAddress * LOCALHOST;
|
||||
private:
|
||||
jint __attribute__((aligned(__alignof__( ::java::lang::Object)))) address;
|
||||
public: // actually package-private
|
||||
JArray< jbyte > * addr;
|
||||
::java::lang::String * hostName;
|
||||
private:
|
||||
jint family;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_InetAddress__
|
||||
@@ -0,0 +1,49 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_InetSocketAddress__
|
||||
#define __java_net_InetSocketAddress__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/SocketAddress.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class InetAddress;
|
||||
class InetSocketAddress;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::InetSocketAddress : public ::java::net::SocketAddress
|
||||
{
|
||||
|
||||
public:
|
||||
InetSocketAddress(::java::net::InetAddress *, jint);
|
||||
InetSocketAddress(jint);
|
||||
InetSocketAddress(::java::lang::String *, jint);
|
||||
private:
|
||||
InetSocketAddress(::java::lang::String *, jint, jboolean);
|
||||
public:
|
||||
static ::java::net::InetSocketAddress * createUnresolved(::java::lang::String *, jint);
|
||||
virtual jboolean equals(::java::lang::Object *);
|
||||
virtual ::java::net::InetAddress * getAddress();
|
||||
virtual ::java::lang::String * getHostName();
|
||||
virtual jint getPort();
|
||||
virtual jint hashCode();
|
||||
virtual jboolean isUnresolved();
|
||||
virtual ::java::lang::String * toString();
|
||||
private:
|
||||
static const jlong serialVersionUID = 5076001401234631237LL;
|
||||
::java::lang::String * __attribute__((aligned(__alignof__( ::java::net::SocketAddress)))) hostname;
|
||||
::java::net::InetAddress * addr;
|
||||
jint port;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_InetSocketAddress__
|
||||
@@ -0,0 +1,56 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_JarURLConnection__
|
||||
#define __java_net_JarURLConnection__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/URLConnection.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class JarURLConnection;
|
||||
class URL;
|
||||
class URLConnection;
|
||||
}
|
||||
namespace security
|
||||
{
|
||||
namespace cert
|
||||
{
|
||||
class Certificate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::JarURLConnection : public ::java::net::URLConnection
|
||||
{
|
||||
|
||||
public: // actually protected
|
||||
JarURLConnection(::java::net::URL *);
|
||||
public:
|
||||
virtual ::java::net::URL * getJarFileURL();
|
||||
virtual ::java::lang::String * getEntryName();
|
||||
virtual ::java::util::jar::JarEntry * getJarEntry();
|
||||
virtual ::java::util::jar::JarFile * getJarFile() = 0;
|
||||
virtual JArray< ::java::security::cert::Certificate * > * getCertificates();
|
||||
virtual ::java::util::jar::Attributes * getMainAttributes();
|
||||
virtual ::java::util::jar::Attributes * getAttributes();
|
||||
virtual ::java::util::jar::Manifest * getManifest();
|
||||
private:
|
||||
::java::net::URL * __attribute__((aligned(__alignof__( ::java::net::URLConnection)))) jarFileURL;
|
||||
public: // actually protected
|
||||
::java::net::URLConnection * jarFileURLConnection;
|
||||
private:
|
||||
::java::lang::String * entryName;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_JarURLConnection__
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_MalformedURLException__
|
||||
#define __java_net_MalformedURLException__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/io/IOException.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class MalformedURLException;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::MalformedURLException : public ::java::io::IOException
|
||||
{
|
||||
|
||||
public:
|
||||
MalformedURLException();
|
||||
MalformedURLException(::java::lang::String *);
|
||||
private:
|
||||
static const jlong serialVersionUID = -182787522200415866LL;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_MalformedURLException__
|
||||
@@ -0,0 +1,39 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_MimeTypeMapper__
|
||||
#define __java_net_MimeTypeMapper__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class MimeTypeMapper;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::MimeTypeMapper : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
MimeTypeMapper();
|
||||
static void fillFromFile(::java::util::Map *, ::java::lang::String *);
|
||||
virtual ::java::lang::String * getContentTypeFor(::java::lang::String *);
|
||||
static void main(JArray< ::java::lang::String * > *);
|
||||
public: // actually protected
|
||||
static JArray< JArray< ::java::lang::String * > * > * mime_strings;
|
||||
private:
|
||||
::java::util::Hashtable * __attribute__((aligned(__alignof__( ::java::lang::Object)))) mime_types;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_MimeTypeMapper__
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_MulticastSocket__
|
||||
#define __java_net_MulticastSocket__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/DatagramSocket.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class DatagramPacket;
|
||||
class InetAddress;
|
||||
class MulticastSocket;
|
||||
class NetworkInterface;
|
||||
class SocketAddress;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::MulticastSocket : public ::java::net::DatagramSocket
|
||||
{
|
||||
|
||||
public:
|
||||
MulticastSocket();
|
||||
MulticastSocket(jint);
|
||||
MulticastSocket(::java::net::SocketAddress *);
|
||||
virtual ::java::net::InetAddress * getInterface();
|
||||
virtual jbyte getTTL();
|
||||
virtual jint getTimeToLive();
|
||||
virtual void setInterface(::java::net::InetAddress *);
|
||||
virtual void setNetworkInterface(::java::net::NetworkInterface *);
|
||||
virtual ::java::net::NetworkInterface * getNetworkInterface();
|
||||
virtual void setLoopbackMode(jboolean);
|
||||
virtual jboolean getLoopbackMode();
|
||||
virtual void setTTL(jbyte);
|
||||
virtual void setTimeToLive(jint);
|
||||
virtual void joinGroup(::java::net::InetAddress *);
|
||||
virtual void leaveGroup(::java::net::InetAddress *);
|
||||
virtual void joinGroup(::java::net::SocketAddress *, ::java::net::NetworkInterface *);
|
||||
virtual void leaveGroup(::java::net::SocketAddress *, ::java::net::NetworkInterface *);
|
||||
virtual void send(::java::net::DatagramPacket *, jbyte);
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_MulticastSocket__
|
||||
@@ -0,0 +1,519 @@
|
||||
/* MulticastSocket.java -- Class for using multicast sockets
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
package java.net;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Enumeration;
|
||||
|
||||
|
||||
/**
|
||||
* Written using on-line Java Platform 1.2 API Specification, as well
|
||||
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
|
||||
* Status: Believed complete and correct.
|
||||
*/
|
||||
/**
|
||||
* This class models a multicast UDP socket. A multicast address is a
|
||||
* class D internet address (one whose most significant bits are 1110).
|
||||
* A multicast group consists of a multicast address and a well known
|
||||
* port number. All members of the group listening on that address and
|
||||
* port will receive all the broadcasts to the group.
|
||||
* <p>
|
||||
* Please note that applets are not allowed to use multicast sockets
|
||||
*
|
||||
* Written using on-line Java Platform 1.2 API Specification, as well
|
||||
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
|
||||
* Status: Believed complete and correct.
|
||||
*
|
||||
* @author Warren Levy (warrenl@cygnus.com)
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com) (Documentation comments)
|
||||
* @since 1.1
|
||||
* @date May 18, 1999.
|
||||
*/
|
||||
public class MulticastSocket extends DatagramSocket
|
||||
{
|
||||
/**
|
||||
* Create a MulticastSocket that this not bound to any address
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
* @exception SecurityException If a security manager exists and its
|
||||
* checkListen method doesn't allow the operation
|
||||
*/
|
||||
public MulticastSocket() throws IOException
|
||||
{
|
||||
this(new InetSocketAddress(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a multicast socket bound to the specified port
|
||||
*
|
||||
* @param port The port to bind to
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
* @exception SecurityException If a security manager exists and its
|
||||
* checkListen method doesn't allow the operation
|
||||
*/
|
||||
public MulticastSocket(int port) throws IOException
|
||||
{
|
||||
this(new InetSocketAddress(port));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a multicast socket bound to the specified SocketAddress.
|
||||
*
|
||||
* @param address The SocketAddress the multicast socket will be bound to
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
* @exception SecurityException If a security manager exists and its
|
||||
* checkListen method doesn't allow the operation
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public MulticastSocket(SocketAddress address) throws IOException
|
||||
{
|
||||
super((SocketAddress) null);
|
||||
setReuseAddress(true);
|
||||
if (address != null)
|
||||
bind(address);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the interface being used for multicast packets
|
||||
*
|
||||
* @return The multicast interface
|
||||
*
|
||||
* @exception SocketException If an error occurs
|
||||
*/
|
||||
public InetAddress getInterface() throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
return (InetAddress) getImpl().getOption(SocketOptions.IP_MULTICAST_IF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current value of the "Time to Live" option. This is the
|
||||
* number of hops a packet can make before it "expires". This method id
|
||||
* deprecated. Use <code>getTimeToLive</code> instead.
|
||||
*
|
||||
* @return The TTL value
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
*
|
||||
* @deprecated 1.2 Replaced by getTimeToLive()
|
||||
*
|
||||
* @see MulticastSocket#getTimeToLive()
|
||||
*/
|
||||
public byte getTTL() throws IOException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
// Use getTTL here rather than getTimeToLive in case we're using an impl
|
||||
// other than the default PlainDatagramSocketImpl and it doesn't have
|
||||
// getTimeToLive yet.
|
||||
return getImpl().getTTL();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current value of the "Time to Live" option. This is the
|
||||
* number of hops a packet can make before it "expires".
|
||||
*
|
||||
* @return The TTL value
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public int getTimeToLive() throws IOException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
return getImpl().getTimeToLive();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the interface to use for sending multicast packets.
|
||||
*
|
||||
* @param addr The new interface to use.
|
||||
*
|
||||
* @exception SocketException If an error occurs.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public void setInterface(InetAddress addr) throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
getImpl().setOption(SocketOptions.IP_MULTICAST_IF, addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the local network interface used to send multicast messages
|
||||
*
|
||||
* @param netIf The local network interface used to send multicast messages
|
||||
*
|
||||
* @exception SocketException If an error occurs
|
||||
*
|
||||
* @see MulticastSocket#getNetworkInterface()
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public void setNetworkInterface(NetworkInterface netIf)
|
||||
throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
InetAddress address;
|
||||
if (netIf != null)
|
||||
out:
|
||||
{
|
||||
Enumeration e = netIf.getInetAddresses();
|
||||
if (getLocalAddress() instanceof Inet4Address)
|
||||
{
|
||||
// Search for a IPv4 address.
|
||||
while (e.hasMoreElements())
|
||||
{
|
||||
address = (InetAddress) e.nextElement();
|
||||
if (address instanceof Inet4Address)
|
||||
break out;
|
||||
}
|
||||
throw new SocketException("interface " + netIf.getName() + " has no IPv6 address");
|
||||
}
|
||||
else if (getLocalAddress() instanceof Inet6Address)
|
||||
{
|
||||
// Search for a IPv6 address.
|
||||
while (e.hasMoreElements())
|
||||
{
|
||||
address = (InetAddress) e.nextElement();
|
||||
if (address instanceof Inet6Address)
|
||||
break out;
|
||||
}
|
||||
throw new SocketException("interface " + netIf.getName() + " has no IPv6 address");
|
||||
}
|
||||
else
|
||||
throw new SocketException("interface " + netIf.getName() + " has no suitable IP address");
|
||||
}
|
||||
else
|
||||
address = InetAddress.ANY_IF;
|
||||
|
||||
|
||||
getImpl().setOption(SocketOptions.IP_MULTICAST_IF, address);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the local network interface which is used to send multicast messages
|
||||
*
|
||||
* @return The local network interface to send multicast messages
|
||||
*
|
||||
* @exception SocketException If an error occurs
|
||||
*
|
||||
* @see MulticastSocket#setNetworkInterface(NetworkInterface netIf)
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public NetworkInterface getNetworkInterface() throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
InetAddress address =
|
||||
(InetAddress) getImpl().getOption(SocketOptions.IP_MULTICAST_IF);
|
||||
|
||||
// FIXME: libgcj doesn't have createAnyInterface.
|
||||
// if (address.isAnyLocalAddress())
|
||||
// return NetworkInterface.createAnyInterface();
|
||||
|
||||
NetworkInterface netIf = NetworkInterface.getByInetAddress(address);
|
||||
|
||||
return netIf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable/Enable local loopback of multicast packets. The option is used by
|
||||
* the platform's networking code as a hint for setting whether multicast
|
||||
* data will be looped back to the local socket.
|
||||
*
|
||||
* Because this option is a hint, applications that want to verify what
|
||||
* loopback mode is set to should call #getLoopbackMode
|
||||
*
|
||||
* @param disable True to disable loopback mode
|
||||
*
|
||||
* @exception SocketException If an error occurs
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public void setLoopbackMode(boolean disable) throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
getImpl().setOption(SocketOptions.IP_MULTICAST_LOOP,
|
||||
Boolean.valueOf(disable));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if local loopback mode is enabled
|
||||
*
|
||||
* @return true if loopback mode is enabled, false otherwise
|
||||
*
|
||||
* @exception SocketException If an error occurs
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public boolean getLoopbackMode() throws SocketException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
Object buf = getImpl().getOption(SocketOptions.IP_MULTICAST_LOOP);
|
||||
|
||||
if (buf instanceof Boolean)
|
||||
return ((Boolean) buf).booleanValue();
|
||||
|
||||
throw new SocketException("unexpected type");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the "Time to Live" value for a socket. The value must be between
|
||||
* 1 and 255.
|
||||
*
|
||||
* @param ttl The new TTL value
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
*
|
||||
* @deprecated 1.2 Replaced by <code>setTimeToLive</code>
|
||||
*
|
||||
* @see MulticastSocket#setTimeToLive(int ttl)
|
||||
*/
|
||||
public void setTTL(byte ttl) throws IOException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
// Use setTTL here rather than setTimeToLive in case we're using an impl
|
||||
// other than the default PlainDatagramSocketImpl and it doesn't have
|
||||
// setTimeToLive yet.
|
||||
getImpl().setTTL(ttl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the "Time to Live" value for a socket. The value must be between
|
||||
* 1 and 255.
|
||||
*
|
||||
* @param ttl The new TTL value
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public void setTimeToLive(int ttl) throws IOException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
if (ttl <= 0 || ttl > 255)
|
||||
throw new IllegalArgumentException("Invalid ttl: " + ttl);
|
||||
|
||||
getImpl().setTimeToLive(ttl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Joins the specified multicast group.
|
||||
*
|
||||
* @param mcastaddr The address of the group to join
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
* @exception SecurityException If a security manager exists and its
|
||||
* checkMulticast method doesn't allow the operation
|
||||
*/
|
||||
public void joinGroup(InetAddress mcastaddr) throws IOException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
if (! mcastaddr.isMulticastAddress())
|
||||
throw new IOException("Not a Multicast address");
|
||||
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
if (s != null)
|
||||
s.checkMulticast(mcastaddr);
|
||||
|
||||
getImpl().join(mcastaddr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Leaves the specified multicast group
|
||||
*
|
||||
* @param mcastaddr The address of the group to leave
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
* @exception SecurityException If a security manager exists and its
|
||||
* checkMulticast method doesn't allow the operation
|
||||
*/
|
||||
public void leaveGroup(InetAddress mcastaddr) throws IOException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
if (! mcastaddr.isMulticastAddress())
|
||||
throw new IOException("Not a Multicast address");
|
||||
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
if (s != null)
|
||||
s.checkMulticast(mcastaddr);
|
||||
|
||||
getImpl().leave(mcastaddr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Joins the specified mulitcast group on a specified interface.
|
||||
*
|
||||
* @param mcastaddr The multicast address to join
|
||||
* @param netIf The local network interface to receive the multicast
|
||||
* messages on or null to defer the interface set by #setInterface or
|
||||
* #setNetworkInterface
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
* @exception IllegalArgumentException If address type is not supported
|
||||
* @exception SecurityException If a security manager exists and its
|
||||
* checkMulticast method doesn't allow the operation
|
||||
*
|
||||
* @see MulticastSocket#setInterface(InetAddress addr)
|
||||
* @see MulticastSocket#setNetworkInterface(NetworkInterface netIf)
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public void joinGroup(SocketAddress mcastaddr, NetworkInterface netIf)
|
||||
throws IOException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
if (! (mcastaddr instanceof InetSocketAddress))
|
||||
throw new IllegalArgumentException("SocketAddress type not supported");
|
||||
|
||||
InetSocketAddress tmp = (InetSocketAddress) mcastaddr;
|
||||
|
||||
if (! tmp.getAddress().isMulticastAddress())
|
||||
throw new IOException("Not a Multicast address");
|
||||
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
if (s != null)
|
||||
s.checkMulticast(tmp.getAddress());
|
||||
|
||||
getImpl().joinGroup(mcastaddr, netIf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Leaves the specified mulitcast group on a specified interface.
|
||||
*
|
||||
* @param mcastaddr The multicast address to leave
|
||||
* @param netIf The local networki interface or null to defer to the
|
||||
* interface set by setInterface or setNetworkInterface
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
* @exception IllegalArgumentException If address type is not supported
|
||||
* @exception SecurityException If a security manager exists and its
|
||||
* checkMulticast method doesn't allow the operation
|
||||
*
|
||||
* @see MulticastSocket#setInterface(InetAddress addr)
|
||||
* @see MulticastSocket#setNetworkInterface(NetworkInterface netIf)
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public void leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf)
|
||||
throws IOException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
InetSocketAddress tmp = (InetSocketAddress) mcastaddr;
|
||||
|
||||
if (! tmp.getAddress().isMulticastAddress())
|
||||
throw new IOException("Not a Multicast address");
|
||||
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
if (s != null)
|
||||
s.checkMulticast(tmp.getAddress());
|
||||
|
||||
getImpl().leaveGroup(mcastaddr, netIf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a packet of data to a multicast address with a TTL that is
|
||||
* different from the default TTL on this socket. The default TTL for
|
||||
* the socket is not changed.
|
||||
*
|
||||
* @param packet The packet of data to send
|
||||
* @param ttl The TTL for this packet
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
* @exception SecurityException If a security manager exists and its
|
||||
* checkConnect or checkMulticast method doesn't allow the operation
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public synchronized void send(DatagramPacket packet, byte ttl)
|
||||
throws IOException
|
||||
{
|
||||
if (isClosed())
|
||||
throw new SocketException("socket is closed");
|
||||
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
if (s != null)
|
||||
{
|
||||
InetAddress addr = packet.getAddress();
|
||||
if (addr.isMulticastAddress())
|
||||
s.checkPermission(new SocketPermission(addr.getHostName()
|
||||
+ packet.getPort(),
|
||||
"accept,connect"));
|
||||
else
|
||||
s.checkConnect(addr.getHostAddress(), packet.getPort());
|
||||
}
|
||||
|
||||
int oldttl = getImpl().getTimeToLive();
|
||||
getImpl().setTimeToLive(((int) ttl) & 0xFF);
|
||||
getImpl().send(packet);
|
||||
getImpl().setTimeToLive(oldttl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_NetPermission__
|
||||
#define __java_net_NetPermission__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/security/BasicPermission.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class NetPermission;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::NetPermission : public ::java::security::BasicPermission
|
||||
{
|
||||
|
||||
public:
|
||||
NetPermission(::java::lang::String *);
|
||||
NetPermission(::java::lang::String *, ::java::lang::String *);
|
||||
public: // actually package-private
|
||||
static const jlong serialVersionUID = -8343910153355041693LL;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_NetPermission__
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_NetworkInterface__
|
||||
#define __java_net_NetworkInterface__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class InetAddress;
|
||||
class NetworkInterface;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::NetworkInterface : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
NetworkInterface(::java::lang::String *, ::java::net::InetAddress *);
|
||||
NetworkInterface(::java::lang::String *, JArray< ::java::net::InetAddress * > *);
|
||||
public:
|
||||
::java::lang::String * getName();
|
||||
::java::util::Enumeration * getInetAddresses();
|
||||
::java::lang::String * getDisplayName();
|
||||
static ::java::net::NetworkInterface * getByName(::java::lang::String *);
|
||||
static ::java::net::NetworkInterface * getByInetAddress(::java::net::InetAddress *);
|
||||
private:
|
||||
static ::java::util::Collection * condense(::java::util::Collection *);
|
||||
public:
|
||||
static ::java::util::Enumeration * getNetworkInterfaces();
|
||||
jboolean equals(::java::lang::Object *);
|
||||
jint hashCode();
|
||||
::java::lang::String * toString();
|
||||
private:
|
||||
::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) name;
|
||||
::java::util::Vector * inetAddresses;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_NetworkInterface__
|
||||
@@ -0,0 +1,299 @@
|
||||
/* NetworkInterface.java --
|
||||
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.net;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* This class models a network interface on the host computer. A network
|
||||
* interface contains a name (typically associated with a specific
|
||||
* hardware adapter) and a list of addresses that are bound to it.
|
||||
* For example, an ethernet interface may be named "eth0" and have the
|
||||
* address 192.168.1.101 assigned to it.
|
||||
*
|
||||
* @author Michael Koch (konqueror@gmx.de)
|
||||
* @since 1.4
|
||||
*/
|
||||
public final class NetworkInterface
|
||||
{
|
||||
private String name;
|
||||
private Vector<InetAddress> inetAddresses;
|
||||
|
||||
NetworkInterface(String name, InetAddress address)
|
||||
{
|
||||
this.name = name;
|
||||
this.inetAddresses = new Vector(1, 1);
|
||||
this.inetAddresses.add(address);
|
||||
}
|
||||
|
||||
NetworkInterface(String name, InetAddress[] addresses)
|
||||
{
|
||||
this.name = name;
|
||||
this.inetAddresses = new Vector(addresses.length, 1);
|
||||
|
||||
for (int i = 0; i < addresses.length; i++)
|
||||
this.inetAddresses.add(addresses[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the network interface
|
||||
*
|
||||
* @return The name of the interface.
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all available addresses of the network interface
|
||||
*
|
||||
* If a @see SecurityManager is available all addresses are checked
|
||||
* with @see SecurityManager::checkConnect() if they are available.
|
||||
* Only <code>InetAddresses</code> are returned where the security manager
|
||||
* doesn't throw an exception.
|
||||
*
|
||||
* @return An enumeration of all addresses.
|
||||
*/
|
||||
public Enumeration<InetAddress> getInetAddresses()
|
||||
{
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
|
||||
if (s == null)
|
||||
return inetAddresses.elements();
|
||||
|
||||
Vector<InetAddress> tmpInetAddresses = new Vector<InetAddress>(1, 1);
|
||||
|
||||
for (Enumeration<InetAddress> addresses = inetAddresses.elements();
|
||||
addresses.hasMoreElements();)
|
||||
{
|
||||
InetAddress addr = addresses.nextElement();
|
||||
try
|
||||
{
|
||||
s.checkConnect(addr.getHostAddress(), 58000);
|
||||
tmpInetAddresses.add(addr);
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
}
|
||||
|
||||
return tmpInetAddresses.elements();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the display name of the interface
|
||||
*
|
||||
* @return The display name of the interface
|
||||
*/
|
||||
public String getDisplayName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an network interface by name
|
||||
*
|
||||
* @param name The name of the interface to return
|
||||
*
|
||||
* @return a <code>NetworkInterface</code> object representing the interface,
|
||||
* or null if there is no interface with that name.
|
||||
*
|
||||
* @exception SocketException If an error occurs
|
||||
* @exception NullPointerException If the specified name is null
|
||||
*/
|
||||
public static NetworkInterface getByName(String name)
|
||||
throws SocketException
|
||||
{
|
||||
for (Enumeration e = getNetworkInterfaces(); e.hasMoreElements();)
|
||||
{
|
||||
NetworkInterface tmp = (NetworkInterface) e.nextElement();
|
||||
|
||||
if (name.equals(tmp.getName()))
|
||||
return tmp;
|
||||
}
|
||||
|
||||
// No interface with the given name found.
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a network interface by its address
|
||||
*
|
||||
* @param addr The address of the interface to return
|
||||
*
|
||||
* @return the interface, or <code>null</code> if none found
|
||||
*
|
||||
* @exception SocketException If an error occurs
|
||||
* @exception NullPointerException If the specified addess is null
|
||||
*/
|
||||
public static NetworkInterface getByInetAddress(InetAddress addr)
|
||||
throws SocketException
|
||||
{
|
||||
for (Enumeration interfaces = getNetworkInterfaces();
|
||||
interfaces.hasMoreElements();)
|
||||
{
|
||||
NetworkInterface tmp = (NetworkInterface) interfaces.nextElement();
|
||||
|
||||
for (Enumeration addresses = tmp.inetAddresses.elements();
|
||||
addresses.hasMoreElements();)
|
||||
{
|
||||
if (addr.equals((InetAddress) addresses.nextElement()))
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
|
||||
throw new SocketException("no network interface is bound to such an IP address");
|
||||
}
|
||||
|
||||
static private Collection condense(Collection interfaces)
|
||||
{
|
||||
final Map condensed = new HashMap();
|
||||
|
||||
final Iterator interfs = interfaces.iterator();
|
||||
while (interfs.hasNext()) {
|
||||
|
||||
final NetworkInterface face = (NetworkInterface) interfs.next();
|
||||
final String name = face.getName();
|
||||
|
||||
if (condensed.containsKey(name))
|
||||
{
|
||||
final NetworkInterface conface = (NetworkInterface) condensed.get(name);
|
||||
if (!conface.inetAddresses.containsAll(face.inetAddresses))
|
||||
{
|
||||
final Iterator faceAddresses = face.inetAddresses.iterator();
|
||||
while (faceAddresses.hasNext())
|
||||
{
|
||||
final InetAddress faceAddress = (InetAddress) faceAddresses.next();
|
||||
if (!conface.inetAddresses.contains(faceAddress))
|
||||
{
|
||||
conface.inetAddresses.add(faceAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
condensed.put(name, face);
|
||||
}
|
||||
}
|
||||
|
||||
return condensed.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an <code>Enumeration</code> of all available network interfaces
|
||||
*
|
||||
* @return all interfaces
|
||||
*
|
||||
* @exception SocketException If an error occurs
|
||||
*/
|
||||
public static Enumeration<NetworkInterface> getNetworkInterfaces()
|
||||
throws SocketException
|
||||
{
|
||||
Vector<NetworkInterface> networkInterfaces =
|
||||
VMNetworkInterface.getInterfaces();
|
||||
|
||||
if (networkInterfaces.isEmpty())
|
||||
return null;
|
||||
|
||||
Collection condensed = condense(networkInterfaces);
|
||||
|
||||
return Collections.enumeration(condensed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the current instance is equal to obj
|
||||
*
|
||||
* @param obj The object to compare with
|
||||
*
|
||||
* @return <code>true</code> if equal, <code>false</code> otherwise
|
||||
*/
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (! (obj instanceof NetworkInterface))
|
||||
return false;
|
||||
|
||||
NetworkInterface tmp = (NetworkInterface) obj;
|
||||
|
||||
return (name.equals(tmp.name) && inetAddresses.equals(tmp.inetAddresses));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the hashcode of the current instance
|
||||
*
|
||||
* @return the hashcode
|
||||
*/
|
||||
public int hashCode()
|
||||
{
|
||||
// FIXME: hash correctly
|
||||
return name.hashCode() + inetAddresses.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of the interface
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
// FIXME: check if this is correct
|
||||
String result;
|
||||
String separator = System.getProperty("line.separator");
|
||||
|
||||
result =
|
||||
"name: " + getDisplayName() + " (" + getName() + ") addresses:"
|
||||
+ separator;
|
||||
|
||||
for (Enumeration e = inetAddresses.elements(); e.hasMoreElements();)
|
||||
{
|
||||
InetAddress address = (InetAddress) e.nextElement();
|
||||
result += address.toString() + ";" + separator;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_NoRouteToHostException__
|
||||
#define __java_net_NoRouteToHostException__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/SocketException.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class NoRouteToHostException;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::NoRouteToHostException : public ::java::net::SocketException
|
||||
{
|
||||
|
||||
public:
|
||||
NoRouteToHostException();
|
||||
NoRouteToHostException(::java::lang::String *);
|
||||
private:
|
||||
static const jlong serialVersionUID = -1897550894873493790LL;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_NoRouteToHostException__
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_PasswordAuthentication__
|
||||
#define __java_net_PasswordAuthentication__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class PasswordAuthentication;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::PasswordAuthentication : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
PasswordAuthentication(::java::lang::String *, JArray< jchar > *);
|
||||
::java::lang::String * getUserName();
|
||||
JArray< jchar > * getPassword();
|
||||
private:
|
||||
::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) username;
|
||||
JArray< jchar > * password;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_PasswordAuthentication__
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_PortUnreachableException__
|
||||
#define __java_net_PortUnreachableException__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/SocketException.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class PortUnreachableException;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::PortUnreachableException : public ::java::net::SocketException
|
||||
{
|
||||
|
||||
public:
|
||||
PortUnreachableException();
|
||||
PortUnreachableException(::java::lang::String *);
|
||||
private:
|
||||
static const jlong serialVersionUID = 8462541992376507323LL;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_PortUnreachableException__
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_ProtocolException__
|
||||
#define __java_net_ProtocolException__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/io/IOException.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class ProtocolException;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::ProtocolException : public ::java::io::IOException
|
||||
{
|
||||
|
||||
public:
|
||||
ProtocolException();
|
||||
ProtocolException(::java::lang::String *);
|
||||
private:
|
||||
static const jlong serialVersionUID = -6098449442062388080LL;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_ProtocolException__
|
||||
@@ -0,0 +1,40 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_Proxy$Type__
|
||||
#define __java_net_Proxy$Type__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Enum.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class Proxy$Type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::Proxy$Type : public ::java::lang::Enum
|
||||
{
|
||||
|
||||
Proxy$Type(::java::lang::String *, jint);
|
||||
public:
|
||||
static JArray< ::java::net::Proxy$Type * > * values();
|
||||
static ::java::net::Proxy$Type * valueOf(::java::lang::String *);
|
||||
static ::java::net::Proxy$Type * DIRECT;
|
||||
static ::java::net::Proxy$Type * HTTP;
|
||||
static ::java::net::Proxy$Type * SOCKS;
|
||||
private:
|
||||
static const jlong serialVersionUID = -2231209257930100533LL;
|
||||
static JArray< ::java::net::Proxy$Type * > * ENUM$VALUES;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_Proxy$Type__
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_Proxy__
|
||||
#define __java_net_Proxy__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class Proxy;
|
||||
class Proxy$Type;
|
||||
class SocketAddress;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::Proxy : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
Proxy(::java::net::Proxy$Type *, ::java::net::SocketAddress *);
|
||||
virtual ::java::net::SocketAddress * address();
|
||||
virtual ::java::net::Proxy$Type * type();
|
||||
virtual jboolean equals(::java::lang::Object *);
|
||||
virtual jint hashCode();
|
||||
virtual ::java::lang::String * toString();
|
||||
static ::java::net::Proxy * NO_PROXY;
|
||||
private:
|
||||
::java::net::Proxy$Type * __attribute__((aligned(__alignof__( ::java::lang::Object)))) type__;
|
||||
::java::net::SocketAddress * address__;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_Proxy__
|
||||
@@ -0,0 +1,38 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_ProxySelector__
|
||||
#define __java_net_ProxySelector__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class ProxySelector;
|
||||
class SocketAddress;
|
||||
class URI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::ProxySelector : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
ProxySelector();
|
||||
static ::java::net::ProxySelector * getDefault();
|
||||
static void setDefault(::java::net::ProxySelector *);
|
||||
virtual void connectFailed(::java::net::URI *, ::java::net::SocketAddress *, ::java::io::IOException *) = 0;
|
||||
virtual ::java::util::List * select(::java::net::URI *) = 0;
|
||||
private:
|
||||
static ::java::net::ProxySelector * defaultSelector;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_ProxySelector__
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_ResolverCache$Entry__
|
||||
#define __java_net_ResolverCache$Entry__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class ResolverCache$Entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::ResolverCache$Entry : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
ResolverCache$Entry(::java::lang::Object *, ::java::lang::Object *);
|
||||
::java::lang::Object * __attribute__((aligned(__alignof__( ::java::lang::Object)))) key;
|
||||
::java::lang::Object * value;
|
||||
jlong expires;
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_ResolverCache$Entry__
|
||||
@@ -0,0 +1,51 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_ResolverCache__
|
||||
#define __java_net_ResolverCache__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class ResolverCache;
|
||||
class ResolverCache$Entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::ResolverCache : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
ResolverCache();
|
||||
private:
|
||||
static jint getTTL(::java::lang::String *, jint);
|
||||
public:
|
||||
static ::java::lang::String * getHostByAddr(JArray< jbyte > *);
|
||||
static JArray< JArray< jbyte > * > * getHostByName(::java::lang::String *);
|
||||
private:
|
||||
static ::java::lang::Object * makeHashableAddress(JArray< jbyte > *);
|
||||
static ::java::net::ResolverCache$Entry * get(::java::lang::Object *);
|
||||
static void put(::java::net::ResolverCache$Entry *);
|
||||
static void reap();
|
||||
public: // actually package-private
|
||||
static jint access$0();
|
||||
static jint access$1();
|
||||
private:
|
||||
static jint POSITIVE_TTL;
|
||||
static jint NEGATIVE_TTL;
|
||||
static ::java::util::HashMap * cache;
|
||||
static ::java::util::LinkedList * killqueue;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_ResolverCache__
|
||||
@@ -0,0 +1,75 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_ServerSocket__
|
||||
#define __java_net_ServerSocket__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class InetAddress;
|
||||
class InetSocketAddress;
|
||||
class ServerSocket;
|
||||
class Socket;
|
||||
class SocketAddress;
|
||||
class SocketImpl;
|
||||
class SocketImplFactory;
|
||||
}
|
||||
namespace nio
|
||||
{
|
||||
namespace channels
|
||||
{
|
||||
class ServerSocketChannel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::ServerSocket : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
ServerSocket(::java::net::SocketImpl *);
|
||||
virtual ::java::net::SocketImpl * getImpl();
|
||||
public:
|
||||
ServerSocket();
|
||||
ServerSocket(jint);
|
||||
ServerSocket(jint, jint);
|
||||
ServerSocket(jint, jint, ::java::net::InetAddress *);
|
||||
virtual void bind(::java::net::SocketAddress *);
|
||||
virtual void bind(::java::net::SocketAddress *, jint);
|
||||
virtual ::java::net::InetAddress * getInetAddress();
|
||||
virtual jint getLocalPort();
|
||||
virtual ::java::net::SocketAddress * getLocalSocketAddress();
|
||||
virtual ::java::net::Socket * accept();
|
||||
public: // actually protected
|
||||
virtual void implAccept(::java::net::Socket *);
|
||||
public:
|
||||
virtual void close();
|
||||
virtual ::java::nio::channels::ServerSocketChannel * getChannel();
|
||||
virtual jboolean isBound();
|
||||
virtual jboolean isClosed();
|
||||
virtual void setSoTimeout(jint);
|
||||
virtual jint getSoTimeout();
|
||||
virtual void setReuseAddress(jboolean);
|
||||
virtual jboolean getReuseAddress();
|
||||
virtual void setReceiveBufferSize(jint);
|
||||
virtual jint getReceiveBufferSize();
|
||||
virtual ::java::lang::String * toString();
|
||||
static void setSocketFactory(::java::net::SocketImplFactory *);
|
||||
private:
|
||||
static ::java::net::SocketImplFactory * factory;
|
||||
::java::net::SocketImpl * __attribute__((aligned(__alignof__( ::java::lang::Object)))) impl;
|
||||
::java::net::InetSocketAddress * local;
|
||||
jint port;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_ServerSocket__
|
||||
@@ -0,0 +1,103 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_Socket__
|
||||
#define __java_net_Socket__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class InetAddress;
|
||||
class Socket;
|
||||
class SocketAddress;
|
||||
class SocketImpl;
|
||||
class SocketImplFactory;
|
||||
}
|
||||
namespace nio
|
||||
{
|
||||
namespace channels
|
||||
{
|
||||
class SocketChannel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::Socket : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
Socket();
|
||||
public: // actually protected
|
||||
Socket(::java::net::SocketImpl *);
|
||||
public:
|
||||
Socket(::java::lang::String *, jint);
|
||||
Socket(::java::net::InetAddress *, jint);
|
||||
Socket(::java::lang::String *, jint, ::java::net::InetAddress *, jint);
|
||||
Socket(::java::net::InetAddress *, jint, ::java::net::InetAddress *, jint);
|
||||
Socket(::java::lang::String *, jint, jboolean);
|
||||
Socket(::java::net::InetAddress *, jint, jboolean);
|
||||
private:
|
||||
Socket(::java::net::InetAddress *, jint, ::java::net::InetAddress *, jint, jboolean);
|
||||
::java::net::SocketImpl * getImpl();
|
||||
public:
|
||||
virtual void bind(::java::net::SocketAddress *);
|
||||
virtual void connect(::java::net::SocketAddress *);
|
||||
virtual void connect(::java::net::SocketAddress *, jint);
|
||||
virtual ::java::net::InetAddress * getInetAddress();
|
||||
virtual ::java::net::InetAddress * getLocalAddress();
|
||||
virtual jint getPort();
|
||||
virtual jint getLocalPort();
|
||||
virtual ::java::net::SocketAddress * getLocalSocketAddress();
|
||||
virtual ::java::net::SocketAddress * getRemoteSocketAddress();
|
||||
virtual ::java::io::InputStream * getInputStream();
|
||||
virtual ::java::io::OutputStream * getOutputStream();
|
||||
virtual void setTcpNoDelay(jboolean);
|
||||
virtual jboolean getTcpNoDelay();
|
||||
virtual void setSoLinger(jboolean, jint);
|
||||
virtual jint getSoLinger();
|
||||
virtual void sendUrgentData(jint);
|
||||
virtual void setOOBInline(jboolean);
|
||||
virtual jboolean getOOBInline();
|
||||
virtual void setSoTimeout(jint);
|
||||
virtual jint getSoTimeout();
|
||||
virtual void setSendBufferSize(jint);
|
||||
virtual jint getSendBufferSize();
|
||||
virtual void setReceiveBufferSize(jint);
|
||||
virtual jint getReceiveBufferSize();
|
||||
virtual void setKeepAlive(jboolean);
|
||||
virtual jboolean getKeepAlive();
|
||||
virtual void close();
|
||||
virtual ::java::lang::String * toString();
|
||||
static void setSocketImplFactory(::java::net::SocketImplFactory *);
|
||||
virtual void shutdownInput();
|
||||
virtual void shutdownOutput();
|
||||
virtual ::java::nio::channels::SocketChannel * getChannel();
|
||||
virtual jboolean getReuseAddress();
|
||||
virtual void setReuseAddress(jboolean);
|
||||
virtual jint getTrafficClass();
|
||||
virtual void setTrafficClass(jint);
|
||||
virtual jboolean isConnected();
|
||||
virtual jboolean isBound();
|
||||
virtual jboolean isClosed();
|
||||
virtual jboolean isInputShutdown();
|
||||
virtual jboolean isOutputShutdown();
|
||||
public: // actually package-private
|
||||
static ::java::net::SocketImplFactory * factory;
|
||||
::java::net::SocketImpl * __attribute__((aligned(__alignof__( ::java::lang::Object)))) impl;
|
||||
jboolean implCreated;
|
||||
jboolean bound;
|
||||
private:
|
||||
jboolean inputShutdown;
|
||||
jboolean outputShutdown;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_Socket__
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,32 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_SocketAddress__
|
||||
#define __java_net_SocketAddress__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class SocketAddress;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::SocketAddress : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
SocketAddress();
|
||||
public: // actually package-private
|
||||
static const jlong serialVersionUID = 5215720748342549866LL;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_SocketAddress__
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_SocketException__
|
||||
#define __java_net_SocketException__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/io/IOException.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class SocketException;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::SocketException : public ::java::io::IOException
|
||||
{
|
||||
|
||||
public:
|
||||
SocketException();
|
||||
SocketException(::java::lang::String *);
|
||||
private:
|
||||
static const jlong serialVersionUID = -5935874303556886934LL;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_SocketException__
|
||||
@@ -0,0 +1,63 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_SocketImpl__
|
||||
#define __java_net_SocketImpl__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class InetAddress;
|
||||
class SocketAddress;
|
||||
class SocketImpl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::SocketImpl : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
SocketImpl();
|
||||
public: // actually protected
|
||||
virtual void create(jboolean) = 0;
|
||||
virtual void connect(::java::lang::String *, jint) = 0;
|
||||
virtual void connect(::java::net::InetAddress *, jint) = 0;
|
||||
virtual void connect(::java::net::SocketAddress *, jint) = 0;
|
||||
virtual void bind(::java::net::InetAddress *, jint) = 0;
|
||||
virtual void listen(jint) = 0;
|
||||
virtual void accept(::java::net::SocketImpl *) = 0;
|
||||
virtual ::java::io::InputStream * getInputStream() = 0;
|
||||
virtual ::java::io::OutputStream * getOutputStream() = 0;
|
||||
virtual jint available() = 0;
|
||||
virtual void close() = 0;
|
||||
virtual ::java::io::FileDescriptor * getFileDescriptor();
|
||||
virtual ::java::net::InetAddress * getInetAddress();
|
||||
virtual jint getPort();
|
||||
virtual jboolean supportsUrgentData();
|
||||
virtual void sendUrgentData(jint) = 0;
|
||||
virtual jint getLocalPort();
|
||||
public:
|
||||
virtual ::java::lang::String * toString();
|
||||
public: // actually protected
|
||||
virtual void shutdownInput();
|
||||
virtual void shutdownOutput();
|
||||
public:
|
||||
virtual void setOption(jint, ::java::lang::Object *) = 0;
|
||||
virtual ::java::lang::Object * getOption(jint) = 0;
|
||||
public: // actually protected
|
||||
::java::net::InetAddress * __attribute__((aligned(__alignof__( ::java::lang::Object)))) address;
|
||||
::java::io::FileDescriptor * fd;
|
||||
jint localport;
|
||||
jint port;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_SocketImpl__
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_SocketImplFactory__
|
||||
#define __java_net_SocketImplFactory__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class SocketImpl;
|
||||
class SocketImplFactory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::SocketImplFactory : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
virtual ::java::net::SocketImpl * createSocketImpl() = 0;
|
||||
static ::java::lang::Class class$;
|
||||
} __attribute__ ((java_interface));
|
||||
|
||||
#endif // __java_net_SocketImplFactory__
|
||||
@@ -0,0 +1,44 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_SocketOptions__
|
||||
#define __java_net_SocketOptions__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class SocketOptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::SocketOptions : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
virtual void setOption(jint, ::java::lang::Object *) = 0;
|
||||
virtual ::java::lang::Object * getOption(jint) = 0;
|
||||
static const jint SO_KEEPALIVE = 8;
|
||||
static const jint SO_LINGER = 128;
|
||||
static const jint SO_TIMEOUT = 4102;
|
||||
static const jint SO_BINDADDR = 15;
|
||||
static const jint SO_SNDBUF = 4097;
|
||||
static const jint SO_RCVBUF = 4098;
|
||||
static const jint SO_REUSEADDR = 4;
|
||||
static const jint SO_BROADCAST = 32;
|
||||
static const jint SO_OOBINLINE = 4099;
|
||||
static const jint TCP_NODELAY = 1;
|
||||
static const jint IP_MULTICAST_IF = 16;
|
||||
static const jint IP_MULTICAST_IF2 = 31;
|
||||
static const jint IP_MULTICAST_LOOP = 18;
|
||||
static const jint IP_TOS = 3;
|
||||
static ::java::lang::Class class$;
|
||||
} __attribute__ ((java_interface));
|
||||
|
||||
#endif // __java_net_SocketOptions__
|
||||
@@ -0,0 +1,68 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_SocketPermission__
|
||||
#define __java_net_SocketPermission__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/security/Permission.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class InetAddress;
|
||||
class SocketPermission;
|
||||
}
|
||||
namespace security
|
||||
{
|
||||
class Permission;
|
||||
class PermissionCollection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::SocketPermission : public ::java::security::Permission
|
||||
{
|
||||
|
||||
public:
|
||||
SocketPermission(::java::lang::String *, ::java::lang::String *);
|
||||
private:
|
||||
static ::java::lang::String * processHostport(::java::lang::String *);
|
||||
void setHostPort(::java::lang::String *);
|
||||
void setActions(::java::lang::String *);
|
||||
void setAction(::java::lang::String *);
|
||||
public:
|
||||
jboolean equals(::java::lang::Object *);
|
||||
jint hashCode();
|
||||
::java::lang::String * getActions();
|
||||
::java::security::PermissionCollection * newPermissionCollection();
|
||||
private:
|
||||
JArray< ::java::net::InetAddress * > * getAddresses();
|
||||
::java::lang::String * getCanonicalHostName();
|
||||
public:
|
||||
jboolean implies(::java::security::Permission *);
|
||||
private:
|
||||
void readObject(::java::io::ObjectInputStream *);
|
||||
void writeObject(::java::io::ObjectOutputStream *);
|
||||
public: // actually package-private
|
||||
static const jlong serialVersionUID = -7204263841984476862LL;
|
||||
private:
|
||||
::java::lang::String * __attribute__((aligned(__alignof__( ::java::security::Permission)))) hostname;
|
||||
::java::net::InetAddress * address;
|
||||
jint minport;
|
||||
jint maxport;
|
||||
static const jint MIN_PORT = 0;
|
||||
static const jint MAX_PORT = 2147483647;
|
||||
::java::lang::String * actions;
|
||||
jint actionmask;
|
||||
static JArray< ::java::lang::String * > * ACTIONS;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_SocketPermission__
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_SocketTimeoutException__
|
||||
#define __java_net_SocketTimeoutException__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/io/InterruptedIOException.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class SocketTimeoutException;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::SocketTimeoutException : public ::java::io::InterruptedIOException
|
||||
{
|
||||
|
||||
public:
|
||||
SocketTimeoutException();
|
||||
SocketTimeoutException(::java::lang::String *);
|
||||
private:
|
||||
static const jlong serialVersionUID = -8846654841826352300LL;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_SocketTimeoutException__
|
||||
@@ -0,0 +1,134 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URI__
|
||||
#define __java_net_URI__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URI;
|
||||
class URL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URI : public ::java::lang::Object
|
||||
{
|
||||
|
||||
void readObject(::java::io::ObjectInputStream *);
|
||||
void writeObject(::java::io::ObjectOutputStream *);
|
||||
static ::java::lang::String * getURIGroup(::java::util::regex::Matcher *, jint);
|
||||
void parseURI(::java::lang::String *);
|
||||
static ::java::lang::String * unquote(::java::lang::String *);
|
||||
static ::java::lang::String * quote(::java::lang::String *);
|
||||
static ::java::lang::String * quoteAuthority(::java::lang::String *);
|
||||
static ::java::lang::String * quote(::java::lang::String *, ::java::lang::String *);
|
||||
static ::java::lang::String * quoteHost(::java::lang::String *);
|
||||
static ::java::lang::String * quotePath(::java::lang::String *);
|
||||
static ::java::lang::String * quoteUserInfo(::java::lang::String *);
|
||||
public:
|
||||
URI(::java::lang::String *);
|
||||
URI(::java::lang::String *, ::java::lang::String *, ::java::lang::String *, jint, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
|
||||
URI(::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
|
||||
URI(::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
|
||||
URI(::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
|
||||
static ::java::net::URI * create(::java::lang::String *);
|
||||
::java::net::URI * parseServerAuthority();
|
||||
::java::net::URI * normalize();
|
||||
private:
|
||||
::java::lang::String * normalizePath(::java::lang::String *);
|
||||
void removeLastSegment(::java::lang::StringBuffer *);
|
||||
public:
|
||||
::java::net::URI * resolve(::java::net::URI *);
|
||||
::java::net::URI * resolve(::java::lang::String *);
|
||||
::java::net::URI * relativize(::java::net::URI *);
|
||||
::java::net::URL * toURL();
|
||||
::java::lang::String * getScheme();
|
||||
jboolean isAbsolute();
|
||||
jboolean isOpaque();
|
||||
::java::lang::String * getRawSchemeSpecificPart();
|
||||
::java::lang::String * getSchemeSpecificPart();
|
||||
::java::lang::String * getRawAuthority();
|
||||
::java::lang::String * getAuthority();
|
||||
::java::lang::String * getRawUserInfo();
|
||||
::java::lang::String * getUserInfo();
|
||||
::java::lang::String * getHost();
|
||||
jint getPort();
|
||||
::java::lang::String * getRawPath();
|
||||
::java::lang::String * getPath();
|
||||
::java::lang::String * getRawQuery();
|
||||
::java::lang::String * getQuery();
|
||||
::java::lang::String * getRawFragment();
|
||||
::java::lang::String * getFragment();
|
||||
jboolean equals(::java::lang::Object *);
|
||||
jint hashCode();
|
||||
jint target$compareTo(::java::net::URI *);
|
||||
private:
|
||||
jint compareFragments(::java::net::URI *);
|
||||
public:
|
||||
::java::lang::String * toString();
|
||||
::java::lang::String * toASCIIString();
|
||||
private:
|
||||
static ::java::lang::String * escapeCharacters(::java::lang::String *);
|
||||
public:
|
||||
jint compareTo(::java::lang::Object *);
|
||||
public: // actually package-private
|
||||
static const jlong serialVersionUID = -6052424284110960213LL;
|
||||
private:
|
||||
static ::java::lang::String * URI_REGEXP;
|
||||
static ::java::lang::String * AUTHORITY_REGEXP;
|
||||
static ::java::lang::String * RFC2396_DIGIT;
|
||||
static ::java::lang::String * RFC2396_LOWALPHA;
|
||||
static ::java::lang::String * RFC2396_UPALPHA;
|
||||
static ::java::lang::String * RFC2396_ALPHA;
|
||||
static ::java::lang::String * RFC2396_ALPHANUM;
|
||||
static ::java::lang::String * RFC3986_UNRESERVED;
|
||||
static ::java::lang::String * RFC3986_SUBDELIMS;
|
||||
static ::java::lang::String * RFC3986_REG_NAME;
|
||||
static ::java::lang::String * RFC3986_PCHAR;
|
||||
static ::java::lang::String * RFC3986_SEGMENT;
|
||||
static ::java::lang::String * RFC3986_PATH_SEGMENTS;
|
||||
static ::java::lang::String * RFC3986_SSP;
|
||||
static ::java::lang::String * RFC3986_HOST;
|
||||
static ::java::lang::String * RFC3986_USERINFO;
|
||||
static const jint SCHEME_GROUP = 2;
|
||||
static const jint SCHEME_SPEC_PART_GROUP = 3;
|
||||
static const jint AUTHORITY_GROUP = 5;
|
||||
static const jint PATH_GROUP = 6;
|
||||
static const jint QUERY_GROUP = 8;
|
||||
static const jint FRAGMENT_GROUP = 10;
|
||||
static const jint AUTHORITY_USERINFO_GROUP = 2;
|
||||
static const jint AUTHORITY_HOST_GROUP = 3;
|
||||
static const jint AUTHORITY_PORT_GROUP = 5;
|
||||
static ::java::util::regex::Pattern * URI_PATTERN;
|
||||
static ::java::util::regex::Pattern * AUTHORITY_PATTERN;
|
||||
static ::java::lang::String * HEX;
|
||||
::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) scheme;
|
||||
::java::lang::String * rawSchemeSpecificPart;
|
||||
::java::lang::String * schemeSpecificPart;
|
||||
::java::lang::String * rawAuthority;
|
||||
::java::lang::String * authority;
|
||||
::java::lang::String * rawUserInfo;
|
||||
::java::lang::String * userInfo;
|
||||
::java::lang::String * rawHost;
|
||||
::java::lang::String * host;
|
||||
jint port;
|
||||
::java::lang::String * rawPath;
|
||||
::java::lang::String * path;
|
||||
::java::lang::String * rawQuery;
|
||||
::java::lang::String * query;
|
||||
::java::lang::String * rawFragment;
|
||||
::java::lang::String * fragment;
|
||||
::java::lang::String * string;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URI__
|
||||
@@ -0,0 +1,39 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URISyntaxException__
|
||||
#define __java_net_URISyntaxException__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Exception.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URISyntaxException;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URISyntaxException : public ::java::lang::Exception
|
||||
{
|
||||
|
||||
public:
|
||||
URISyntaxException(::java::lang::String *, ::java::lang::String *);
|
||||
URISyntaxException(::java::lang::String *, ::java::lang::String *, jint);
|
||||
virtual ::java::lang::String * getInput();
|
||||
virtual ::java::lang::String * getReason();
|
||||
virtual jint getIndex();
|
||||
virtual ::java::lang::String * getMessage();
|
||||
private:
|
||||
static const jlong serialVersionUID = 2137979680897488891LL;
|
||||
::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Exception)))) input;
|
||||
jint index;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URISyntaxException__
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URL$1__
|
||||
#define __java_net_URL$1__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URL$1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URL$1 : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
URL$1();
|
||||
public:
|
||||
::java::lang::Object * run();
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URL$1__
|
||||
@@ -0,0 +1,89 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URL__
|
||||
#define __java_net_URL__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URI;
|
||||
class URL;
|
||||
class URLConnection;
|
||||
class URLStreamHandler;
|
||||
class URLStreamHandlerFactory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URL : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
URL(::java::lang::String *, ::java::lang::String *, jint, ::java::lang::String *);
|
||||
URL(::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
|
||||
URL(::java::lang::String *, ::java::lang::String *, jint, ::java::lang::String *, ::java::net::URLStreamHandler *);
|
||||
URL(::java::lang::String *);
|
||||
URL(::java::net::URL *, ::java::lang::String *);
|
||||
URL(::java::net::URL *, ::java::lang::String *, ::java::net::URLStreamHandler *);
|
||||
jboolean equals(::java::lang::Object *);
|
||||
::java::lang::Object * getContent();
|
||||
::java::lang::Object * getContent(JArray< ::java::lang::Class * > *);
|
||||
::java::lang::String * getFile();
|
||||
::java::lang::String * getPath();
|
||||
::java::lang::String * getAuthority();
|
||||
::java::lang::String * getHost();
|
||||
jint getPort();
|
||||
jint getDefaultPort();
|
||||
::java::lang::String * getProtocol();
|
||||
::java::lang::String * getRef();
|
||||
::java::lang::String * getUserInfo();
|
||||
::java::lang::String * getQuery();
|
||||
jint hashCode();
|
||||
::java::net::URLConnection * openConnection();
|
||||
::java::io::InputStream * openStream();
|
||||
jboolean sameFile(::java::net::URL *);
|
||||
public: // actually protected
|
||||
void set(::java::lang::String *, ::java::lang::String *, jint, ::java::lang::String *, ::java::lang::String *);
|
||||
void set(::java::lang::String *, ::java::lang::String *, jint, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
|
||||
public:
|
||||
static void setURLStreamHandlerFactory(::java::net::URLStreamHandlerFactory *);
|
||||
::java::lang::String * toExternalForm();
|
||||
::java::lang::String * toString();
|
||||
private:
|
||||
static ::java::net::URLStreamHandler * getURLStreamHandler(::java::lang::String *);
|
||||
void readObject(::java::io::ObjectInputStream *);
|
||||
void writeObject(::java::io::ObjectOutputStream *);
|
||||
public:
|
||||
::java::net::URI * toURI();
|
||||
private:
|
||||
static ::java::lang::String * DEFAULT_SEARCH_PATH;
|
||||
static ::java::lang::ClassLoader * systemClassLoader;
|
||||
::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) protocol;
|
||||
::java::lang::String * authority;
|
||||
::java::lang::String * host;
|
||||
::java::lang::String * userInfo;
|
||||
jint port;
|
||||
::java::lang::String * file;
|
||||
::java::lang::String * ref;
|
||||
jint hashCode__;
|
||||
public: // actually package-private
|
||||
::java::net::URLStreamHandler * ph;
|
||||
private:
|
||||
static ::java::net::URLStreamHandlerFactory * factory;
|
||||
static const jlong serialVersionUID = -7627629688361524110LL;
|
||||
static ::java::util::HashMap * ph_cache;
|
||||
static jboolean cache_handlers;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URL__
|
||||
@@ -0,0 +1,45 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLClassLoader$1__
|
||||
#define __java_net_URLClassLoader$1__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URLClassLoader;
|
||||
class URLClassLoader$1;
|
||||
}
|
||||
namespace security
|
||||
{
|
||||
class CodeSource;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLClassLoader$1 : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
URLClassLoader$1(::java::net::URLClassLoader *, ::java::lang::String *, JArray< jbyte > *, ::java::security::CodeSource *);
|
||||
public:
|
||||
::java::lang::Object * run();
|
||||
public: // actually package-private
|
||||
::java::net::URLClassLoader * __attribute__((aligned(__alignof__( ::java::lang::Object)))) this$0;
|
||||
private:
|
||||
::java::lang::String * val$className;
|
||||
JArray< jbyte > * val$classData;
|
||||
::java::security::CodeSource * val$source;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URLClassLoader$1__
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLClassLoader$2__
|
||||
#define __java_net_URLClassLoader$2__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URLClassLoader$2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLClassLoader$2 : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
URLClassLoader$2(::java::lang::ClassLoader *, ::java::lang::Object *);
|
||||
public:
|
||||
::java::lang::Object * run();
|
||||
private:
|
||||
::java::lang::ClassLoader * __attribute__((aligned(__alignof__( ::java::lang::Object)))) val$parent;
|
||||
::java::lang::Object * val$securityContext;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URLClassLoader$2__
|
||||
@@ -0,0 +1,46 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLClassLoader$CoreResource__
|
||||
#define __java_net_URLClassLoader$CoreResource__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/URLClassLoader$Resource.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace gnu
|
||||
{
|
||||
namespace gcj
|
||||
{
|
||||
class Core;
|
||||
}
|
||||
}
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URL;
|
||||
class URLClassLoader$CoreResource;
|
||||
class URLClassLoader$CoreURLLoader;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLClassLoader$CoreResource : public ::java::net::URLClassLoader$Resource
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
URLClassLoader$CoreResource(::java::net::URLClassLoader$CoreURLLoader *, ::java::lang::String *, ::gnu::gcj::Core *);
|
||||
::java::io::InputStream * getInputStream();
|
||||
public:
|
||||
jint getLength();
|
||||
::java::net::URL * getURL();
|
||||
private:
|
||||
::gnu::gcj::Core * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$Resource)))) core;
|
||||
::java::lang::String * name;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URLClassLoader$CoreResource__
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLClassLoader$CoreURLLoader__
|
||||
#define __java_net_URLClassLoader$CoreURLLoader__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/URLClassLoader$URLLoader.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URL;
|
||||
class URLClassLoader;
|
||||
class URLClassLoader$CoreURLLoader;
|
||||
class URLClassLoader$Resource;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLClassLoader$CoreURLLoader : public ::java::net::URLClassLoader$URLLoader
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
URLClassLoader$CoreURLLoader(::java::net::URLClassLoader *, ::java::net::URL *);
|
||||
::java::net::URLClassLoader$Resource * getResource(::java::lang::String *);
|
||||
private:
|
||||
::java::lang::String * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$URLLoader)))) dir;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URLClassLoader$CoreURLLoader__
|
||||
@@ -0,0 +1,38 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLClassLoader$FileResource__
|
||||
#define __java_net_URLClassLoader$FileResource__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/URLClassLoader$Resource.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URL;
|
||||
class URLClassLoader$FileResource;
|
||||
class URLClassLoader$FileURLLoader;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLClassLoader$FileResource : public ::java::net::URLClassLoader$Resource
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
URLClassLoader$FileResource(::java::net::URLClassLoader$FileURLLoader *, ::java::io::File *);
|
||||
::java::io::InputStream * getInputStream();
|
||||
public:
|
||||
jint getLength();
|
||||
::java::net::URL * getURL();
|
||||
public: // actually package-private
|
||||
::java::io::File * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$Resource)))) file;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URLClassLoader$FileResource__
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLClassLoader$FileURLLoader__
|
||||
#define __java_net_URLClassLoader$FileURLLoader__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/URLClassLoader$URLLoader.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URL;
|
||||
class URLClassLoader;
|
||||
class URLClassLoader$FileURLLoader;
|
||||
class URLClassLoader$Resource;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLClassLoader$FileURLLoader : public ::java::net::URLClassLoader$URLLoader
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
URLClassLoader$FileURLLoader(::java::net::URLClassLoader *, ::java::net::URL *, ::java::net::URL *);
|
||||
::java::net::URLClassLoader$Resource * getResource(::java::lang::String *);
|
||||
::java::io::File * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$URLLoader)))) dir;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URLClassLoader$FileURLLoader__
|
||||
@@ -0,0 +1,40 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLClassLoader$JarURLLoader__
|
||||
#define __java_net_URLClassLoader$JarURLLoader__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/URLClassLoader$URLLoader.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URL;
|
||||
class URLClassLoader;
|
||||
class URLClassLoader$JarURLLoader;
|
||||
class URLClassLoader$Resource;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLClassLoader$JarURLLoader : public ::java::net::URLClassLoader$URLLoader
|
||||
{
|
||||
|
||||
public:
|
||||
URLClassLoader$JarURLLoader(::java::net::URLClassLoader *, ::java::net::URL *, ::java::net::URL *);
|
||||
public: // actually package-private
|
||||
::java::net::URLClassLoader$Resource * getResource(::java::lang::String *);
|
||||
::java::util::jar::Manifest * getManifest();
|
||||
::java::util::Vector * getClassPath();
|
||||
::java::util::jar::JarFile * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$URLLoader)))) jarfile;
|
||||
::java::net::URL * baseJarURL;
|
||||
::java::util::Vector * classPath;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URLClassLoader$JarURLLoader__
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLClassLoader$JarURLResource__
|
||||
#define __java_net_URLClassLoader$JarURLResource__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/URLClassLoader$Resource.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URL;
|
||||
class URLClassLoader$JarURLLoader;
|
||||
class URLClassLoader$JarURLResource;
|
||||
}
|
||||
namespace security
|
||||
{
|
||||
namespace cert
|
||||
{
|
||||
class Certificate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLClassLoader$JarURLResource : public ::java::net::URLClassLoader$Resource
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
URLClassLoader$JarURLResource(::java::net::URLClassLoader$JarURLLoader *, ::java::lang::String *, ::java::util::jar::JarEntry *);
|
||||
::java::io::InputStream * getInputStream();
|
||||
jint getLength();
|
||||
JArray< ::java::security::cert::Certificate * > * getCertificates();
|
||||
::java::net::URL * getURL();
|
||||
private:
|
||||
::java::util::jar::JarEntry * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$Resource)))) entry;
|
||||
::java::lang::String * name;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URLClassLoader$JarURLResource__
|
||||
@@ -0,0 +1,40 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLClassLoader$RemoteResource__
|
||||
#define __java_net_URLClassLoader$RemoteResource__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/URLClassLoader$Resource.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URL;
|
||||
class URLClassLoader$RemoteResource;
|
||||
class URLClassLoader$RemoteURLLoader;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLClassLoader$RemoteResource : public ::java::net::URLClassLoader$Resource
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
URLClassLoader$RemoteResource(::java::net::URLClassLoader$RemoteURLLoader *, ::java::lang::String *, ::java::net::URL *, ::java::io::InputStream *, jint);
|
||||
::java::io::InputStream * getInputStream();
|
||||
public:
|
||||
jint getLength();
|
||||
::java::net::URL * getURL();
|
||||
private:
|
||||
::java::net::URL * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$Resource)))) url;
|
||||
::java::io::InputStream * stream;
|
||||
jint length;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URLClassLoader$RemoteResource__
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLClassLoader$RemoteURLLoader__
|
||||
#define __java_net_URLClassLoader$RemoteURLLoader__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/URLClassLoader$URLLoader.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URL;
|
||||
class URLClassLoader;
|
||||
class URLClassLoader$RemoteURLLoader;
|
||||
class URLClassLoader$Resource;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLClassLoader$RemoteURLLoader : public ::java::net::URLClassLoader$URLLoader
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
URLClassLoader$RemoteURLLoader(::java::net::URLClassLoader *, ::java::net::URL *);
|
||||
::java::net::URLClassLoader$Resource * getResource(::java::lang::String *);
|
||||
private:
|
||||
::java::lang::String * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$URLLoader)))) protocol;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URLClassLoader$RemoteURLLoader__
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLClassLoader$Resource__
|
||||
#define __java_net_URLClassLoader$Resource__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URL;
|
||||
class URLClassLoader$Resource;
|
||||
class URLClassLoader$URLLoader;
|
||||
}
|
||||
namespace security
|
||||
{
|
||||
class CodeSource;
|
||||
namespace cert
|
||||
{
|
||||
class Certificate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLClassLoader$Resource : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
URLClassLoader$Resource(::java::net::URLClassLoader$URLLoader *);
|
||||
virtual ::java::security::CodeSource * getCodeSource();
|
||||
virtual JArray< ::java::security::cert::Certificate * > * getCertificates();
|
||||
virtual ::java::net::URL * getURL() = 0;
|
||||
virtual jint getLength() = 0;
|
||||
virtual ::java::io::InputStream * getInputStream() = 0;
|
||||
::java::net::URLClassLoader$URLLoader * __attribute__((aligned(__alignof__( ::java::lang::Object)))) loader;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URLClassLoader$Resource__
|
||||
@@ -0,0 +1,38 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLClassLoader$SoResource__
|
||||
#define __java_net_URLClassLoader$SoResource__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/URLClassLoader$Resource.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URL;
|
||||
class URLClassLoader$SoResource;
|
||||
class URLClassLoader$SoURLLoader;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLClassLoader$SoResource : public ::java::net::URLClassLoader$Resource
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
URLClassLoader$SoResource(::java::net::URLClassLoader$SoURLLoader *, ::java::net::URL *);
|
||||
::java::io::InputStream * getInputStream();
|
||||
public:
|
||||
jint getLength();
|
||||
::java::net::URL * getURL();
|
||||
public: // actually package-private
|
||||
::java::net::URL * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$Resource)))) url;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URLClassLoader$SoResource__
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLClassLoader$SoURLLoader__
|
||||
#define __java_net_URLClassLoader$SoURLLoader__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/net/URLClassLoader$URLLoader.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace gnu
|
||||
{
|
||||
namespace gcj
|
||||
{
|
||||
namespace runtime
|
||||
{
|
||||
class SharedLibHelper;
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URL;
|
||||
class URLClassLoader;
|
||||
class URLClassLoader$Resource;
|
||||
class URLClassLoader$SoURLLoader;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLClassLoader$SoURLLoader : public ::java::net::URLClassLoader$URLLoader
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
URLClassLoader$SoURLLoader(::java::net::URLClassLoader *, ::java::net::URL *);
|
||||
URLClassLoader$SoURLLoader(::java::net::URLClassLoader *, ::java::net::URL *, ::java::net::URL *);
|
||||
::java::lang::Class * getClass(::java::lang::String *);
|
||||
::java::net::URLClassLoader$Resource * getResource(::java::lang::String *);
|
||||
::gnu::gcj::runtime::SharedLibHelper * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$URLLoader)))) helper;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URLClassLoader$SoURLLoader__
|
||||
@@ -0,0 +1,45 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLClassLoader$URLLoader__
|
||||
#define __java_net_URLClassLoader$URLLoader__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URL;
|
||||
class URLClassLoader;
|
||||
class URLClassLoader$Resource;
|
||||
class URLClassLoader$URLLoader;
|
||||
}
|
||||
namespace security
|
||||
{
|
||||
class CodeSource;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLClassLoader$URLLoader : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
URLClassLoader$URLLoader(::java::net::URLClassLoader *, ::java::net::URL *);
|
||||
URLClassLoader$URLLoader(::java::net::URLClassLoader *, ::java::net::URL *, ::java::net::URL *);
|
||||
virtual ::java::lang::Class * getClass(::java::lang::String *);
|
||||
virtual ::java::net::URLClassLoader$Resource * getResource(::java::lang::String *) = 0;
|
||||
virtual ::java::util::jar::Manifest * getManifest();
|
||||
virtual ::java::util::Vector * getClassPath();
|
||||
::java::net::URLClassLoader * __attribute__((aligned(__alignof__( ::java::lang::Object)))) classloader;
|
||||
::java::net::URL * baseURL;
|
||||
::java::security::CodeSource * noCertCodeSource;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URLClassLoader$URLLoader__
|
||||
@@ -0,0 +1,82 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLClassLoader__
|
||||
#define __java_net_URLClassLoader__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/security/SecureClassLoader.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URL;
|
||||
class URLClassLoader;
|
||||
class URLClassLoader$Resource;
|
||||
class URLStreamHandler;
|
||||
class URLStreamHandlerFactory;
|
||||
}
|
||||
namespace security
|
||||
{
|
||||
class AccessControlContext;
|
||||
class CodeSource;
|
||||
class PermissionCollection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLClassLoader : public ::java::security::SecureClassLoader
|
||||
{
|
||||
|
||||
public:
|
||||
URLClassLoader(JArray< ::java::net::URL * > *);
|
||||
URLClassLoader(JArray< ::java::net::URL * > *, ::java::lang::ClassLoader *);
|
||||
public: // actually package-private
|
||||
URLClassLoader(::java::lang::ClassLoader *, ::java::security::AccessControlContext *);
|
||||
public:
|
||||
URLClassLoader(JArray< ::java::net::URL * > *, ::java::lang::ClassLoader *, ::java::net::URLStreamHandlerFactory *);
|
||||
public: // actually protected
|
||||
virtual void addURL(::java::net::URL *);
|
||||
private:
|
||||
void addURLImpl(::java::net::URL *);
|
||||
void addURLs(JArray< ::java::net::URL * > *);
|
||||
::java::lang::String * getAttributeValue(::java::util::jar::Attributes$Name *, ::java::util::jar::Attributes *, ::java::util::jar::Attributes *);
|
||||
public: // actually protected
|
||||
virtual ::java::lang::Package * definePackage(::java::lang::String *, ::java::util::jar::Manifest *, ::java::net::URL *);
|
||||
virtual ::java::lang::Class * findClass(::java::lang::String *);
|
||||
public:
|
||||
virtual ::java::lang::String * toString();
|
||||
private:
|
||||
::java::net::URLClassLoader$Resource * findURLResource(::java::lang::String *);
|
||||
public:
|
||||
virtual ::java::net::URL * findResource(::java::lang::String *);
|
||||
public: // actually package-private
|
||||
virtual ::java::net::URLStreamHandler * getURLStreamHandler(::java::lang::String *);
|
||||
public:
|
||||
virtual ::java::util::Enumeration * findResources(::java::lang::String *);
|
||||
public: // actually protected
|
||||
virtual ::java::security::PermissionCollection * getPermissions(::java::security::CodeSource *);
|
||||
public:
|
||||
virtual JArray< ::java::net::URL * > * getURLs();
|
||||
static ::java::net::URLClassLoader * newInstance(JArray< ::java::net::URL * > *);
|
||||
static ::java::net::URLClassLoader * newInstance(JArray< ::java::net::URL * > *, ::java::lang::ClassLoader *);
|
||||
public: // actually package-private
|
||||
static ::java::lang::Class * access$0(::java::net::URLClassLoader *, ::java::lang::String *, JArray< jbyte > *, jint, jint, ::java::security::CodeSource *);
|
||||
private:
|
||||
static ::java::util::HashMap * urlloaders;
|
||||
static ::java::util::HashMap * factoryCache;
|
||||
::java::util::Vector * __attribute__((aligned(__alignof__( ::java::security::SecureClassLoader)))) urls;
|
||||
::java::util::Vector * urlinfos;
|
||||
::java::net::URLStreamHandlerFactory * factory;
|
||||
::java::security::AccessControlContext * securityContext;
|
||||
::java::lang::String * thisString;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URLClassLoader__
|
||||
@@ -1080,7 +1080,10 @@ public class URLClassLoader extends SecureClassLoader
|
||||
if (resource == null)
|
||||
{
|
||||
String message = className + " not found";
|
||||
if (runtimeInitialized())
|
||||
// Calling this.toString() during VM startup when a
|
||||
// security manager is in force causes the stack to
|
||||
// be unwound before it can properly be decoded.
|
||||
if (Thread.currentThread() != null)
|
||||
message += " in " + this;
|
||||
throw new ClassNotFoundException(message);
|
||||
}
|
||||
@@ -1442,11 +1445,4 @@ public class URLClassLoader extends SecureClassLoader
|
||||
return loader;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell whether runtime initialization is complete.
|
||||
*
|
||||
* @return whether runtime initialization is complete.
|
||||
*/
|
||||
private static native boolean runtimeInitialized();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLConnection__
|
||||
#define __java_net_URLConnection__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class ContentHandler;
|
||||
class ContentHandlerFactory;
|
||||
class FileNameMap;
|
||||
class URL;
|
||||
class URLConnection;
|
||||
}
|
||||
namespace security
|
||||
{
|
||||
class Permission;
|
||||
}
|
||||
namespace text
|
||||
{
|
||||
class ParsePosition;
|
||||
class SimpleDateFormat;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLConnection : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public: // actually protected
|
||||
URLConnection(::java::net::URL *);
|
||||
public:
|
||||
virtual void connect() = 0;
|
||||
virtual ::java::net::URL * getURL();
|
||||
virtual jint getConnectTimeout();
|
||||
virtual void setConnectTimeout(jint);
|
||||
virtual jint getReadTimeout();
|
||||
virtual void setReadTimeout(jint);
|
||||
virtual jint getContentLength();
|
||||
virtual ::java::lang::String * getContentType();
|
||||
virtual ::java::lang::String * getContentEncoding();
|
||||
virtual jlong getExpiration();
|
||||
virtual jlong getDate();
|
||||
virtual jlong getLastModified();
|
||||
virtual ::java::lang::String * getHeaderField(jint);
|
||||
virtual ::java::lang::String * getHeaderField(::java::lang::String *);
|
||||
virtual ::java::util::Map * getHeaderFields();
|
||||
virtual jint getHeaderFieldInt(::java::lang::String *, jint);
|
||||
virtual jlong getHeaderFieldDate(::java::lang::String *, jlong);
|
||||
virtual ::java::lang::String * getHeaderFieldKey(jint);
|
||||
virtual ::java::lang::Object * getContent();
|
||||
virtual ::java::lang::Object * getContent(JArray< ::java::lang::Class * > *);
|
||||
virtual ::java::security::Permission * getPermission();
|
||||
virtual ::java::io::InputStream * getInputStream();
|
||||
virtual ::java::io::OutputStream * getOutputStream();
|
||||
virtual ::java::lang::String * toString();
|
||||
virtual void setDoInput(jboolean);
|
||||
virtual jboolean getDoInput();
|
||||
virtual void setDoOutput(jboolean);
|
||||
virtual jboolean getDoOutput();
|
||||
virtual void setAllowUserInteraction(jboolean);
|
||||
virtual jboolean getAllowUserInteraction();
|
||||
static void setDefaultAllowUserInteraction(jboolean);
|
||||
static jboolean getDefaultAllowUserInteraction();
|
||||
virtual void setUseCaches(jboolean);
|
||||
virtual jboolean getUseCaches();
|
||||
virtual void setIfModifiedSince(jlong);
|
||||
virtual jlong getIfModifiedSince();
|
||||
virtual jboolean getDefaultUseCaches();
|
||||
virtual void setDefaultUseCaches(jboolean);
|
||||
virtual void setRequestProperty(::java::lang::String *, ::java::lang::String *);
|
||||
virtual void addRequestProperty(::java::lang::String *, ::java::lang::String *);
|
||||
virtual ::java::lang::String * getRequestProperty(::java::lang::String *);
|
||||
virtual ::java::util::Map * getRequestProperties();
|
||||
static void setDefaultRequestProperty(::java::lang::String *, ::java::lang::String *);
|
||||
static ::java::lang::String * getDefaultRequestProperty(::java::lang::String *);
|
||||
static void setContentHandlerFactory(::java::net::ContentHandlerFactory *);
|
||||
static ::java::lang::String * guessContentTypeFromName(::java::lang::String *);
|
||||
static ::java::lang::String * guessContentTypeFromStream(::java::io::InputStream *);
|
||||
static ::java::net::FileNameMap * getFileNameMap();
|
||||
static void setFileNameMap(::java::net::FileNameMap *);
|
||||
private:
|
||||
::java::net::ContentHandler * getContentHandler(::java::lang::String *);
|
||||
static void initializeDateFormats();
|
||||
static ::java::net::FileNameMap * fileNameMap;
|
||||
static ::java::net::ContentHandlerFactory * factory;
|
||||
static jboolean defaultAllowUserInteraction;
|
||||
static jboolean defaultUseCaches;
|
||||
static ::java::net::ContentHandlerFactory * defaultFactory;
|
||||
public: // actually protected
|
||||
jboolean __attribute__((aligned(__alignof__( ::java::lang::Object)))) allowUserInteraction;
|
||||
jboolean connected;
|
||||
jboolean doInput;
|
||||
jboolean doOutput;
|
||||
jboolean useCaches;
|
||||
jlong ifModifiedSince;
|
||||
::java::net::URL * url;
|
||||
private:
|
||||
static JArray< ::java::text::SimpleDateFormat * > * dateFormats;
|
||||
static jboolean dateformats_initialized;
|
||||
jint connectTimeout;
|
||||
jint readTimeout;
|
||||
::java::text::ParsePosition * position;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URLConnection__
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLDecoder__
|
||||
#define __java_net_URLDecoder__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URLDecoder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLDecoder : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
URLDecoder();
|
||||
static ::java::lang::String * decode(::java::lang::String *);
|
||||
static ::java::lang::String * decode(::java::lang::String *, ::java::lang::String *);
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URLDecoder__
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLEncoder__
|
||||
#define __java_net_URLEncoder__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URLEncoder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLEncoder : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
static ::java::lang::String * encode(::java::lang::String *);
|
||||
static ::java::lang::String * encode(::java::lang::String *, ::java::lang::String *);
|
||||
private:
|
||||
static jboolean isSafe(jchar);
|
||||
URLEncoder();
|
||||
static ::java::lang::String * hex;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URLEncoder__
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLStreamHandler__
|
||||
#define __java_net_URLStreamHandler__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class InetAddress;
|
||||
class URL;
|
||||
class URLConnection;
|
||||
class URLStreamHandler;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLStreamHandler : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
URLStreamHandler();
|
||||
public: // actually protected
|
||||
virtual ::java::net::URLConnection * openConnection(::java::net::URL *) = 0;
|
||||
virtual void parseURL(::java::net::URL *, ::java::lang::String *, jint, jint);
|
||||
private:
|
||||
static ::java::lang::String * canonicalizeFilename(::java::lang::String *);
|
||||
public: // actually protected
|
||||
virtual jboolean sameFile(::java::net::URL *, ::java::net::URL *);
|
||||
virtual void setURL(::java::net::URL *, ::java::lang::String *, ::java::lang::String *, jint, ::java::lang::String *, ::java::lang::String *);
|
||||
virtual void setURL(::java::net::URL *, ::java::lang::String *, ::java::lang::String *, jint, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
|
||||
virtual jboolean equals(::java::net::URL *, ::java::net::URL *);
|
||||
virtual jboolean hostsEqual(::java::net::URL *, ::java::net::URL *);
|
||||
virtual ::java::net::InetAddress * getHostAddress(::java::net::URL *);
|
||||
virtual jint getDefaultPort();
|
||||
virtual jint hashCode(::java::net::URL *);
|
||||
virtual ::java::lang::String * toExternalForm(::java::net::URL *);
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_URLStreamHandler__
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_URLStreamHandlerFactory__
|
||||
#define __java_net_URLStreamHandlerFactory__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class URLStreamHandler;
|
||||
class URLStreamHandlerFactory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::URLStreamHandlerFactory : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public:
|
||||
virtual ::java::net::URLStreamHandler * createURLStreamHandler(::java::lang::String *) = 0;
|
||||
static ::java::lang::Class class$;
|
||||
} __attribute__ ((java_interface));
|
||||
|
||||
#endif // __java_net_URLStreamHandlerFactory__
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_UnknownHostException__
|
||||
#define __java_net_UnknownHostException__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/io/IOException.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class UnknownHostException;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::UnknownHostException : public ::java::io::IOException
|
||||
{
|
||||
|
||||
public:
|
||||
UnknownHostException();
|
||||
UnknownHostException(::java::lang::String *);
|
||||
private:
|
||||
static const jlong serialVersionUID = -4639126076052875403LL;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_UnknownHostException__
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_UnknownServiceException__
|
||||
#define __java_net_UnknownServiceException__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/io/IOException.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class UnknownServiceException;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::UnknownServiceException : public ::java::io::IOException
|
||||
{
|
||||
|
||||
public:
|
||||
UnknownServiceException();
|
||||
UnknownServiceException(::java::lang::String *);
|
||||
private:
|
||||
static const jlong serialVersionUID = -4169033248853639508LL;
|
||||
public:
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_UnknownServiceException__
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_VMInetAddress__
|
||||
#define __java_net_VMInetAddress__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class VMInetAddress;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::VMInetAddress : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
VMInetAddress();
|
||||
public:
|
||||
static ::java::lang::String * getLocalHostname();
|
||||
static JArray< jbyte > * lookupInaddrAny();
|
||||
static ::java::lang::String * getHostByAddr(JArray< jbyte > *);
|
||||
static JArray< JArray< jbyte > * > * getHostByName(::java::lang::String *);
|
||||
static JArray< jbyte > * aton(::java::lang::String *);
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_VMInetAddress__
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_VMNetworkInterface__
|
||||
#define __java_net_VMNetworkInterface__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class VMNetworkInterface;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::VMNetworkInterface : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
VMNetworkInterface();
|
||||
public:
|
||||
static ::java::util::Vector * getInterfaces();
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_VMNetworkInterface__
|
||||
@@ -0,0 +1,38 @@
|
||||
|
||||
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
|
||||
|
||||
#ifndef __java_net_VMURLConnection__
|
||||
#define __java_net_VMURLConnection__
|
||||
|
||||
#pragma interface
|
||||
|
||||
#include <java/lang/Object.h>
|
||||
#include <gcj/array.h>
|
||||
|
||||
extern "Java"
|
||||
{
|
||||
namespace java
|
||||
{
|
||||
namespace net
|
||||
{
|
||||
class VMURLConnection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class java::net::VMURLConnection : public ::java::lang::Object
|
||||
{
|
||||
|
||||
public: // actually package-private
|
||||
VMURLConnection();
|
||||
private:
|
||||
static void init();
|
||||
static ::java::lang::String * guessContentTypeFromBuffer(JArray< jbyte > *, jint);
|
||||
public: // actually package-private
|
||||
static ::java::lang::String * guessContentTypeFromStream(::java::io::InputStream *);
|
||||
public:
|
||||
static const jint LENGTH = 1024;
|
||||
static ::java::lang::Class class$;
|
||||
};
|
||||
|
||||
#endif // __java_net_VMURLConnection__
|
||||
@@ -47,14 +47,17 @@ final class VMURLConnection
|
||||
{
|
||||
public static final int LENGTH = 1024;
|
||||
|
||||
// private static native void init();
|
||||
|
||||
private static String guessContentTypeFromBuffer(byte[] b, int valid)
|
||||
static
|
||||
{
|
||||
// FIXME - write real implementation
|
||||
return null;
|
||||
if (Configuration.INIT_LOAD_LIBRARY)
|
||||
System.loadLibrary("javanet");
|
||||
init();
|
||||
}
|
||||
|
||||
private static native void init();
|
||||
|
||||
private static native String guessContentTypeFromBuffer(byte[] b, int valid);
|
||||
|
||||
/**
|
||||
* This is called from URLConnection to guess the mime type of a
|
||||
* stream. This method may return null to indicate that it could
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
// natURLClassLoader.cc -- Native part of the URLClassLoader class.
|
||||
|
||||
/* Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <gcj/cni.h>
|
||||
#include <jvm.h>
|
||||
|
||||
#include <java/net/URLClassLoader.h>
|
||||
|
||||
jboolean
|
||||
java::net::URLClassLoader::runtimeInitialized ()
|
||||
{
|
||||
return gcj::runtimeInitialized;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/* Copyright (C) 2006 Free Software Foundation
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <java/net/VMURLConnection.h>
|
||||
#include <gcj/cni.h>
|
||||
#include <java/lang/UnsupportedOperationException.h>
|
||||
|
||||
#if defined (HAVE_MAGIC_H) && defined (HAVE_MAGIC_OPEN)
|
||||
|
||||
#include <magic.h>
|
||||
|
||||
static magic_t cookie;
|
||||
|
||||
#endif /* HAVE_MAGIC_H && HAVE_MAGIC_OPEN */
|
||||
|
||||
void
|
||||
java::net::VMURLConnection::init ()
|
||||
{
|
||||
#if defined (HAVE_MAGIC_H) && defined (HAVE_MAGIC_OPEN)
|
||||
cookie = magic_open (MAGIC_MIME);
|
||||
if (cookie == (magic_t) NULL)
|
||||
return;
|
||||
if (magic_load (cookie, NULL) == -1)
|
||||
{
|
||||
magic_close (cookie);
|
||||
cookie = (magic_t) NULL;
|
||||
}
|
||||
#endif /* HAVE_MAGIC_H && HAVE_MAGIC_OPEN */
|
||||
}
|
||||
|
||||
::java::lang::String *
|
||||
java::net::VMURLConnection::guessContentTypeFromBuffer (jbyteArray bytes,
|
||||
jint valid)
|
||||
{
|
||||
#if defined (HAVE_MAGIC_H) && defined (HAVE_MAGIC_OPEN)
|
||||
const char *result;
|
||||
|
||||
if (cookie == (magic_t) NULL)
|
||||
return NULL;
|
||||
|
||||
result = magic_buffer (cookie, elements(bytes), valid);
|
||||
|
||||
if (result == NULL)
|
||||
return NULL;
|
||||
return _Jv_NewStringUTF (result);
|
||||
#else
|
||||
return NULL;
|
||||
#endif /* HAVE_MAGIC_H && HAVE_MAGIC_OPEN */
|
||||
}
|
||||
Reference in New Issue
Block a user