Commit Graph

24 Commits

Author SHA1 Message Date
Tom Tromey c44cc446f7 natPlainSocketImplPosix.cc (create): Return if already created.
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=233406
	* gnu/java/net/natPlainSocketImplPosix.cc (create): Return if
	already created.
	* gnu/java/net/PlainSocketImpl.java (getLocalAddress): Handle case
	where localport is -1.
	(create): Now public.
	* gnu/java/nio/SocketChannelImpl.java (SocketChannelImpl): Call
	'create' on the socket.

From-SVN: r123440
2007-04-02 22:10:41 +00:00
Tom Tromey 8479d5f123 [multiple changes]
2005-12-26  Anthony Green  <green@redhat.com>

	* gnu/java/nio/SocketChannelImpl.java (read): Compute the right amount
	of data to read (dst.remaining()).
	* gnu/java/nio/DatagramChannelImpl.java (receive): Ditto.

2005-11-11  Mark Wielaard  <mark@klomp.org>

	Reported by john.zigman@anu.edu.au as bug #24608.
	* gnu/java/nio/SocketChannelImpl.java (read): Put readBytes in
	destination ByteBuffer when it doesn't have an array instead of len
	bytes.

From-SVN: r109422
2006-01-06 18:57:36 +00:00
Kelley Cook 917b04f492 Update FSF address
From-SVN: r101453
2005-06-30 03:22:09 +00:00
Michael Koch 392cd098c5 2004-11-22 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/SocketChannelImpl.java
	(read): Made check for blocking un-ambiguous.
	Removed wrong check for data array length.

From-SVN: r91028
2004-11-22 20:32:56 +00:00
Michael Koch 926253eeca 2004-11-21 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/SocketChannelImpl.java
	(read): Only return 0 when no bytes for reading available in
	non-blocking mode.
	* java/nio/channels/SocketChannel.java:
	Added some missing @return tags.

From-SVN: r90986
2004-11-21 20:19:59 +00:00
Tom Tromey 7b68f0bf7e URLStreamHandler.java (toExternalForm): Removed unused variables.
2004-05-03  Tom Tromey  <tromey@redhat.com>

	* java/net/URLStreamHandler.java (toExternalForm): Removed
	unused variables.
	unused constructor.
	* java/math/BigDecimal.java (divide): Removed unused variable.
	* java/lang/Throwable.java: Cleaned up imports.
	* java/lang/ClassLoader.java: Cleaned up imports.
	* java/io/FilePermission.java (implies): Removed unused
	variable.
	* java/awt/TextComponent.java: Removed unused import.
	* gnu/java/util/prefs/NodeReader.java: Cleaned up imports.
	* gnu/java/util/DoubleEnumeration.java: Removed unused import.
	* gnu/java/text/WordBreakIterator.java: Removed unused import.
	* gnu/java/text/SentenceBreakIterator.java: Removed unused
	import.
	* gnu/java/text/LineBreakIterator.java: Removed unused import.
	* gnu/java/text/CharacterBreakIterator.java: Removed
	unused import.
	* gnu/java/security/provider/DSAKeyPairGenerator.java:
	Cleaned up imports.
	* gnu/java/security/der/DERWriter.java: Cleaned up imports.
	* gnu/java/nio/charset/UTF_16Decoder.java (put): Removed
	unused method.
	* gnu/java/nio/SocketChannelImpl.java: Cleaned up imports.
	* gnu/java/nio/FileLockImpl.java: Cleaned up imports.
	* gnu/java/io/Base64InputStream.java: Cleaned up imports.
	* gnu/java/beans/info/ComponentBeanInfo.java: Cleaned up imports.
	* gnu/classpath/ServiceFactory.java: Cleaned up imports.
	(lookupProviders): Removed unused variable.
	(loadNextServiceProvider): Likewise.
	* gnu/java/beans/BeanInfoEmbryo.java: Cleaned up imports.

