[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: VMChannels merge

Kaffe CVS cvs-commits at kaffe.org
Thu Jan 13 03:21:23 PST 2005


PatchSet 5853 
Date: 2005/01/13 11:16:29
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: VMChannels merge

2005-01-13  Dalibor Topic  <robilad at kaffe.org>

Resynced with GNU Classpath.

2005-01-12  Michael Koch  <konqueror at gmx.de>

* java/nio/channels/Channels.java
(newInputStream(ReadableByteChannel)):
Call VMChannels.newInputStream(ReadableByteChannel).
(newOutputStream(WritableByteChannel):
Call VMChannels.newOutputStream(WritableByteChannel).
(newInputStream(FileChannelImpl)): Removed.
(newOutputStream(FileChannelImpl)): Likewise.
* vm/reference/java/nio/channels/VMChannels.java: Nw file.
* native/jni/java-nio/Makefile.am:
* native/jni/java-nio/java_nio_channels_Channels.c,
include/java_nio_channels_Channels.h: Removed.
* include/Makefile.am: Don't generate java_nio_channels_Channels.h.
Removed java_nio_channels_Channels.c.

Members: 
	ChangeLog:1.3397->1.3398 
	include/Makefile.am:1.84->1.85 
	include/Makefile.in:1.204->1.205 
	libraries/clib/nio/Channels.c:1.1->1.2(DEAD) 
	libraries/clib/nio/Makefile.am:1.9->1.10 
	libraries/clib/nio/Makefile.in:1.57->1.58 
	libraries/javalib/Makefile.am:1.293->1.294 
	libraries/javalib/Makefile.in:1.375->1.376 
	libraries/javalib/all.files:1.72->1.73 
	libraries/javalib/java/nio/channels/Channels.java:1.8->1.9 
	libraries/javalib/java/nio/channels/VMChannels.java:INITIAL->1.1 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3397 kaffe/ChangeLog:1.3398
--- kaffe/ChangeLog:1.3397	Thu Jan 13 09:10:23 2005
+++ kaffe/ChangeLog	Thu Jan 13 11:16:29 2005
@@ -4,6 +4,26 @@
 	
 	2005-01-12  Michael Koch  <konqueror at gmx.de>
 
+	* java/nio/channels/Channels.java
+	(newInputStream(ReadableByteChannel)):
+	Call VMChannels.newInputStream(ReadableByteChannel).
+	(newOutputStream(WritableByteChannel):
+	Call VMChannels.newOutputStream(WritableByteChannel).
+	(newInputStream(FileChannelImpl)): Removed.
+	(newOutputStream(FileChannelImpl)): Likewise.
+	* vm/reference/java/nio/channels/VMChannels.java: Nw file.
+	* native/jni/java-nio/Makefile.am:
+	* native/jni/java-nio/java_nio_channels_Channels.c,
+	include/java_nio_channels_Channels.h: Removed.
+	* include/Makefile.am: Don't generate java_nio_channels_Channels.h.
+	Removed java_nio_channels_Channels.c.
+	
+2005-01-13  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+	
+	2005-01-12  Michael Koch  <konqueror at gmx.de>
+
 	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
 	(Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetVisible):
 	Removed setting of gdk_env.
Index: kaffe/include/Makefile.am
diff -u kaffe/include/Makefile.am:1.84 kaffe/include/Makefile.am:1.85
--- kaffe/include/Makefile.am:1.84	Thu Jan 13 08:02:16 2005
+++ kaffe/include/Makefile.am	Thu Jan 13 11:16:33 2005
@@ -111,7 +111,6 @@
 	gnu_java_nio_SelectorImpl.h \
 	java_io_ObjectInputStream.h \
 	java_io_VMObjectStreamClass.h \
-	java_nio_channels_Channels.h \
 	java_nio_VMDirectByteBuffer.h \
 	java_nio_MappedByteBufferImpl.h \
 	kaffe_io_ByteToCharDefault.h \
Index: kaffe/include/Makefile.in
diff -u kaffe/include/Makefile.in:1.204 kaffe/include/Makefile.in:1.205
--- kaffe/include/Makefile.in:1.204	Thu Jan 13 08:02:16 2005
+++ kaffe/include/Makefile.in	Thu Jan 13 11:16:33 2005
@@ -468,7 +468,6 @@
 	gnu_java_nio_SelectorImpl.h \
 	java_io_ObjectInputStream.h \
 	java_io_VMObjectStreamClass.h \
-	java_nio_channels_Channels.h \
 	java_nio_VMDirectByteBuffer.h \
 	java_nio_MappedByteBufferImpl.h \
 	kaffe_io_ByteToCharDefault.h \
===================================================================
Checking out kaffe/libraries/clib/nio/Channels.c
RCS:  /home/cvs/kaffe/kaffe/libraries/clib/nio/Attic/Channels.c,v
VERS: 1.1
***************
--- kaffe/libraries/clib/nio/Channels.c	Thu Jan 13 11:21:22 2005
+++ /dev/null	Sun Aug  4 19:57:58 2002
@@ -1,46 +0,0 @@
-/*
- * DirectByteBufferImpl.c
- *
- * Copyright (c) 2003, 2004 The Kaffe.org's team.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file.
- */
- 
-#include "config.h"
-#include "config-std.h"
-#include "java_nio_channels_Channels.h"
-
-jobject JNICALL
-Java_java_nio_channels_Channels_newInputStream(JNIEnv *env, jclass clazz UNUSED, jobject channelimpl)
-{
-  jclass fileinputstream_class;
-  jmethodID file_constructor;
-
-  fileinputstream_class = (*env)->FindClass(env, "java.io.FileInputStream");  
-  if (fileinputstream_class == NULL)
-    return NULL;
-  
-  file_constructor = (*env)->GetMethodID(env, fileinputstream_class, "<init>", "(Lgnu/java/nio/channels/FileChannelImpl;)V");
-  if (file_constructor == NULL)
-    return NULL;
-
-  return (*env)->NewObject(env, fileinputstream_class, file_constructor, channelimpl);
-}
-
-jobject JNICALL
-Java_java_nio_channels_Channels_newOutputStream(JNIEnv *env, jclass clazz UNUSED, jobject channelimpl)
-{
-  jclass fileoutputstream_class;
-  jmethodID file_constructor;
-
-  fileoutputstream_class = (*env)->FindClass(env, "java.io.FileOutputStream");  
-  if (fileoutputstream_class == NULL)
-    return NULL;
-  
-  file_constructor = (*env)->GetMethodID(env, fileoutputstream_class, "<init>", "(Lgnu/java/nio/channels/FileChannelImpl;)V");
-  if (file_constructor == NULL)
-    return NULL;
-
-  return (*env)->NewObject(env, fileoutputstream_class, file_constructor, channelimpl);
-}
Index: kaffe/libraries/clib/nio/Makefile.am
diff -u kaffe/libraries/clib/nio/Makefile.am:1.9 kaffe/libraries/clib/nio/Makefile.am:1.10
--- kaffe/libraries/clib/nio/Makefile.am:1.9	Thu Dec  2 22:30:49 2004
+++ kaffe/libraries/clib/nio/Makefile.am	Thu Jan 13 11:16:34 2005
@@ -24,8 +24,7 @@
 libnio_la_SOURCES = \
 	java_nio_VMDirectByteBuffer.c \
 	SelectorImpl.c \
-	FileChannelImpl.c \
-	Channels.c
+	FileChannelImpl.c
 
 libnio_la_DEPENDENCIES = \
         $(top_builddir)/libraries/clib/classpath/libclasspath.la
Index: kaffe/libraries/clib/nio/Makefile.in
diff -u kaffe/libraries/clib/nio/Makefile.in:1.57 kaffe/libraries/clib/nio/Makefile.in:1.58
--- kaffe/libraries/clib/nio/Makefile.in:1.57	Wed Dec 22 19:05:21 2004
+++ kaffe/libraries/clib/nio/Makefile.in	Thu Jan 13 11:16:34 2005
@@ -89,8 +89,7 @@
 am__DEPENDENCIES_1 =  \
 	$(top_builddir)/libraries/clib/classpath/libclasspath.la
 am_libnio_la_OBJECTS = libnio_la-java_nio_VMDirectByteBuffer.lo \
-	libnio_la-SelectorImpl.lo libnio_la-FileChannelImpl.lo \
-	libnio_la-Channels.lo
+	libnio_la-SelectorImpl.lo libnio_la-FileChannelImpl.lo
 libnio_la_OBJECTS = $(am_libnio_la_OBJECTS)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/config -I$(top_builddir)/include/kaffe
 depcomp = $(SHELL) $(top_srcdir)/scripts/depcomp
@@ -396,8 +395,7 @@
 libnio_la_SOURCES = \
 	java_nio_VMDirectByteBuffer.c \
 	SelectorImpl.c \
-	FileChannelImpl.c \
-	Channels.c
+	FileChannelImpl.c
 
 libnio_la_DEPENDENCIES = \
         $(top_builddir)/libraries/clib/classpath/libclasspath.la
@@ -475,7 +473,6 @@
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnio_la-Channels.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnio_la-FileChannelImpl.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnio_la-SelectorImpl.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnio_la-java_nio_VMDirectByteBuffer.Plo at am__quote@
@@ -521,13 +518,6 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='FileChannelImpl.c' object='libnio_la-FileChannelImpl.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnio_la_CFLAGS) $(CFLAGS) -c -o libnio_la-FileChannelImpl.lo `test -f 'FileChannelImpl.c' || echo '$(srcdir)/'`FileChannelImpl.c
-
-libnio_la-Channels.lo: Channels.c
- at am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnio_la_CFLAGS) $(CFLAGS) -MT libnio_la-Channels.lo -MD -MP -MF "$(DEPDIR)/libnio_la-Channels.Tpo" -c -o libnio_la-Channels.lo `test -f 'Channels.c' || echo '$(srcdir)/'`Channels.c; \
- at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libnio_la-Channels.Tpo" "$(DEPDIR)/libnio_la-Channels.Plo"; else rm -f "$(DEPDIR)/libnio_la-Channels.Tpo"; exit 1; fi
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='Channels.c' object='libnio_la-Channels.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnio_la_CFLAGS) $(CFLAGS) -c -o libnio_la-Channels.lo `test -f 'Channels.c' || echo '$(srcdir)/'`Channels.c
 
 mostlyclean-libtool:
 	-rm -f *.lo
Index: kaffe/libraries/javalib/Makefile.am
diff -u kaffe/libraries/javalib/Makefile.am:1.293 kaffe/libraries/javalib/Makefile.am:1.294
--- kaffe/libraries/javalib/Makefile.am:1.293	Thu Jan 13 08:02:18 2005
+++ kaffe/libraries/javalib/Makefile.am	Thu Jan 13 11:16:34 2005
@@ -2518,6 +2518,7 @@
 	java/nio/channels/SocketChannel.java \
 	java/nio/channels/UnresolvedAddressException.java \
 	java/nio/channels/UnsupportedAddressTypeException.java \
+	java/nio/channels/VMChannels.java \
 	java/nio/channels/WritableByteChannel.java
 java_nio_channels_spi_SRCS = \
 	java/nio/channels/spi/AbstractInterruptibleChannel.java \
Index: kaffe/libraries/javalib/Makefile.in
diff -u kaffe/libraries/javalib/Makefile.in:1.375 kaffe/libraries/javalib/Makefile.in:1.376
--- kaffe/libraries/javalib/Makefile.in:1.375	Thu Jan 13 08:02:20 2005
+++ kaffe/libraries/javalib/Makefile.in	Thu Jan 13 11:16:35 2005
@@ -3005,6 +3005,7 @@
 	java/nio/channels/SocketChannel.java \
 	java/nio/channels/UnresolvedAddressException.java \
 	java/nio/channels/UnsupportedAddressTypeException.java \
+	java/nio/channels/VMChannels.java \
 	java/nio/channels/WritableByteChannel.java
 
 java_nio_channels_spi_SRCS = \
Index: kaffe/libraries/javalib/all.files
diff -u kaffe/libraries/javalib/all.files:1.72 kaffe/libraries/javalib/all.files:1.73
--- kaffe/libraries/javalib/all.files:1.72	Thu Jan 13 08:02:22 2005
+++ kaffe/libraries/javalib/all.files	Thu Jan 13 11:16:38 2005
@@ -2050,6 +2050,7 @@
 java/nio/channels/SocketChannel.java
 java/nio/channels/UnresolvedAddressException.java
 java/nio/channels/UnsupportedAddressTypeException.java
+java/nio/channels/VMChannels.java
 java/nio/channels/WritableByteChannel.java
 java/nio/channels/spi/AbstractInterruptibleChannel.java
 java/nio/channels/spi/AbstractSelectableChannel.java
Index: kaffe/libraries/javalib/java/nio/channels/Channels.java
diff -u kaffe/libraries/javalib/java/nio/channels/Channels.java:1.8 kaffe/libraries/javalib/java/nio/channels/Channels.java:1.9
--- kaffe/libraries/javalib/java/nio/channels/Channels.java:1.8	Wed Nov 24 03:20:38 2004
+++ kaffe/libraries/javalib/java/nio/channels/Channels.java	Thu Jan 13 11:16:38 2005
@@ -1,5 +1,5 @@
 /* Channels.java --
-   Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -35,16 +35,12 @@
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
+
 package java.nio.channels;
 
-import gnu.java.nio.ChannelInputStream;
-import gnu.java.nio.ChannelOutputStream;
 import gnu.java.nio.InputStreamChannel;
 import gnu.java.nio.OutputStreamChannel;
-import gnu.java.nio.channels.FileChannelImpl;
 
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.Reader;
@@ -62,16 +58,17 @@
   /**
    * This class isn't intended to be instantiated.
    */
-  private Channels() {}
+  private Channels()
+  {
+    // Do nothing here.
+  }
 
   /**
    * Constructs a stream that reads bytes from the given channel.
    */
   public static InputStream newInputStream(ReadableByteChannel ch)
   {
-    if (ch instanceof FileChannelImpl)
-      return newInputStream((FileChannelImpl) ch);
-    return new ChannelInputStream(ch);
+    return VMChannels.newInputStream(ch);
   }
 
   /**
@@ -79,14 +76,8 @@
    */
   public static OutputStream newOutputStream(WritableByteChannel ch)
   {
-    if (ch instanceof FileChannelImpl)
-      return newOutputStream((FileChannelImpl) ch);
-    return new ChannelOutputStream(ch);
+    return VMChannels.newOutputStream(ch);
   }
-
-  static native FileInputStream newInputStream(FileChannelImpl ch);
-
-  static native FileOutputStream newOutputStream(FileChannelImpl ch);
 
   /**
    * Constructs a channel that reads bytes from the given stream.
===================================================================
Checking out kaffe/libraries/javalib/java/nio/channels/VMChannels.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/java/nio/channels/VMChannels.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/java/nio/channels/VMChannels.java	Thu Jan 13 11:21:23 2005
@@ -0,0 +1,116 @@
+/* VMChannels.java --
+   Copyright (C) 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., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 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.nio.channels;
+
+import gnu.java.nio.ChannelInputStream;
+import gnu.java.nio.ChannelOutputStream;
+import gnu.java.nio.channels.FileChannelImpl;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+public final class VMChannels
+{
+  /**
+   * This class isn't intended to be instantiated.
+   */
+  private VMChannels()
+  {
+    // Do nothing here.
+  }
+
+  private static Object createStream(Class streamClass, Channel ch)
+  {
+    try
+      {
+	Class[] argTypes = new Class[1];
+	argTypes[0] = FileChannelImpl.class;
+	Constructor constructor =
+	  streamClass.getDeclaredConstructor(argTypes);
+	constructor.setAccessible(true);
+	Object[] args = new Object[1];
+	args[0] = ch;
+	return constructor.newInstance(args);
+      }
+    catch (IllegalAccessException e)
+      {
+	// Ignored.
+      }
+    catch (InstantiationException e)
+      {
+	// Ignored.
+      }
+    catch (InvocationTargetException e)
+      {
+	// Ignored.
+      }
+    catch (NoSuchMethodException e)
+      {
+	// Ignored.
+      }
+
+    return null;
+  }
+  
+  /**
+   * Constructs a stream that reads bytes from the given channel.
+   */
+  public static InputStream newInputStream(ReadableByteChannel ch)
+  {
+    if (ch instanceof FileChannelImpl)
+      return (FileInputStream) createStream(FileInputStream.class, ch);
+    
+    return  new ChannelInputStream(ch);
+  }
+
+  /**
+   * Constructs a stream that writes bytes to the given channel.
+   */
+  public static OutputStream newOutputStream(WritableByteChannel ch)
+  {
+    if (ch instanceof FileChannelImpl)
+      return (FileOutputStream) createStream(FileOutputStream.class, ch);
+    
+    return new ChannelOutputStream(ch);
+  }
+}



More information about the kaffe mailing list