2005-07-16 00:30:23 +00:00
|
|
|
/* DataFlavor.java -- A type of data to transfer via the clipboard.
|
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
2006-08-14 23:12:35 +00:00
|
|
|
Copyright (C) 1999, 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
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.awt.datatransfer;
|
|
|
|
|
configure: Regenerate.
2006-06-13 Thomas Fitzsimmons <fitzsim@redhat.com>
* configure: Regenerate.
* Makefile.in: Regenerate.
* configure.ac (--enable-plugin): New option.
(ac_configure_args): Add --enable-tool-wrappers.
(ac_configure_args): Add --disable-plugin unless --enable-plugin
was specified.
* gcj/Makefile.in: Regenerate.
* sources.am (gnu_java_net_source_files): Add
classpath/gnu/java/net/IndexListParser.java.
(property_files): Remove
classpath/resource/gnu/classpath/tools/jarsigner/MessageBundle.properties,
classpath/resource/gnu/classpath/tools/keytool/MessageBundle.properties.
Add
classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties,
classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties,
classpath/resource/gnu/classpath/tools/getopt/Messages.properties,
classpath/resource/gnu/classpath/tools/jar/messages.properties,
classpath/resource/gnu/classpath/tools/jarsigner/messages.properties,
classpath/resource/gnu/classpath/tools/keytool/messages.properties,
classpath/resource/gnu/classpath/tools/native2ascii/messages.properties,
classpath/resource/gnu/classpath/tools/serialver/messages.properties.
* classpath/Makefile.in: Regenerate.
* classpath/native/jni/gtk-peer/cairographics2d.h,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c:
Merge from GNU Classpath.
* classpath/native/Makefile.in: Regenerate.
* classpath/native/jawt/Makefile.in: Regenerate.
* classpath/native/jawt/Makefile.am: Install libjawt.so in GCJ's
versioned library directory.
* classpath/native/Makefile.am: Add plugin directory if
--enable-plugin was specified.
* classpath/native/plugin/Makefile.in: Regenerate. *
classpath/native/plugin/Makefile.am: Install libgcjwebplugin.so in
GCJ's versioned library directory.
* classpath/resource/gnu/classpath/tools/native2ascii/messages.properties:
New file.
* classpath/resource/gnu/classpath/tools/getopt/Messages.properties:
Likewise.
* classpath/resource/gnu/classpath/tools/jarsigner/messages.properties:
Likewise.
* classpath/resource/gnu/classpath/tools/jarsigner/MessageBundle.properties:
Remove file.
* classpath/resource/gnu/classpath/tools/keytool/messages.properties:
New file.
* classpath/resource/gnu/classpath/tools/keytool/MessageBundle.properties:
Remove file.
* classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties:
New file.
* classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties:
Likewise.
* classpath/resource/gnu/classpath/tools/jar/messages.properties:
Likewise.
* classpath/resource/gnu/classpath/tools/serialver/messages.properties:
Likewise.
* classpath/gnu/java/net/IndexListParser.java:
Likewise.
* classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java,
classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,
classpath/gnu/java/awt/peer/gtk/CairoSurface.java,
classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java,
classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java,
classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java,
classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java,
classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java,
classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java,
classpath/gnu/java/awt/peer/gtk/GtkVolatileImage.java,
classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java,
classpath/gnu/java/awt/java2d/PolyEdge.java,
classpath/gnu/java/awt/java2d/AbstractGraphics2D.java: Merge from
GNU Classpath.
* classpath/tools/toolwrapper.c: Replace tools.zip reference with
libgcj-tools-4.2.0.jar.
* classpath/tools/Makefile.in: Regenerate.
* classpath/tools/Makefile.am: Rename tools.zip to
libgcj-tools-4.2.0.jar. Install libgcj-tools-4.2.0.jar in
$(datadir)/java.
* classpath/javax/swing/JTabbedPane.java,
classpath/javax/swing/text/DefaultStyledDocument.java,
classpath/javax/swing/text/html/HTMLDocument.java,
classpath/javax/swing/text/GapContent.java,
classpath/javax/swing/JComponent.java,
classpath/javax/swing/RepaintManager.java,
classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java,
classpath/javax/swing/plaf/basic/BasicScrollBarUI.java,
classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java,
classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java,
classpath/javax/swing/plaf/basic/BasicLookAndFeel.java,
classpath/javax/swing/plaf/metal/MetalButtonUI.java,
classpath/java/text/Bidi.java,
classpath/java/awt/image/BufferedImage.java,
classpath/java/awt/datatransfer/DataFlavor.java,
classpath/java/awt/geom/AffineTransform.java,
classpath/java/awt/dnd/DropTargetDropEvent.java,
classpath/java/awt/dnd/DropTargetContext.java,
classpath/java/awt/font/TextLayout.java,
classpath/include/gnu_java_awt_peer_gtk_ComponentGraphics.h,
classpath/include/gnu_java_awt_peer_gtk_CairoGraphics2D.h,
classpath/include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h,
classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h,
classpath/include/gnu_java_awt_peer_gtk_GtkVolatileImage.h,
classpath/include/gnu_java_awt_peer_gtk_CairoSurface.h: Merge from
GNU Classpath.
* classpath/include/gnu_java_awt_peer_gtk_GdkGraphics.h,
classpath/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c,
classpath/native/jni/gtk-peer/gtkcairopeer.h,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c:
Remove files.
* classpath/Makefile.am (SUBDIRS, DIST_SUBDIRS): Include tools
directory.
* include/Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
From-SVN: r114633
2006-06-14 03:38:34 +00:00
|
|
|
import gnu.classpath.NotImplementedException;
|
|
|
|
|
2005-07-16 00:30:23 +00:00
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.InputStreamReader;
|
|
|
|
import java.io.ObjectInput;
|
|
|
|
import java.io.ObjectOutput;
|
|
|
|
import java.io.Reader;
|
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
2006-08-14 23:12:35 +00:00
|
|
|
import java.io.Serializable;
|
2005-07-16 00:30:23 +00:00
|
|
|
import java.io.StringReader;
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
import java.nio.ByteBuffer;
|
|
|
|
import java.nio.CharBuffer;
|
2006-01-17 18:09:40 +00:00
|
|
|
import java.nio.charset.Charset;
|
2005-09-23 21:31:04 +00:00
|
|
|
import java.rmi.Remote;
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This class represents a particular data format used for transferring
|
|
|
|
* data via the clipboard.
|
|
|
|
*
|
|
|
|
* @author Aaron M. Renn (arenn@urbanophile.com)
|
|
|
|
*/
|
|
|
|
public class DataFlavor implements java.io.Externalizable, Cloneable
|
|
|
|
{
|
|
|
|
static final long serialVersionUID = 8367026044764648243L;
|
|
|
|
|
|
|
|
// FIXME: Serialization: Need to write methods for.
|
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* This is the data flavor used for tranferring plain text. The MIME
|
|
|
|
* type is "text/plain; charset=unicode". The representation class
|
|
|
|
* is <code>java.io.InputStream</code>.
|
|
|
|
*
|
|
|
|
* @deprecated The charset unicode is platform specific and InputStream
|
|
|
|
* deals with bytes not chars. Use <code>getRederForText()</code>.
|
|
|
|
*/
|
|
|
|
public static final DataFlavor plainTextFlavor =
|
|
|
|
new DataFlavor(java.io.InputStream.class,
|
|
|
|
"text/plain; charset=unicode",
|
|
|
|
"plain unicode text");
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* This is the data flavor used for transferring Java strings. The
|
|
|
|
* MIME type is "application/x-java-serialized-object" and the
|
|
|
|
* representation class is <code>java.lang.String</code>.
|
|
|
|
*/
|
|
|
|
public static final DataFlavor stringFlavor =
|
|
|
|
new DataFlavor(java.lang.String.class, "Java Unicode String");
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* This is a data flavor used for transferring lists of files. The
|
|
|
|
* representation type is a <code>java.util.List</code>, with each
|
|
|
|
* element of the list being a <code>java.io.File</code>.
|
|
|
|
*/
|
|
|
|
public static final DataFlavor javaFileListFlavor =
|
|
|
|
new DataFlavor(java.util.List.class,
|
|
|
|
"application/x-java-file-list; class=java.util.List",
|
|
|
|
"Java File List");
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* This is an image flavor used for transferring images. The
|
|
|
|
* representation type is a <code>java.awt.Image</code>.
|
|
|
|
*/
|
|
|
|
public static final DataFlavor imageFlavor =
|
|
|
|
new DataFlavor(java.awt.Image.class, "Java Image");
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* This is the MIME type used for transferring a serialized object.
|
|
|
|
* The representation class is the type of object be deserialized.
|
|
|
|
*/
|
|
|
|
public static final String javaSerializedObjectMimeType =
|
|
|
|
"application/x-java-serialized-object";
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* This is the MIME type used to transfer a Java object reference within
|
|
|
|
* the same JVM. The representation class is the class of the object
|
|
|
|
* being transferred.
|
|
|
|
*/
|
|
|
|
public static final String javaJVMLocalObjectMimeType =
|
|
|
|
"application/x-java-jvm-local-objectref";
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* This is the MIME type used to transfer a link to a remote object.
|
|
|
|
* The representation class is the type of object being linked to.
|
|
|
|
*/
|
|
|
|
public static final String javaRemoteObjectMimeType =
|
|
|
|
"application/x-java-remote-object";
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
/*
|
2006-01-17 18:09:40 +00:00
|
|
|
* Instance Variables
|
|
|
|
*/
|
|
|
|
|
|
|
|
// The MIME type for this flavor
|
|
|
|
private final String mimeType;
|
|
|
|
|
|
|
|
// The representation class for this flavor
|
|
|
|
private final Class representationClass;
|
|
|
|
|
|
|
|
// The human readable name of this flavor
|
|
|
|
private String humanPresentableName;
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
/*
|
2006-01-17 18:09:40 +00:00
|
|
|
* Static Methods
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method attempts to load the named class. The following class
|
|
|
|
* loaders are searched in order: the bootstrap class loader, the
|
|
|
|
* system class loader, the context class loader (if it exists), and
|
|
|
|
* the specified fallback class loader.
|
|
|
|
*
|
|
|
|
* @param className The name of the class to load.
|
|
|
|
* @param classLoader The class loader to use if all others fail, which
|
|
|
|
* may be <code>null</code>.
|
|
|
|
*
|
|
|
|
* @exception ClassNotFoundException If the class cannot be loaded.
|
|
|
|
*/
|
|
|
|
protected static final Class tryToLoadClass(String className,
|
|
|
|
ClassLoader classLoader)
|
|
|
|
throws ClassNotFoundException
|
|
|
|
{
|
2006-03-10 21:46:48 +00:00
|
|
|
// Bootstrap
|
2006-01-17 18:09:40 +00:00
|
|
|
try
|
|
|
|
{
|
2006-03-10 21:46:48 +00:00
|
|
|
return Class.forName(className);
|
2006-01-17 18:09:40 +00:00
|
|
|
}
|
2006-03-10 21:46:48 +00:00
|
|
|
catch(ClassNotFoundException cnfe)
|
2006-01-17 18:09:40 +00:00
|
|
|
{
|
2006-03-10 21:46:48 +00:00
|
|
|
// Ignored.
|
2006-01-17 18:09:40 +00:00
|
|
|
}
|
|
|
|
|
2006-03-10 21:46:48 +00:00
|
|
|
// System
|
2006-01-17 18:09:40 +00:00
|
|
|
try
|
|
|
|
{
|
2006-03-10 21:46:48 +00:00
|
|
|
ClassLoader loader = ClassLoader.getSystemClassLoader();
|
|
|
|
return Class.forName(className, true, loader);
|
2006-01-17 18:09:40 +00:00
|
|
|
}
|
2006-03-10 21:46:48 +00:00
|
|
|
catch(ClassNotFoundException cnfe)
|
|
|
|
{
|
|
|
|
// Ignored.
|
|
|
|
}
|
|
|
|
|
|
|
|
// Context
|
2006-01-17 18:09:40 +00:00
|
|
|
try
|
|
|
|
{
|
2006-03-10 21:46:48 +00:00
|
|
|
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
|
|
|
return Class.forName(className, true, loader);
|
2006-01-17 18:09:40 +00:00
|
|
|
}
|
2006-03-10 21:46:48 +00:00
|
|
|
catch(ClassNotFoundException cnfe)
|
|
|
|
{
|
|
|
|
// Ignored.
|
|
|
|
}
|
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
if (classLoader != null)
|
2006-03-10 21:46:48 +00:00
|
|
|
return Class.forName(className, true, classLoader);
|
|
|
|
|
|
|
|
throw new ClassNotFoundException(className);
|
2006-01-17 18:09:40 +00:00
|
|
|
}
|
|
|
|
|
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
2006-08-14 23:12:35 +00:00
|
|
|
private static Class getRepresentationClassFromMimeThrows(String mimeString,
|
2006-01-17 18:09:40 +00:00
|
|
|
ClassLoader classLoader)
|
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
2006-08-14 23:12:35 +00:00
|
|
|
throws ClassNotFoundException
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
2006-01-17 18:09:40 +00:00
|
|
|
String classname = getParameter("class", mimeString);
|
|
|
|
if (classname != null)
|
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
2006-08-14 23:12:35 +00:00
|
|
|
return tryToLoadClass(classname, classLoader);
|
2006-01-17 18:09:40 +00:00
|
|
|
else
|
|
|
|
return java.io.InputStream.class;
|
2005-07-16 00:30:23 +00:00
|
|
|
}
|
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
2006-08-14 23:12:35 +00:00
|
|
|
|
|
|
|
// Same as above, but wraps any ClassNotFoundExceptions
|
|
|
|
private static Class getRepresentationClassFromMime(String mimeString,
|
|
|
|
ClassLoader classLoader)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
return getRepresentationClassFromMimeThrows(mimeString, classLoader);
|
|
|
|
}
|
|
|
|
catch(ClassNotFoundException cnfe)
|
|
|
|
{
|
|
|
|
IllegalArgumentException iae;
|
|
|
|
iae = new IllegalArgumentException("mimeString: "
|
|
|
|
+ mimeString
|
|
|
|
+ " classLoader: "
|
|
|
|
+ classLoader);
|
|
|
|
iae.initCause(cnfe);
|
|
|
|
throw iae;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Returns the value of the named MIME type parameter, or <code>null</code>
|
|
|
|
* if the parameter does not exist. Given the parameter name and the mime
|
|
|
|
* string.
|
|
|
|
*
|
|
|
|
* @param paramName The name of the parameter.
|
|
|
|
* @param mimeString The mime string from where the name should be found.
|
|
|
|
*
|
|
|
|
* @return The value of the parameter or null.
|
|
|
|
*/
|
|
|
|
private static String getParameter(String paramName, String mimeString)
|
|
|
|
{
|
|
|
|
int idx = mimeString.indexOf(paramName + "=");
|
|
|
|
if (idx == -1)
|
|
|
|
return(null);
|
|
|
|
|
|
|
|
String value = mimeString.substring(idx + paramName.length() + 1);
|
|
|
|
|
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
2006-08-14 23:12:35 +00:00
|
|
|
idx = value.indexOf(";");
|
2006-01-17 18:09:40 +00:00
|
|
|
if (idx == -1)
|
|
|
|
return(value);
|
|
|
|
else
|
|
|
|
return(value.substring(0, idx));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* XXX - Currently returns <code>plainTextFlavor</code>.
|
|
|
|
*/
|
|
|
|
public static final DataFlavor getTextPlainUnicodeFlavor()
|
|
|
|
{
|
|
|
|
return plainTextFlavor;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Selects the best supported text flavor on this implementation.
|
|
|
|
* Returns <code>null</code> when none of the given flavors is liked.
|
|
|
|
*
|
|
|
|
* The <code>DataFlavor</code> returned the first data flavor in the
|
|
|
|
* array that has either a representation class which is (a subclass of)
|
|
|
|
* <code>Reader</code> or <code>String</code>, or has a representation
|
|
|
|
* class which is (a subclass of) <code>InputStream</code> and has a
|
|
|
|
* primary MIME type of "text" and has an supported encoding.
|
|
|
|
*/
|
|
|
|
public static final DataFlavor
|
|
|
|
selectBestTextFlavor(DataFlavor[] availableFlavors)
|
|
|
|
{
|
|
|
|
for(int i = 0; i < availableFlavors.length; i++)
|
|
|
|
{
|
|
|
|
DataFlavor df = availableFlavors[i];
|
|
|
|
Class c = df.representationClass;
|
|
|
|
|
|
|
|
// A Reader or String is good.
|
|
|
|
if ((Reader.class.isAssignableFrom(c))
|
|
|
|
|| (String.class.isAssignableFrom(c)))
|
|
|
|
return df;
|
|
|
|
|
|
|
|
// A InputStream is good if the mime primary type is "text"
|
|
|
|
if ((InputStream.class.isAssignableFrom(c))
|
|
|
|
&& ("text".equals(df.getPrimaryType())))
|
|
|
|
{
|
|
|
|
String encoding = availableFlavors[i].getParameter("charset");
|
|
|
|
if (encoding == null)
|
|
|
|
encoding = "us-ascii";
|
|
|
|
Reader r = null;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
// Try to construct a dummy reader with the found encoding
|
|
|
|
r = new InputStreamReader
|
|
|
|
(new ByteArrayInputStream(new byte[0]), encoding);
|
|
|
|
}
|
|
|
|
catch(UnsupportedEncodingException uee) { /* ignore */ }
|
|
|
|
|
|
|
|
if (r != null)
|
|
|
|
return df;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Nothing found
|
|
|
|
return null;
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/*
|
|
|
|
* Constructors
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Empty public constructor needed for externalization.
|
|
|
|
* Should not be used for normal instantiation.
|
|
|
|
*/
|
|
|
|
public DataFlavor()
|
|
|
|
{
|
2005-07-16 00:30:23 +00:00
|
|
|
mimeType = null;
|
|
|
|
representationClass = null;
|
|
|
|
humanPresentableName = null;
|
2006-01-17 18:09:40 +00:00
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Private constructor.
|
|
|
|
*/
|
|
|
|
private DataFlavor(Class representationClass,
|
|
|
|
String mimeType,
|
|
|
|
String humanPresentableName)
|
|
|
|
{
|
2005-07-16 00:30:23 +00:00
|
|
|
this.representationClass = representationClass;
|
|
|
|
this.mimeType = mimeType;
|
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
2006-08-14 23:12:35 +00:00
|
|
|
|
|
|
|
// Do some simple validity checks
|
|
|
|
String type = getPrimaryType() + "/" + getSubType();
|
|
|
|
if (type.indexOf(' ') != -1
|
|
|
|
|| type.indexOf('=') != -1
|
|
|
|
|| type.indexOf(';') != -1)
|
|
|
|
throw new IllegalArgumentException(mimeType);
|
|
|
|
|
2005-07-16 00:30:23 +00:00
|
|
|
if (humanPresentableName != null)
|
2006-01-17 18:09:40 +00:00
|
|
|
this.humanPresentableName = humanPresentableName;
|
2005-07-16 00:30:23 +00:00
|
|
|
else
|
2006-01-17 18:09:40 +00:00
|
|
|
this.humanPresentableName = mimeType;
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Initializes a new instance of <code>DataFlavor</code>. The class
|
|
|
|
* and human readable name are specified, the MIME type will be
|
|
|
|
* "application/x-java-serialized-object". If the human readable name
|
|
|
|
* is not specified (<code>null</code>) then the human readable name
|
|
|
|
* will be the same as the MIME type.
|
|
|
|
*
|
|
|
|
* @param representationClass The representation class for this object.
|
|
|
|
* @param humanPresentableName The display name of the object.
|
|
|
|
*/
|
|
|
|
public DataFlavor(Class representationClass, String humanPresentableName)
|
|
|
|
{
|
2005-07-16 00:30:23 +00:00
|
|
|
this(representationClass,
|
2006-01-17 18:09:40 +00:00
|
|
|
"application/x-java-serialized-object"
|
|
|
|
+ "; class="
|
|
|
|
+ representationClass.getName(),
|
|
|
|
humanPresentableName);
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Initializes a new instance of <code>DataFlavor</code> with the
|
|
|
|
* specified MIME type and description. If the MIME type has a
|
|
|
|
* "class=<rep class>" parameter then the representation class will
|
|
|
|
* be the class name specified. Otherwise the class defaults to
|
|
|
|
* <code>java.io.InputStream</code>. If the human readable name
|
|
|
|
* is not specified (<code>null</code>) then the human readable name
|
|
|
|
* will be the same as the MIME type.
|
|
|
|
*
|
|
|
|
* @param mimeType The MIME type for this flavor.
|
|
|
|
* @param humanPresentableName The display name of this flavor.
|
|
|
|
* @param classLoader The class loader for finding classes if the default
|
|
|
|
* class loaders do not work.
|
|
|
|
*
|
|
|
|
* @exception IllegalArgumentException If the representation class
|
|
|
|
* specified cannot be loaded.
|
|
|
|
* @exception ClassNotFoundException If the class is not loaded.
|
|
|
|
*/
|
|
|
|
public DataFlavor(String mimeType, String humanPresentableName,
|
|
|
|
ClassLoader classLoader)
|
|
|
|
throws ClassNotFoundException
|
|
|
|
{
|
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
2006-08-14 23:12:35 +00:00
|
|
|
this(getRepresentationClassFromMimeThrows(mimeType, classLoader),
|
2006-01-17 18:09:40 +00:00
|
|
|
mimeType, humanPresentableName);
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Initializes a new instance of <code>DataFlavor</code> with the
|
|
|
|
* specified MIME type and description. If the MIME type has a
|
|
|
|
* "class=<rep class>" parameter then the representation class will
|
|
|
|
* be the class name specified. Otherwise the class defaults to
|
|
|
|
* <code>java.io.InputStream</code>. If the human readable name
|
|
|
|
* is not specified (<code>null</code>) then the human readable name
|
|
|
|
* will be the same as the MIME type. This is the same as calling
|
|
|
|
* <code>new DataFlavor(mimeType, humanPresentableName, null)</code>.
|
|
|
|
*
|
|
|
|
* @param mimeType The MIME type for this flavor.
|
|
|
|
* @param humanPresentableName The display name of this flavor.
|
|
|
|
*
|
|
|
|
* @exception IllegalArgumentException If the representation class
|
|
|
|
* specified cannot be loaded.
|
|
|
|
*/
|
|
|
|
public DataFlavor(String mimeType, String humanPresentableName)
|
|
|
|
{
|
|
|
|
this(getRepresentationClassFromMime (mimeType, null),
|
|
|
|
mimeType, humanPresentableName);
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Initializes a new instance of <code>DataFlavor</code> with the specified
|
|
|
|
* MIME type. This type can have a "class=" parameter to specify the
|
|
|
|
* representation class, and then the class must exist or an exception will
|
|
|
|
* be thrown. If there is no "class=" parameter then the representation class
|
|
|
|
* will be <code>java.io.InputStream</code>. This is the same as calling
|
|
|
|
* <code>new DataFlavor(mimeType, null)</code>.
|
|
|
|
*
|
|
|
|
* @param mimeType The MIME type for this flavor.
|
|
|
|
*
|
|
|
|
* @exception IllegalArgumentException If a class is not specified in
|
|
|
|
* the MIME type.
|
|
|
|
* @exception ClassNotFoundException If the class cannot be loaded.
|
|
|
|
*/
|
|
|
|
public DataFlavor(String mimeType) throws ClassNotFoundException
|
|
|
|
{
|
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
2006-08-14 23:12:35 +00:00
|
|
|
this(getRepresentationClassFromMimeThrows(mimeType, null),
|
|
|
|
mimeType, null);
|
2006-01-17 18:09:40 +00:00
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Returns the MIME type of this flavor.
|
|
|
|
*
|
|
|
|
* @return The MIME type for this flavor.
|
|
|
|
*/
|
|
|
|
public String getMimeType()
|
|
|
|
{
|
|
|
|
return(mimeType);
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Returns the representation class for this flavor.
|
|
|
|
*
|
|
|
|
* @return The representation class for this flavor.
|
|
|
|
*/
|
|
|
|
public Class getRepresentationClass()
|
|
|
|
{
|
|
|
|
return(representationClass);
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Returns the human presentable name for this flavor.
|
|
|
|
*
|
|
|
|
* @return The human presentable name for this flavor.
|
|
|
|
*/
|
|
|
|
public String getHumanPresentableName()
|
|
|
|
{
|
|
|
|
return(humanPresentableName);
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Returns the primary MIME type for this flavor.
|
|
|
|
*
|
|
|
|
* @return The primary MIME type for this flavor.
|
|
|
|
*/
|
|
|
|
public String getPrimaryType()
|
|
|
|
{
|
|
|
|
int idx = mimeType.indexOf("/");
|
|
|
|
if (idx == -1)
|
|
|
|
return(mimeType);
|
|
|
|
|
|
|
|
return(mimeType.substring(0, idx));
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Returns the MIME subtype for this flavor.
|
|
|
|
*
|
|
|
|
* @return The MIME subtype for this flavor.
|
|
|
|
*/
|
|
|
|
public String getSubType()
|
|
|
|
{
|
|
|
|
int start = mimeType.indexOf("/");
|
|
|
|
if (start == -1)
|
|
|
|
return "";
|
|
|
|
|
|
|
|
int end = mimeType.indexOf(";", start + 1);
|
|
|
|
if (end == -1)
|
|
|
|
return mimeType.substring(start + 1);
|
|
|
|
else
|
|
|
|
return mimeType.substring(start + 1, end);
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Returns the value of the named MIME type parameter, or <code>null</code>
|
|
|
|
* if the parameter does not exist.
|
|
|
|
*
|
|
|
|
* @param paramName The name of the paramter.
|
|
|
|
*
|
|
|
|
* @return The value of the parameter.
|
|
|
|
*/
|
|
|
|
public String getParameter(String paramName)
|
|
|
|
{
|
|
|
|
if ("humanPresentableName".equals(paramName))
|
|
|
|
return getHumanPresentableName();
|
|
|
|
|
|
|
|
return getParameter(paramName, mimeType);
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Sets the human presentable name to the specified value.
|
|
|
|
*
|
|
|
|
* @param humanPresentableName The new display name.
|
|
|
|
*/
|
|
|
|
public void setHumanPresentableName(String humanPresentableName)
|
|
|
|
{
|
|
|
|
this.humanPresentableName = humanPresentableName;
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Tests the MIME type of this object for equality against the specified
|
|
|
|
* MIME type. Ignores parameters.
|
|
|
|
*
|
|
|
|
* @param mimeType The MIME type to test against.
|
|
|
|
*
|
|
|
|
* @return <code>true</code> if the MIME type is equal to this object's
|
|
|
|
* MIME type (ignoring parameters), <code>false</code> otherwise.
|
|
|
|
*
|
|
|
|
* @exception NullPointerException If mimeType is null.
|
|
|
|
*/
|
|
|
|
public boolean isMimeTypeEqual(String mimeType)
|
|
|
|
{
|
|
|
|
String mime = getMimeType();
|
|
|
|
int i = mime.indexOf(";");
|
|
|
|
if (i != -1)
|
|
|
|
mime = mime.substring(0, i);
|
|
|
|
|
|
|
|
i = mimeType.indexOf(";");
|
|
|
|
if (i != -1)
|
|
|
|
mimeType = mimeType.substring(0, i);
|
|
|
|
|
|
|
|
return mime.equals(mimeType);
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Tests the MIME type of this object for equality against the specified
|
|
|
|
* data flavor's MIME type
|
|
|
|
*
|
|
|
|
* @param flavor The flavor to test against.
|
|
|
|
*
|
|
|
|
* @return <code>true</code> if the flavor's MIME type is equal to this
|
|
|
|
* object's MIME type, <code>false</code> otherwise.
|
|
|
|
*/
|
|
|
|
public final boolean isMimeTypeEqual(DataFlavor flavor)
|
|
|
|
{
|
|
|
|
return isMimeTypeEqual(flavor.getMimeType());
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Tests whether or not this flavor represents a serialized object.
|
|
|
|
*
|
|
|
|
* @return <code>true</code> if this flavor represents a serialized
|
|
|
|
* object, <code>false</code> otherwise.
|
|
|
|
*/
|
|
|
|
public boolean isMimeTypeSerializedObject()
|
|
|
|
{
|
|
|
|
return mimeType.startsWith(javaSerializedObjectMimeType);
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Tests whether or not this flavor has a representation class of
|
|
|
|
* <code>java.io.InputStream</code>.
|
|
|
|
*
|
|
|
|
* @return <code>true</code> if the representation class of this flavor
|
|
|
|
* is <code>java.io.InputStream</code>, <code>false</code> otherwise.
|
|
|
|
*/
|
|
|
|
public boolean isRepresentationClassInputStream()
|
|
|
|
{
|
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
2006-08-14 23:12:35 +00:00
|
|
|
return InputStream.class.isAssignableFrom(representationClass);
|
2006-01-17 18:09:40 +00:00
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Tests whether the representation class for this flavor is
|
|
|
|
* serializable.
|
|
|
|
*
|
|
|
|
* @return <code>true</code> if the representation class is serializable,
|
|
|
|
* <code>false</code> otherwise.
|
|
|
|
*/
|
|
|
|
public boolean isRepresentationClassSerializable()
|
|
|
|
{
|
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
2006-08-14 23:12:35 +00:00
|
|
|
return Serializable.class.isAssignableFrom(representationClass);
|
2006-01-17 18:09:40 +00:00
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Tests whether the representation class for his flavor is remote.
|
|
|
|
*
|
|
|
|
* @return <code>true</code> if the representation class is remote,
|
|
|
|
* <code>false</code> otherwise.
|
|
|
|
*/
|
|
|
|
public boolean isRepresentationClassRemote()
|
|
|
|
{
|
|
|
|
return Remote.class.isAssignableFrom (representationClass);
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Tests whether or not this flavor represents a serialized object.
|
|
|
|
*
|
|
|
|
* @return <code>true</code> if this flavor represents a serialized
|
|
|
|
* object, <code>false</code> otherwise.
|
|
|
|
*/
|
|
|
|
public boolean isFlavorSerializedObjectType()
|
|
|
|
{
|
|
|
|
// FIXME: What is the diff between this and isMimeTypeSerializedObject?
|
|
|
|
return(mimeType.startsWith(javaSerializedObjectMimeType));
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Tests whether or not this flavor represents a remote object.
|
|
|
|
*
|
|
|
|
* @return <code>true</code> if this flavor represents a remote object,
|
|
|
|
* <code>false</code> otherwise.
|
|
|
|
*/
|
|
|
|
public boolean isFlavorRemoteObjectType()
|
|
|
|
{
|
|
|
|
return(mimeType.startsWith(javaRemoteObjectMimeType));
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Tests whether or not this flavor represents a list of files.
|
|
|
|
*
|
|
|
|
* @return <code>true</code> if this flavor represents a list of files,
|
|
|
|
* <code>false</code> otherwise.
|
|
|
|
*/
|
|
|
|
public boolean isFlavorJavaFileListType()
|
|
|
|
{
|
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
2006-08-14 23:12:35 +00:00
|
|
|
if (getPrimaryType().equals(javaFileListFlavor.getPrimaryType())
|
|
|
|
&& getSubType().equals(javaFileListFlavor.getSubType())
|
|
|
|
&& javaFileListFlavor.representationClass
|
|
|
|
.isAssignableFrom(representationClass))
|
2006-01-17 18:09:40 +00:00
|
|
|
return true;
|
|
|
|
|
|
|
|
return false ;
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Returns a copy of this object.
|
|
|
|
*
|
|
|
|
* @return A copy of this object.
|
|
|
|
*
|
|
|
|
* @exception CloneNotSupportedException If the object's class does not support
|
|
|
|
* the Cloneable interface. Subclasses that override the clone method can also
|
|
|
|
* throw this exception to indicate that an instance cannot be cloned.
|
|
|
|
*/
|
|
|
|
public Object clone () throws CloneNotSupportedException
|
|
|
|
{
|
|
|
|
// FIXME - This cannot be right.
|
|
|
|
try
|
|
|
|
{
|
|
|
|
return super.clone();
|
|
|
|
}
|
|
|
|
catch(Exception e)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* This method test the specified <code>DataFlavor</code> for equality
|
|
|
|
* against this object. This will be true if the MIME type and
|
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
2006-08-14 23:12:35 +00:00
|
|
|
* representation class are the equal. If the primary type is 'text'
|
|
|
|
* then also the value of the charset parameter is compared. In such a
|
|
|
|
* case when the charset parameter isn't given then the charset is
|
|
|
|
* assumed to be equal to the default charset of the platform. All
|
|
|
|
* other parameters are ignored.
|
2006-01-17 18:09:40 +00:00
|
|
|
*
|
|
|
|
* @param flavor The <code>DataFlavor</code> to test against.
|
|
|
|
*
|
|
|
|
* @return <code>true</code> if the flavor is equal to this object,
|
|
|
|
* <code>false</code> otherwise.
|
|
|
|
*/
|
|
|
|
public boolean equals(DataFlavor flavor)
|
|
|
|
{
|
|
|
|
if (flavor == null)
|
|
|
|
return false;
|
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
2006-08-14 23:12:35 +00:00
|
|
|
|
|
|
|
String primary = getPrimaryType();
|
|
|
|
if (! primary.equals(flavor.getPrimaryType()))
|
2006-01-17 18:09:40 +00:00
|
|
|
return false;
|
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
2006-08-14 23:12:35 +00:00
|
|
|
|
|
|
|
String sub = getSubType();
|
|
|
|
if (! sub.equals(flavor.getSubType()))
|
|
|
|
return false;
|
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
if (! this.representationClass.equals(flavor.representationClass))
|
|
|
|
return false;
|
Imported GNU Classpath 0.92
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92
* HACKING: Add more importing hints. Update automake version
requirement.
* configure.ac (gconf-peer): New enable AC argument.
Add --disable-gconf-peer and --enable-default-preferences-peer
to classpath configure when gconf is disabled.
* scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
gnu/java/awt/dnd/peer/gtk to bc. Classify
gnu/java/security/Configuration.java as generated source file.
* gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
gnu/java/lang/management/VMThreadMXBeanImpl.java,
gnu/java/lang/management/VMMemoryMXBeanImpl.java,
gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
classes.
* java/lang/management/VMManagementFactory.java: Likewise.
* java/net/VMURLConnection.java: Likewise.
* gnu/java/nio/VMChannel.java: Likewise.
* java/lang/Thread.java (getState): Add stub implementation.
* java/lang/Class.java (isEnum): Likewise.
* java/lang/Class.h (isEnum): Likewise.
* gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.
* javax/naming/spi/NamingManager.java: New override for StackWalker
functionality.
* configure, sources.am, Makefile.in, gcj/Makefile.in,
include/Makefile.in, testsuite/Makefile.in: Regenerated.
From-SVN: r116139
2006-08-14 23:12:35 +00:00
|
|
|
|
|
|
|
if (primary.equals("text"))
|
|
|
|
if (! isRepresentationClassCharBuffer()
|
|
|
|
&& ! isRepresentationClassReader()
|
|
|
|
&& representationClass != java.lang.String.class
|
|
|
|
&& ! (representationClass.isArray()
|
|
|
|
&& representationClass.getComponentType() == Character.TYPE))
|
|
|
|
{
|
|
|
|
String charset = getParameter("charset");
|
|
|
|
String otherset = flavor.getParameter("charset");
|
|
|
|
String defaultset = Charset.defaultCharset().name();
|
|
|
|
|
|
|
|
if (charset == null || charset.equals(defaultset))
|
|
|
|
return (otherset == null || otherset.equals(defaultset));
|
|
|
|
|
|
|
|
return charset.equals(otherset);
|
|
|
|
}
|
2006-01-17 18:09:40 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* This method test the specified <code>Object</code> for equality
|
|
|
|
* against this object. This will be true if the following conditions
|
|
|
|
* are met:
|
|
|
|
* <p>
|
|
|
|
* <ul>
|
|
|
|
* <li>The object is not <code>null</code>.</li>
|
|
|
|
* <li>The object is an instance of <code>DataFlavor</code>.</li>
|
|
|
|
* <li>The object's MIME type and representation class are equal to
|
|
|
|
* this object's.</li>
|
|
|
|
* </ul>
|
|
|
|
*
|
|
|
|
* @param obj The <code>Object</code> to test against.
|
|
|
|
*
|
|
|
|
* @return <code>true</code> if the flavor is equal to this object,
|
|
|
|
* <code>false</code> otherwise.
|
|
|
|
*/
|
|
|
|
public boolean equals(Object obj)
|
|
|
|
{
|
|
|
|
if (! (obj instanceof DataFlavor))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return equals((DataFlavor) obj);
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Tests whether or not the specified string is equal to the MIME type
|
|
|
|
* of this object.
|
|
|
|
*
|
|
|
|
* @param str The string to test against.
|
|
|
|
*
|
|
|
|
* @return <code>true</code> if the string is equal to this object's MIME
|
|
|
|
* type, <code>false</code> otherwise.
|
|
|
|
*
|
|
|
|
* @deprecated Not compatible with <code>hashCode()</code>.
|
|
|
|
* Use <code>isMimeTypeEqual()</code>
|
|
|
|
*/
|
|
|
|
public boolean equals(String str)
|
|
|
|
{
|
|
|
|
return isMimeTypeEqual(str);
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Returns the hash code for this data flavor.
|
|
|
|
* The hash code is based on the (lower case) mime type and the
|
|
|
|
* representation class.
|
|
|
|
*/
|
|
|
|
public int hashCode()
|
|
|
|
{
|
|
|
|
return mimeType.toLowerCase().hashCode() ^ representationClass.hashCode();
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Returns <code>true</code> when the given <code>DataFlavor</code>
|
|
|
|
* matches this one.
|
|
|
|
*/
|
|
|
|
public boolean match(DataFlavor dataFlavor)
|
|
|
|
{
|
|
|
|
// XXX - How is this different from equals?
|
|
|
|
return equals(dataFlavor);
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* This method exists for backward compatibility. It simply returns
|
|
|
|
* the same name/value pair passed in.
|
|
|
|
*
|
|
|
|
* @param name The parameter name.
|
|
|
|
* @param value The parameter value.
|
|
|
|
*
|
|
|
|
* @return The name/value pair.
|
|
|
|
*
|
|
|
|
* @deprecated
|
|
|
|
*/
|
|
|
|
protected String normalizeMimeTypeParameter(String name, String value)
|
|
|
|
{
|
|
|
|
return name + "=" + value;
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* This method exists for backward compatibility. It simply returns
|
|
|
|
* the MIME type string unchanged.
|
|
|
|
*
|
|
|
|
* @param type The MIME type.
|
|
|
|
*
|
|
|
|
* @return The MIME type.
|
|
|
|
*
|
|
|
|
* @deprecated
|
|
|
|
*/
|
|
|
|
protected String normalizeMimeType(String type)
|
|
|
|
{
|
|
|
|
return type;
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Serialize this class.
|
|
|
|
*
|
|
|
|
* @param stream The <code>ObjectOutput</code> stream to serialize to.
|
|
|
|
*
|
|
|
|
* @exception IOException If an error occurs.
|
|
|
|
*/
|
configure: Regenerate.
2006-06-13 Thomas Fitzsimmons <fitzsim@redhat.com>
* configure: Regenerate.
* Makefile.in: Regenerate.
* configure.ac (--enable-plugin): New option.
(ac_configure_args): Add --enable-tool-wrappers.
(ac_configure_args): Add --disable-plugin unless --enable-plugin
was specified.
* gcj/Makefile.in: Regenerate.
* sources.am (gnu_java_net_source_files): Add
classpath/gnu/java/net/IndexListParser.java.
(property_files): Remove
classpath/resource/gnu/classpath/tools/jarsigner/MessageBundle.properties,
classpath/resource/gnu/classpath/tools/keytool/MessageBundle.properties.
Add
classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties,
classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties,
classpath/resource/gnu/classpath/tools/getopt/Messages.properties,
classpath/resource/gnu/classpath/tools/jar/messages.properties,
classpath/resource/gnu/classpath/tools/jarsigner/messages.properties,
classpath/resource/gnu/classpath/tools/keytool/messages.properties,
classpath/resource/gnu/classpath/tools/native2ascii/messages.properties,
classpath/resource/gnu/classpath/tools/serialver/messages.properties.
* classpath/Makefile.in: Regenerate.
* classpath/native/jni/gtk-peer/cairographics2d.h,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c:
Merge from GNU Classpath.
* classpath/native/Makefile.in: Regenerate.
* classpath/native/jawt/Makefile.in: Regenerate.
* classpath/native/jawt/Makefile.am: Install libjawt.so in GCJ's
versioned library directory.
* classpath/native/Makefile.am: Add plugin directory if
--enable-plugin was specified.
* classpath/native/plugin/Makefile.in: Regenerate. *
classpath/native/plugin/Makefile.am: Install libgcjwebplugin.so in
GCJ's versioned library directory.
* classpath/resource/gnu/classpath/tools/native2ascii/messages.properties:
New file.
* classpath/resource/gnu/classpath/tools/getopt/Messages.properties:
Likewise.
* classpath/resource/gnu/classpath/tools/jarsigner/messages.properties:
Likewise.
* classpath/resource/gnu/classpath/tools/jarsigner/MessageBundle.properties:
Remove file.
* classpath/resource/gnu/classpath/tools/keytool/messages.properties:
New file.
* classpath/resource/gnu/classpath/tools/keytool/MessageBundle.properties:
Remove file.
* classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties:
New file.
* classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties:
Likewise.
* classpath/resource/gnu/classpath/tools/jar/messages.properties:
Likewise.
* classpath/resource/gnu/classpath/tools/serialver/messages.properties:
Likewise.
* classpath/gnu/java/net/IndexListParser.java:
Likewise.
* classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java,
classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,
classpath/gnu/java/awt/peer/gtk/CairoSurface.java,
classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java,
classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java,
classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java,
classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java,
classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java,
classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java,
classpath/gnu/java/awt/peer/gtk/GtkVolatileImage.java,
classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java,
classpath/gnu/java/awt/java2d/PolyEdge.java,
classpath/gnu/java/awt/java2d/AbstractGraphics2D.java: Merge from
GNU Classpath.
* classpath/tools/toolwrapper.c: Replace tools.zip reference with
libgcj-tools-4.2.0.jar.
* classpath/tools/Makefile.in: Regenerate.
* classpath/tools/Makefile.am: Rename tools.zip to
libgcj-tools-4.2.0.jar. Install libgcj-tools-4.2.0.jar in
$(datadir)/java.
* classpath/javax/swing/JTabbedPane.java,
classpath/javax/swing/text/DefaultStyledDocument.java,
classpath/javax/swing/text/html/HTMLDocument.java,
classpath/javax/swing/text/GapContent.java,
classpath/javax/swing/JComponent.java,
classpath/javax/swing/RepaintManager.java,
classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java,
classpath/javax/swing/plaf/basic/BasicScrollBarUI.java,
classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java,
classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java,
classpath/javax/swing/plaf/basic/BasicLookAndFeel.java,
classpath/javax/swing/plaf/metal/MetalButtonUI.java,
classpath/java/text/Bidi.java,
classpath/java/awt/image/BufferedImage.java,
classpath/java/awt/datatransfer/DataFlavor.java,
classpath/java/awt/geom/AffineTransform.java,
classpath/java/awt/dnd/DropTargetDropEvent.java,
classpath/java/awt/dnd/DropTargetContext.java,
classpath/java/awt/font/TextLayout.java,
classpath/include/gnu_java_awt_peer_gtk_ComponentGraphics.h,
classpath/include/gnu_java_awt_peer_gtk_CairoGraphics2D.h,
classpath/include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h,
classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h,
classpath/include/gnu_java_awt_peer_gtk_GtkVolatileImage.h,
classpath/include/gnu_java_awt_peer_gtk_CairoSurface.h: Merge from
GNU Classpath.
* classpath/include/gnu_java_awt_peer_gtk_GdkGraphics.h,
classpath/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c,
classpath/native/jni/gtk-peer/gtkcairopeer.h,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c:
Remove files.
* classpath/Makefile.am (SUBDIRS, DIST_SUBDIRS): Include tools
directory.
* include/Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
From-SVN: r114633
2006-06-14 03:38:34 +00:00
|
|
|
public void writeExternal(ObjectOutput stream)
|
|
|
|
throws IOException, NotImplementedException
|
2006-01-17 18:09:40 +00:00
|
|
|
{
|
|
|
|
// FIXME: Implement me
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* De-serialize this class.
|
|
|
|
*
|
|
|
|
* @param stream The <code>ObjectInput</code> stream to deserialize from.
|
|
|
|
*
|
|
|
|
* @exception IOException If an error ocurs.
|
|
|
|
* @exception ClassNotFoundException If the class for an object being restored
|
|
|
|
* cannot be found.
|
|
|
|
*/
|
|
|
|
public void readExternal(ObjectInput stream)
|
configure: Regenerate.
2006-06-13 Thomas Fitzsimmons <fitzsim@redhat.com>
* configure: Regenerate.
* Makefile.in: Regenerate.
* configure.ac (--enable-plugin): New option.
(ac_configure_args): Add --enable-tool-wrappers.
(ac_configure_args): Add --disable-plugin unless --enable-plugin
was specified.
* gcj/Makefile.in: Regenerate.
* sources.am (gnu_java_net_source_files): Add
classpath/gnu/java/net/IndexListParser.java.
(property_files): Remove
classpath/resource/gnu/classpath/tools/jarsigner/MessageBundle.properties,
classpath/resource/gnu/classpath/tools/keytool/MessageBundle.properties.
Add
classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties,
classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties,
classpath/resource/gnu/classpath/tools/getopt/Messages.properties,
classpath/resource/gnu/classpath/tools/jar/messages.properties,
classpath/resource/gnu/classpath/tools/jarsigner/messages.properties,
classpath/resource/gnu/classpath/tools/keytool/messages.properties,
classpath/resource/gnu/classpath/tools/native2ascii/messages.properties,
classpath/resource/gnu/classpath/tools/serialver/messages.properties.
* classpath/Makefile.in: Regenerate.
* classpath/native/jni/gtk-peer/cairographics2d.h,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoGraphics2D.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_ComponentGraphics.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkVolatileImage.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_CairoSurface.c,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkTextLayout.c:
Merge from GNU Classpath.
* classpath/native/Makefile.in: Regenerate.
* classpath/native/jawt/Makefile.in: Regenerate.
* classpath/native/jawt/Makefile.am: Install libjawt.so in GCJ's
versioned library directory.
* classpath/native/Makefile.am: Add plugin directory if
--enable-plugin was specified.
* classpath/native/plugin/Makefile.in: Regenerate. *
classpath/native/plugin/Makefile.am: Install libgcjwebplugin.so in
GCJ's versioned library directory.
* classpath/resource/gnu/classpath/tools/native2ascii/messages.properties:
New file.
* classpath/resource/gnu/classpath/tools/getopt/Messages.properties:
Likewise.
* classpath/resource/gnu/classpath/tools/jarsigner/messages.properties:
Likewise.
* classpath/resource/gnu/classpath/tools/jarsigner/MessageBundle.properties:
Remove file.
* classpath/resource/gnu/classpath/tools/keytool/messages.properties:
New file.
* classpath/resource/gnu/classpath/tools/keytool/MessageBundle.properties:
Remove file.
* classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle_de.properties:
New file.
* classpath/resource/gnu/classpath/tools/appletviewer/MessagesBundle.properties:
Likewise.
* classpath/resource/gnu/classpath/tools/jar/messages.properties:
Likewise.
* classpath/resource/gnu/classpath/tools/serialver/messages.properties:
Likewise.
* classpath/gnu/java/net/IndexListParser.java:
Likewise.
* classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java,
classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,
classpath/gnu/java/awt/peer/gtk/CairoSurface.java,
classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java,
classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java,
classpath/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java,
classpath/gnu/java/awt/peer/gtk/GdkTextLayout.java,
classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java,
classpath/gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java,
classpath/gnu/java/awt/peer/gtk/GtkVolatileImage.java,
classpath/gnu/java/awt/font/opentype/truetype/VirtualMachine.java,
classpath/gnu/java/awt/java2d/PolyEdge.java,
classpath/gnu/java/awt/java2d/AbstractGraphics2D.java: Merge from
GNU Classpath.
* classpath/tools/toolwrapper.c: Replace tools.zip reference with
libgcj-tools-4.2.0.jar.
* classpath/tools/Makefile.in: Regenerate.
* classpath/tools/Makefile.am: Rename tools.zip to
libgcj-tools-4.2.0.jar. Install libgcj-tools-4.2.0.jar in
$(datadir)/java.
* classpath/javax/swing/JTabbedPane.java,
classpath/javax/swing/text/DefaultStyledDocument.java,
classpath/javax/swing/text/html/HTMLDocument.java,
classpath/javax/swing/text/GapContent.java,
classpath/javax/swing/JComponent.java,
classpath/javax/swing/RepaintManager.java,
classpath/javax/swing/plaf/basic/BasicComboBoxRenderer.java,
classpath/javax/swing/plaf/basic/BasicScrollBarUI.java,
classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java,
classpath/javax/swing/plaf/basic/BasicScrollPaneUI.java,
classpath/javax/swing/plaf/basic/BasicLookAndFeel.java,
classpath/javax/swing/plaf/metal/MetalButtonUI.java,
classpath/java/text/Bidi.java,
classpath/java/awt/image/BufferedImage.java,
classpath/java/awt/datatransfer/DataFlavor.java,
classpath/java/awt/geom/AffineTransform.java,
classpath/java/awt/dnd/DropTargetDropEvent.java,
classpath/java/awt/dnd/DropTargetContext.java,
classpath/java/awt/font/TextLayout.java,
classpath/include/gnu_java_awt_peer_gtk_ComponentGraphics.h,
classpath/include/gnu_java_awt_peer_gtk_CairoGraphics2D.h,
classpath/include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h,
classpath/include/gnu_java_awt_peer_gtk_GdkTextLayout.h,
classpath/include/gnu_java_awt_peer_gtk_GtkVolatileImage.h,
classpath/include/gnu_java_awt_peer_gtk_CairoSurface.h: Merge from
GNU Classpath.
* classpath/include/gnu_java_awt_peer_gtk_GdkGraphics.h,
classpath/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c,
classpath/native/jni/gtk-peer/gtkcairopeer.h,
classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c:
Remove files.
* classpath/Makefile.am (SUBDIRS, DIST_SUBDIRS): Include tools
directory.
* include/Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
From-SVN: r114633
2006-06-14 03:38:34 +00:00
|
|
|
throws IOException, ClassNotFoundException, NotImplementedException
|
2006-01-17 18:09:40 +00:00
|
|
|
{
|
|
|
|
// FIXME: Implement me
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Returns a string representation of this DataFlavor. Including the
|
|
|
|
* representation class name, MIME type and human presentable name.
|
|
|
|
*/
|
|
|
|
public String toString()
|
|
|
|
{
|
|
|
|
return (getClass().getName()
|
|
|
|
+ "[representationClass=" + getRepresentationClass().getName()
|
|
|
|
+ ",mimeType=" + getMimeType()
|
|
|
|
+ ",humanPresentableName=" + getHumanPresentableName()
|
|
|
|
+ "]");
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* XXX - Currently returns <code>java.io.InputStream</code>.
|
|
|
|
*
|
|
|
|
* @since 1.3
|
|
|
|
*/
|
|
|
|
public final Class getDefaultRepresentationClass()
|
|
|
|
{
|
|
|
|
return java.io.InputStream.class;
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* XXX - Currently returns <code>java.io.InputStream</code>.
|
|
|
|
*/
|
|
|
|
public final String getDefaultRepresentationClassAsString()
|
|
|
|
{
|
|
|
|
return getDefaultRepresentationClass().getName();
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Creates a <code>Reader</code> for a given <code>Transferable</code>.
|
|
|
|
*
|
|
|
|
* If the representation class is a (subclass of) <code>Reader</code>
|
|
|
|
* then an instance of the representation class is returned. If the
|
|
|
|
* representatation class is a <code>String</code> then a
|
|
|
|
* <code>StringReader</code> is returned. And if the representation class
|
|
|
|
* is a (subclass of) <code>InputStream</code> and the primary MIME type
|
|
|
|
* is "text" then a <code>InputStreamReader</code> for the correct charset
|
|
|
|
* encoding is returned.
|
|
|
|
*
|
|
|
|
* @param transferable The <code>Transferable</code> for which a text
|
|
|
|
* <code>Reader</code> is requested.
|
|
|
|
*
|
|
|
|
* @exception IllegalArgumentException If the representation class is not one
|
|
|
|
* of the seven listed above or the Transferable has null data.
|
|
|
|
* @exception NullPointerException If the Transferable is null.
|
|
|
|
* @exception UnsupportedFlavorException when the transferable doesn't
|
|
|
|
* support this <code>DataFlavor</code>. Or if the representable class
|
|
|
|
* isn't a (subclass of) <code>Reader</code>, <code>String</code>,
|
|
|
|
* <code>InputStream</code> and/or the primary MIME type isn't "text".
|
|
|
|
* @exception IOException when any IOException occurs.
|
|
|
|
* @exception UnsupportedEncodingException if the "charset" isn't supported
|
|
|
|
* on this platform.
|
|
|
|
*/
|
|
|
|
public Reader getReaderForText(Transferable transferable)
|
|
|
|
throws UnsupportedFlavorException, IOException
|
|
|
|
{
|
|
|
|
if (!transferable.isDataFlavorSupported(this))
|
|
|
|
throw new UnsupportedFlavorException(this);
|
|
|
|
|
|
|
|
if (Reader.class.isAssignableFrom(representationClass))
|
|
|
|
return (Reader)transferable.getTransferData(this);
|
|
|
|
|
|
|
|
if (String.class.isAssignableFrom(representationClass))
|
|
|
|
return new StringReader((String)transferable.getTransferData(this));
|
|
|
|
|
|
|
|
if (InputStream.class.isAssignableFrom(representationClass)
|
|
|
|
&& "text".equals(getPrimaryType()))
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
2006-01-17 18:09:40 +00:00
|
|
|
InputStream in = (InputStream)transferable.getTransferData(this);
|
|
|
|
String encoding = getParameter("charset");
|
2005-07-16 00:30:23 +00:00
|
|
|
if (encoding == null)
|
2006-01-17 18:09:40 +00:00
|
|
|
encoding = "us-ascii";
|
|
|
|
return new InputStreamReader(in, encoding);
|
2005-07-16 00:30:23 +00:00
|
|
|
}
|
2006-01-17 18:09:40 +00:00
|
|
|
|
|
|
|
throw new UnsupportedFlavorException(this);
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether the representation class for this DataFlavor is
|
|
|
|
* @see java.nio.ByteBuffer or a subclass thereof.
|
|
|
|
*
|
|
|
|
* @since 1.4
|
|
|
|
*/
|
2006-01-17 18:09:40 +00:00
|
|
|
public boolean isRepresentationClassByteBuffer()
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
2006-01-17 18:09:40 +00:00
|
|
|
return ByteBuffer.class.isAssignableFrom(representationClass);
|
2005-07-16 00:30:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether the representation class for this DataFlavor is
|
|
|
|
* @see java.nio.CharBuffer or a subclass thereof.
|
|
|
|
*
|
|
|
|
* @since 1.4
|
|
|
|
*/
|
2006-01-17 18:09:40 +00:00
|
|
|
public boolean isRepresentationClassCharBuffer()
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
2006-01-17 18:09:40 +00:00
|
|
|
return CharBuffer.class.isAssignableFrom(representationClass);
|
2005-07-16 00:30:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether the representation class for this DataFlavor is
|
|
|
|
* @see java.io.Reader or a subclass thereof.
|
|
|
|
*
|
|
|
|
* @since 1.4
|
|
|
|
*/
|
2006-01-17 18:09:40 +00:00
|
|
|
public boolean isRepresentationClassReader()
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
2006-01-17 18:09:40 +00:00
|
|
|
return Reader.class.isAssignableFrom(representationClass);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether this <code>DataFlavor</code> is a valid text flavor for
|
|
|
|
* this implementation of the Java platform. Only flavors equivalent to
|
|
|
|
* <code>DataFlavor.stringFlavor</code> and <code>DataFlavor</code>s with
|
|
|
|
* a primary MIME type of "text" can be valid text flavors.
|
|
|
|
* <p>
|
|
|
|
* If this flavor supports the charset parameter, it must be equivalent to
|
|
|
|
* <code>DataFlavor.stringFlavor</code>, or its representation must be
|
|
|
|
* <code>java.io.Reader</code>, <code>java.lang.String</code>,
|
|
|
|
* <code>java.nio.CharBuffer</code>, <code>java.io.InputStream</code> or
|
|
|
|
* <code>java.nio.ByteBuffer</code>,
|
|
|
|
* If the representation is <code>java.io.InputStream</code> or
|
|
|
|
* <code>java.nio.ByteBuffer</code>, then this flavor's <code>charset</code>
|
|
|
|
* parameter must be supported by this implementation of the Java platform.
|
|
|
|
* If a charset is not specified, then the platform default charset, which
|
|
|
|
* is always supported, is assumed.
|
|
|
|
* <p>
|
|
|
|
* If this flavor does not support the charset parameter, its
|
|
|
|
* representation must be <code>java.io.InputStream</code>,
|
|
|
|
* <code>java.nio.ByteBuffer</code>.
|
|
|
|
* <p>
|
|
|
|
* See <code>selectBestTextFlavor</code> for a list of text flavors which
|
|
|
|
* support the charset parameter.
|
|
|
|
*
|
|
|
|
* @return <code>true</code> if this <code>DataFlavor</code> is a valid
|
|
|
|
* text flavor as described above; <code>false</code> otherwise
|
|
|
|
* @see #selectBestTextFlavor
|
|
|
|
* @since 1.4
|
|
|
|
*/
|
|
|
|
public boolean isFlavorTextType() {
|
|
|
|
// FIXME: I'm not 100% sure if this implementation does the same like sun's does
|
|
|
|
if(equals(DataFlavor.stringFlavor) || getPrimaryType().equals("text"))
|
|
|
|
{
|
|
|
|
String charset = getParameter("charset");
|
|
|
|
Class c = getRepresentationClass();
|
|
|
|
if(charset != null)
|
|
|
|
{
|
|
|
|
if(Reader.class.isAssignableFrom(c)
|
|
|
|
|| CharBuffer.class.isAssignableFrom(c)
|
|
|
|
|| String.class.isAssignableFrom(c))
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if(InputStream.class.isAssignableFrom(c)
|
|
|
|
|| ByteBuffer.class.isAssignableFrom(c))
|
|
|
|
{
|
|
|
|
return Charset.isSupported(charset);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(InputStream.class.isAssignableFrom(c)
|
|
|
|
|| ByteBuffer.class.isAssignableFrom(c))
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
2005-07-16 00:30:23 +00:00
|
|
|
}
|
|
|
|
} // class DataFlavor
|
|
|
|
|