From-SVN: r81450
2004-05-03 19:52:29 +00:00
Michael Koch 99814868c1 2004-02-05 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/NIOServerSocket.java
	(impl): Unused, removed.
	* gnu/java/nio/SocketChannelImpl.java
	(finnishConnect): Don't throw NoConnectionPendingException if not
	connected or no connection pending.

From-SVN: r77317
2004-02-05 15:57:01 +00:00
Mohan Embar 8696d927c0 * gnu/java/nio/DatagramChannelImpl.java
(inChannelOperation): New field.
	(isInChannelOperation): New accessor.
	(setInChannelOperation): New modifier.
	(receive): Use capacity() - position() of destination
	buffer instead of remaining(). Set and reset our "in
	channel operation indicator" before and after delegating
	the receive to our datagram socket. Removed testing code.
	Update destination buffer's current position if it is
	backed by a byte array (hasArray() is true).
	(send): Set and reset our "in channel operation indicator"
	before and after delegating the send to our datagram socket.
	Removed testing code. Update source buffer's current position
	if it is backed by a byte array (hasArray() is true).
	* gnu/java/nio/SocketChannelImpl.java (read(ByteBuffer)):
	Use capacity() - position() of destination buffer instead
	of remaining().
	* java/net/DatagramSocket.java (receive): Don't throw an
	IllegalBlockingModeException if we have a non-blocking
	channel which initiated this operation.
	(send): Likewise.

From-SVN: r77173
2004-02-03 16:07:24 +00:00
Mohan Embar 7dcc98e25c * gnu/java/net/PlainSocketImpl.java
(inChannelOperation): New field.
	(isInChannelOperation): New accessor.
	(setInChannelOperation): New modifier.
	* gnu/java/nio/ServerSocketChannelImpl.java
	(accept): Set and reset our server socket's PlainSocketImpl's
	"in channel operation" indicator before and after delegating
	the accept to our server socket.
	* gnu/java/nio/SocketChannelImpl.java
	(connect): Set and reset our socket's PlainSocketImpl's "in channel
	operation" indicator before and after delegating the operation to
	our socket.
	(read): Likewise.
	(write): Likewise.
	* java/net/ServerSocket.java (implAccept): Don't throw an
	IllegalBlockingModeException if we have a non-blocking
	channel which initiated this accept operation.
	* java/net/Socket.java (connect): Don't throw an
	IllegalBlockingModeException if we have a non-blocking
	channel which initiated this connect operation.
	* java/nio/channels/spi/AbstractSelectableChannel.java
	(configureBlocking): Only call implConfigureBlocking() if
	the desired blocking mode is different from our current one.

From-SVN: r76956
2004-01-30 13:43:21 +00:00
Michael Koch 26067b8be8 2004-01-07 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/DatagramChannelImpl.java
	(blocking): Removed.
	(DatagramChannelImpl): Call configureBlocking().
	(implConfigureBlocking): Dont initialize blocking.
	* gnu/java/nio/ServerSocketChannelImpl.java
	(blocking): Removed.
	(ServerSocketChannelImpl): Call configureBlocking().
	(implConfigureBlocking): Dont initialize blocking.
	* gnu/java/nio/SocketChannelImpl.java
	(blocking): Removed.
	(SocketChannelImpl): Call configureBlocking().
	(implConfigureBlocking): Dont initialize blocking.
	(connect): Use isBlocking().
	* java/nio/channels/spi/AbstractSelectableChannel.java
	(configureBlocking): Use blockingLock() instead of LOCK.
	Set blocking after successfully called implConfigureBlocking().
	(register): Use blockingLock() instead of LOCK.

From-SVN: r75507
2004-01-07 16:51:49 +00:00
Mohan Embar c1fb3625ae * gnu/java/nio/SocketChannelImpl.java
(write): Removed diagnostic trace.
	* gnu/java/nio/natSelectorImplPosix.cc: Added
	includes for java.lang.Thread and java.io.InterruptedIOException.
	(helper_put_filedescriptors): Don't put invalid file descriptors
	in select set.
	(helper_get_filedescriptors): Clear invalid file descriptors
	from select set.
	(helper_reset): New method for clearing our file descriptor
	array.
	(implSelect): Correctly calculate timeout if specified and
	legal.
	Intercept and deal with any java.io.InterruptedIOException
	thrown by _Jv_select().

