StringSelection.java (getTransferData): Return object of type expected by specified DataFlavor.
2003-12-08 Fernando Nasser <fnasser@redhat.com> * java/awt/datatransfer/StringSelection.java (getTransferData): Return object of type expected by specified DataFlavor. From-SVN: r74449
This commit is contained in:
parent
453d6cba7e
commit
82650cb7ba
2 changed files with 15 additions and 2 deletions
|
@ -38,7 +38,7 @@ exception statement from your version. */
|
|||
|
||||
package java.awt.datatransfer;
|
||||
|
||||
import java.io.StringBufferInputStream;
|
||||
import java.io.StringReader;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
|
@ -140,7 +140,15 @@ getTransferData(DataFlavor flavor) throws UnsupportedFlavorException,
|
|||
if (!isDataFlavorSupported(flavor))
|
||||
throw new UnsupportedFlavorException(flavor);
|
||||
|
||||
return(new StringBufferInputStream(data));
|
||||
if (DataFlavor.plainTextFlavor == flavor)
|
||||
/* The behavior of this method for DataFlavor.plainTextFlavor and
|
||||
equivalent DataFlavors is inconsistent with the definition of
|
||||
DataFlavor.plainTextFlavor. We choose to do like Sun's implementation
|
||||
and return a Reader instead of an InputString. */
|
||||
/* return(new StringBufferInputStream(data)); */
|
||||
return(new StringReader(data));
|
||||
else // DataFlavor.stringFlavor
|
||||
return data;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue