本文整理匯總了Java中java.awt.datatransfer.DataFlavor.isRepresentationClassCharBuffer方法的典型用法代碼示例。如果您正苦於以下問題:Java DataFlavor.isRepresentationClassCharBuffer方法的具體用法?Java DataFlavor.isRepresentationClassCharBuffer怎麽用?Java DataFlavor.isRepresentationClassCharBuffer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.datatransfer.DataFlavor
的用法示例。
在下文中一共展示了DataFlavor.isRepresentationClassCharBuffer方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isFlavorCharsetTextType
import java.awt.datatransfer.DataFlavor; //導入方法依賴的package包/類
/**
* Returns whether this flavor is a text type which supports the
* 'charset' parameter.
*/
public static boolean isFlavorCharsetTextType(DataFlavor flavor) {
// Although stringFlavor doesn't actually support the charset
// parameter (because its primary MIME type is not "text"), it should
// be treated as though it does. stringFlavor is semantically
// equivalent to "text/plain" data.
if (DataFlavor.stringFlavor.equals(flavor)) {
return true;
}
if (!"text".equals(flavor.getPrimaryType()) ||
!doesSubtypeSupportCharset(flavor))
{
return false;
}
Class rep_class = flavor.getRepresentationClass();
if (flavor.isRepresentationClassReader() ||
String.class.equals(rep_class) ||
flavor.isRepresentationClassCharBuffer() ||
char[].class.equals(rep_class))
{
return true;
}
if (!(flavor.isRepresentationClassInputStream() ||
flavor.isRepresentationClassByteBuffer() ||
byte[].class.equals(rep_class))) {
return false;
}
String charset = flavor.getParameter("charset");
return (charset != null)
? DataTransferer.isEncodingSupported(charset)
: true; // null equals default encoding which is always supported
}
示例2: isFlavorCharsetTextType
import java.awt.datatransfer.DataFlavor; //導入方法依賴的package包/類
/**
* Returns whether this flavor is a text type which supports the 'charset'
* parameter.
*/
public static boolean isFlavorCharsetTextType(DataFlavor flavor) {
// Although stringFlavor doesn't actually support the charset
// parameter (because its primary MIME type is not "text"), it should
// be treated as though it does. stringFlavor is semantically
// equivalent to "text/plain" data.
if (DataFlavor.stringFlavor.equals(flavor)) {
return true;
}
if (!"text".equals(flavor.getPrimaryType()) ||
!doesSubtypeSupportCharset(flavor))
{
return false;
}
Class<?> rep_class = flavor.getRepresentationClass();
if (flavor.isRepresentationClassReader() ||
String.class.equals(rep_class) ||
flavor.isRepresentationClassCharBuffer() ||
char[].class.equals(rep_class))
{
return true;
}
if (!(flavor.isRepresentationClassInputStream() ||
flavor.isRepresentationClassByteBuffer() ||
byte[].class.equals(rep_class))) {
return false;
}
String charset = flavor.getParameter("charset");
// null equals default encoding which is always supported
return (charset == null) || isEncodingSupported(charset);
}