From-SVN: r74537
2003-12-11 15:35:13 +00:00
Michael Koch 598e749df6 2003-12-02 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/DatagramChannelImpl.java
	(blocking): Initialize with true by default.
	* gnu/java/nio/ServerSocketChannelImpl.java
	(serverSocket): Made private.
	(blocking): Likewise.
	(connected): Likewise.
	* gnu/java/nio/SocketChannelImpl.java
	(connectionPending): Made private.
	* gnu/java/nio/FileLockImpl.java
	(static): Load native library (needed for classpath).
	* gnu/java/nio/SelectorImpl.java
	(static): Load native library (needed for classpath).

From-SVN: r74181
2003-12-02 15:03:21 +00:00
Michael Koch d3f010ec28 2003-11-22 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/DatagramChannelImpl.java
	(getNativeFD): Use getPlainDatagramSocketImpl().
	* gnu/java/nio/NIODatagramSocket.java
	(getPlainDatagramSocketImpl): Renamed from getImpl().
	* gnu/java/nio/NIOSocket.java
	(getPlainSocketImpl): Renamed from getImpl().
	(setChannel): Use getPlainSocketImpl().
	* gnu/java/nio/SocketChannelImpl.java
	(SocketChannelImpl): Use getPlainSocketImpl().
	(getPlainSocketImpl): Renamed from getImpl().
	(getNativeFD): Use getPlainSocketImpl().

From-SVN: r73840
2003-11-22 15:13:01 +00:00
Michael Koch 51914674f4 NIOSocket.java (setChannel): Initialize impl.
2003-10-11  Michael Koch  <konqueror@gmx.de>

	* gnu/java/nio/NIOSocket.java (setChannel): Initialize impl.
	* gnu/java/nio/ServerSocketChannelImpl.java
	(serverSocket): Made it a NIOServerSocket.
	(impl): Removed.
	(ServerSocketChannelImpl): Initialize only serverSocket.
	(initServerSocket): Removed.
	(getNativeFD): Rewritten.
	(implConfigureBlocking): Set socket timeout and removed comment.
	(accept): Rewritten.
	* gnu/java/nio/SocketChannelImpl.java
	(impl): New variable.
	(connected): Removed.
	(SocketChannelImpl): Initialize impl too.
	(getImpl): New method.
	(isConnected): Rewritten.
	(read): Rewritten, set position in buffer correctly.
	(write): Set position in buffer correctly.
	* java/net/ServerSocket.java (getImpl): New method.
	* gnu/java/nio/NIOServerSocket.java,
	gnu/java/nio/natNIOServerSocket.cc: New files.
	* gnu/java/nio/natServerSocketChannelImpl.cc: Removed.
	* Makefile.am
	(ordinary_java_source_files):
	Added gnu/java/nio/NIOServerSocket.java.
	(nat_source_files):
	Removed gnu/java/nio/natServerSocketChannelImpl.cc
	and added gnu/java/nio/natNIOServerSocket.cc.
	* Makefile.in: Regenerated.

From-SVN: r72345
2003-10-11 18:01:35 +00:00
Michael Koch 36805693cb 2003-10-08 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/SocketChannelImpl.java
	(read): Write only read data to buffer.

From-SVN: r72232
2003-10-08 16:03:06 +00:00
Michael Koch 1bfb64ff9a 2003-09-25 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/DatagramChannelImpl.java
	(getNativeFD): New method.
	* gnu/java/nio/SelectionKeyImpl.java
	(SelectionKeyImpl): Class made abstract.
	(fd): Removed.
	(SelectionKeyImpl): Remove fd argument.
	(getNativeFD): New method.
	* gnu/java/nio/SocketChannelImpl.java
	(getNativeFD): New method.
	gnu/java/nio/DatagramChannelSelectionKey.java,
	* gnu/java/nio/SocketChannelSelectionKey.java:
	New files.
	* Makefile.am (ordinary_java_source_files):
	Added new files gnu/java/nio/DatagramChannelSelectionKey.java and
	gnu/java/nio/SocketChannelSelectionKey.java.
	* Makefile.in: Regenerated.

From-SVN: r71797
2003-09-25 21:14:43 +00:00
Michael Koch 21e69789dd 2003-09-25 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/DatagramChannelImpl.java
	(DatagramChannelImpl): Made class final.
	(blocking): Made private.
	(socket): Made it a NIODatagramSocket and private.
	(DatagramChannelImpl): create NIODatagramSocket instead of
	DatagramSocket.
	(implConfigureBlocking): Set socket timeout.
	(connect): Check that channel is not closed.
	(write): Implemented.
	(write): Rewritten.
	(read): Implemented.
	(read): Rewritten.
	(receive): Implemented.
	(send): Implemented.
	* gnu/java/nio/SelectionKeyImpl.java
	(readyOps): Made private.
	(interestOps): Made private.
	(impl): Made private.
	(ch): Made private.
	(readyOps): Check if selection key is valid.
	(interestOps): Likewise.
	* gnu/java/nio/SelectorImpl.java
	(closed): Removed.
	(keys): Made private.
	(selected): Made private.
	(finalize): New method.
	(implCloseSelector): Rewritten.
	(keys): Return unmodifiable Set.
	(deregisterCancelledKeys): Fixed typo in method name.
	* gnu/java/nio/SocketChannelImpl.java
	(SocketChannelImpl): Made class final.
	(socket): Made it a NIOSocket and private.
	(blocking): Made private.
	(connected): Made private.
	(connectionPending): New member variable.
	(SocketChannelImpl): New implementation.
	(finalizer): Use isConnected().
	(connect): Rewritten.
	(finishConnect): Throws IOException, implemented.
	(isConnectionPending): Return connectionPending.
	(read): Rewritten.
	(write): Rewritten.
	* gnu/java/nio/NIOConstants.java: New file.
	* Makefile.am (ordinary_java_source_files):
	Added gnu/java/nio/NIOConstants.java.
	* Makefile.in: Regenerated.

From-SVN: r71769
2003-09-25 10:17:00 +00:00
Michael Koch 98a91a724e 2003-06-19 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/DatagramChannelImpl.java
	(fd): Removed.
	(blocking): New member variable.
	(socket): Likewise.
	(DatagramChannelImpl): Throws IOException, initialize socket.
	(socket):Implemented.
	(implCloseSelectableChannel): Throws IOException, implemented.
	(implConfigureBlocking): Likewise.
	(connect): Likewise.
	(disconnect): Likewise.
	(isConnected): Likewise.
	(write): Likewise.
	(read): Likewise.
	(receive): Throws IOException.
	(send): Likewise.
	* gnu/java/nio/SocketChannelImpl.java
	(read): Implemented.
	(write): Implemented.

From-SVN: r68208
2003-06-19 16:42:25 +00:00
Michael Koch 299f5809e2 2003-06-18 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/SelectorImpl.java
	(register): Use fd with value 0 for now, will be fixed later.
	* gnu/java/nio/ServerSocketChannelImpl.java
	(fd): Removed.
	(local_port): Removed.
	(InetSocketAddress): Removed.
	(ServerSocketChannelImpl): Just initialize internal socket object.
	(implCloseSelectableChannel): Close internal socket object.
	(implConfigureBlocking): Added comment.
	(accept): Use jaba.net stuff to accept socket.
	* gnu/java/nio/SocketChannelImpl.java
	(fd): Removed.
	(local_port): Removed.
	(InetSocketAddress): Removed.
	(SocketCreate): Removed.
	(SocketConnect): Removed.
	(SocketBind): Removed.
	(SocketListen): Removed.
	(SocketAvailable): Removed.
	(SocketClose): Removed.
	(SocketRead): Removed.
	(SocketWrite): Removed.
	(SocketChannelImpl): Just initialize internal socket object.
	(implCloseSelectableChannel): Close internal socket object.
	(implConfigureBlocking): Fixed implementation, added comment.
	(connect): Use internal socket object to connect.
	(socket): No need for sanity checks.
	(read): Comment out some stuff, this will be reimplemented in the next
	commit.
	(write): Likewise.
	* gnu/java/nio/natFileChannelImpl.cc
	(nio_mmap_file): Line wrapped.
	* gnu/java/nio/natSocketChannelImpl.cc: Removed.
	* Makefile.am
	(nat_source_files): Removeded gnu/java/nio/natSocketChannelImpl.cc.
	* Makefile.in: Regenerated.

From-SVN: r68145
2003-06-18 08:56:55 +00:00
Michael Koch 81d2d258f5 2003-06-14 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/FileChannelImpl.java
        (map_address): Removed incorrect comment.
	* gnu/java/nio/SelectorImpl.java
        (register): Remove code duplication and code for file channel handling.
	* gnu/java/nio/ServerSocketChannelImpl.java
        (serverSocket): Renamed from sock_object.
        (ServerSocketChannel): Initialize serverSocket.
        (socket): Return serverSocket.
	* gnu/java/nio/SocketChannelImpl.java
        (socket): Renamed from sock_object.
        (isConnectionPenging): Simplified.
        (socket): Return socket.

From-SVN: r67940
2003-06-14 11:53:02 +00:00
Michael Koch 3a5eb28322 ByteBufferImpl.java, [...]: Moved files to java/nio.
2003-05-20  Michael Koch  <konqueror@gmx.de>

	* gnu/java/nio/ByteBufferImpl.java,
	gnu/java/nio/CharBufferImpl.java,
	gnu/java/nio/CharViewBufferImpl.java,
	gnu/java/nio/DirectByteBufferImpl.java,
	gnu/java/nio/DoubleBufferImpl.java,
	gnu/java/nio/DoubleViewBufferImpl.java,
	gnu/java/nio/FloatBufferImpl.java,
	gnu/java/nio/FloatViewBufferImpl.java,
	gnu/java/nio/IntBufferImpl.java,
	gnu/java/nio/IntViewBufferImpl.java,
	gnu/java/nio/LongBufferImpl.java,
	gnu/java/nio/LongViewBufferImpl.java,
	gnu/java/nio/natDirectByteBufferImpl.cc,
	gnu/java/nio/ShortBufferImpl.java,
	gnu/java/nio/ShortViewBufferImpl.java:
	Moved files to java/nio.
	* gnu/java/nio/SocketChannelImpl.java

	* java/nio/ByteBuffer.java,
	java/nio/CharBuffer.java,
	java/nio/DoubleBuffer.java,
	java/nio/FloatBuffer.java,
	java/nio/IntBuffer.java,
	java/nio/LongBuffer.java,
	java/nio/ShortBuffer.java:
	Dont import anything.
	* java/nio/ByteBufferImpl.java,
	java/nio/CharBufferImpl.java,
	java/nio/CharViewBufferImpl.java,
	java/nio/DirectByteBufferImpl.java,
	java/nio/DoubleBufferImpl.java,
	java/nio/DoubleViewBufferImpl.java,
	java/nio/FloatBufferImpl.java,
	java/nio/FloatViewBufferImpl.java,
	java/nio/IntBufferImpl.java,
	java/nio/IntViewBufferImpl.java,
	java/nio/LongBufferImpl.java,
	java/nio/LongViewBufferImpl.java,
	java/nio/natDirectByteBufferImpl.cc,
	java/nio/ShortBufferImpl.java,
	java/nio/ShortViewBufferImpl.java:
	Moved from gnu/java/nio.
	* Makefile.am
	(ordinary_java_source_files): Moved files from gnu/java/nio to
	java/nio.
	(nat_source_files): Moved natDirectByteBufferImpl.cc from gnu/java/nio
	to java/nio.
	* Makefile.in: Regenerated.

From-SVN: r66990
2003-05-20 08:58:31 +00:00
Michael Koch cc1b3d6b64 2003-05-14 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/FileLockImpl.java
	(released): New member variable.
	(FileLockImpl): Initialize released.
	(releaseImpl): New native method.
	(release): Implemented.
	* gnu/java/nio/SelectorImpl.java: Reformatted.
	* gnu/java/nio/SelectionKeyImpl.java: Reformatted.
	* gnu/java/nio/ServerSocketChannelImpl.java: Reformatted.
	(accept): Throws IOException.
	* gnu/java/nio/SocketChannelImpl.java: Reformatted.
	(implConfigureBlocking): Throws IOException.
	(connect): Likewise.
	(read): Likewise.
	(write): Likewise.
	* gnu/java/nio/natFileLockImpl.cc: New file.
	* java/nio/channels/FileLock.java: Reformatted.
	* Makefile.am:
	(ordinary_java_source_files): Added gnu/java/nio/FileLockImpl.java.
	(nat_source_files): Added gnu/java/nio/natFileLockImpl.cc.
	* Makefile.in: Regenerated.

From-SVN: r66799
2003-05-14 06:37:59 +00:00
Michael Koch a4536c7a94 2002-11-29 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/DatagramChannelImpl:
	(fd): New member variable to store file descriptor of socket.
	* gnu/java/nio/SelectionKeyImpl.java:
	(ops): Removed.
	(readyOps): New member variable.
	(interestOps): New member variable.
	(readyOps): Implemented.
	(readyOps): New method to set member variable readyOps.
	(interestOps): Replaced ops by interestOps.
	* gnu/java/nio/SelectorImpl.java:
	(SelectorImpl): Initialize key sets.
	(select): Call select with -1 instead of Long.MAX_VALUE).
	(java_do_select): Make it a native method.
	(getFDsAsArray): New helper method.
	(select): Remove canceled keys, give only interested file discriptors
	to java_do_select, set ready ops.
	(add): No need to initialize keys set here.
	(add_selected): No need to initialize selected set here.
	(deregisterCanceledKeys): New helper method.
	(register): Set interest ops, set attachments, added handling of datagram
	channels.
	* gnu/java/nio/ServerSocketChannelImpl:
	(SocketAccept): Renamed from NioSocketAccept.
	(implConfigureBlocking): Implemented.
	(accept): Use SocketAccept instead of NioSocketAccept.
	* gnu/java/nio/SocketChannelImpl:
	Reactivate native methods.

From-SVN: r59632
2002-11-29 09:57:05 +00:00
Michael Koch 48f5b6723a ByteBufferImpl.java, [...]: New files.
2002-11-18  Michael Koch <konqueror@gmx.de>

	* gnu/java/nio/ByteBufferImpl.java,
	gnu/java/nio/CharBufferImpl.java,
	gnu/java/nio/DatagramChannelImpl.java,
	gnu/java/nio/DoubleBufferImpl.java,
	gnu/java/nio/FileChannelImpl.java,
	gnu/java/nio/FloatBufferImpl.java,
	gnu/java/nio/IntBufferImpl.java,
	gnu/java/nio/LongBufferImpl.java,
	gnu/java/nio/PipeImpl.java,
	gnu/java/nio/SelectionKeyImpl.java,
	gnu/java/nio/SelectorImpl.java,
	gnu/java/nio/SelectorProviderImpl.java,
	gnu/java/nio/ServerSocketChannelImpl.java,
	gnu/java/nio/ShortBufferImpl.java,
	gnu/java/nio/SocketChannelImpl.java,
	java/nio/DoubleBuffer.java,
	java/nio/FloatBuffer.java,
	java/nio/IntBuffer.java,
	java/nio/LongBuffer.java,
	java/nio/ShortBuffer.java,
	java/nio/channels/FileChannel.java: New files.

From-SVN: r59216
2002-11-18 13:56:59 +00:00