本文整理汇总了Java中javax.activation.ActivationDataFlavor类的典型用法代码示例。如果您正苦于以下问题:Java ActivationDataFlavor类的具体用法?Java ActivationDataFlavor怎么用?Java ActivationDataFlavor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActivationDataFlavor类属于javax.activation包,在下文中一共展示了ActivationDataFlavor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: marshal
import javax.activation.ActivationDataFlavor; //导入依赖的package包/类
@Override
public void marshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context) {
final ActivationDataFlavor dataFlavor = ActivationDataFlavor.class.cast(source);
final String mimeType = dataFlavor.getMimeType();
if (mimeType != null) {
writer.startNode("mimeType");
writer.setValue(mimeType);
writer.endNode();
}
final String name = dataFlavor.getHumanPresentableName();
if (name != null) {
writer.startNode("humanRepresentableName");
writer.setValue(name);
writer.endNode();
}
final Class<?> representationClass = dataFlavor.getRepresentationClass();
if (representationClass != null) {
writer.startNode("representationClass");
context.convertAnother(representationClass);
writer.endNode();
}
}
示例2: ImageDataContentHandler
import javax.activation.ActivationDataFlavor; //导入依赖的package包/类
public ImageDataContentHandler() {
String[] mimeTypes = ImageIO.getReaderMIMETypes();
flavor = new DataFlavor[mimeTypes.length];
for(int i=0; i < mimeTypes.length; i++) {
flavor[i] = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image");
}
}
示例3: getDataFlavors
import javax.activation.ActivationDataFlavor; //导入依赖的package包/类
@Override
@Nonnull
@ReturnsMutableObject ("design")
protected ActivationDataFlavor [] getDataFlavors ()
{
return FLAVORS;
}
示例4: getData
import javax.activation.ActivationDataFlavor; //导入依赖的package包/类
@Override
@Nonnull
protected Object getData (@Nonnull final ActivationDataFlavor aFlavor,
@Nonnull final DataSource ds) throws IOException
{
if (aFlavor.getRepresentationClass () == StreamSource.class)
return new StreamSource (ds.getInputStream ());
throw new IOException ("Unsupported flavor " + aFlavor + " on DS " + ds);
}
示例5: getTransferDataFlavors
import javax.activation.ActivationDataFlavor; //导入依赖的package包/类
public DataFlavor[] getTransferDataFlavors() {
return new DataFlavor[] {
new ActivationDataFlavor(InputStream.class, "application/octet-stream", "SFRM Data Stream"),
new ActivationDataFlavor(FileRegionDataSource.class, "application/octet-stream", "SFRM Data Stream"),
new ActivationDataFlavor(EmptyDataSource.class, "application/octet-stream", "SFRM Data Stream"),
new ActivationDataFlavor(String.class, "application/octet-stream", "SFRM Data Stream")};
}
示例6: testMimeTypeOnly
import javax.activation.ActivationDataFlavor; //导入依赖的package包/类
public void testMimeTypeOnly() {
final String expected = ""
+ "<activation-data-flavor>\n"
+ " <mimeType>application/x-junit</mimeType>\n"
+ " <representationClass>java.io.InputStream</representationClass>\n"
+ "</activation-data-flavor>";
assertBothWays(new ActivationDataFlavor("application/x-junit", null), expected);
}
示例7: testMimeTypeAndRepresentation
import javax.activation.ActivationDataFlavor; //导入依赖的package包/类
public void testMimeTypeAndRepresentation() {
final String expected = ""
+ "<activation-data-flavor>\n"
+ " <mimeType>application/x-junit</mimeType>\n"
+ " <humanRepresentableName>JUnit</humanRepresentableName>\n"
+ " <representationClass>java.io.InputStream</representationClass>\n"
+ "</activation-data-flavor>";
assertBothWays(new ActivationDataFlavor("application/x-junit", "JUnit"), expected);
}
示例8: testWithAllArguments
import javax.activation.ActivationDataFlavor; //导入依赖的package包/类
public void testWithAllArguments() {
final String expected = ""
+ "<activation-data-flavor>\n"
+ " <mimeType>application/x-junit</mimeType>\n"
+ " <humanRepresentableName>JUnit</humanRepresentableName>\n"
+ " <representationClass>com.thoughtworks.xstream.converters.extended.ActivationDataFlavorConverterTest</representationClass>\n"
+ "</activation-data-flavor>";
assertBothWays(new ActivationDataFlavor(ActivationDataFlavorConverterTest.class, "application/x-junit", "JUnit"), expected);
}
示例9: PKCS7ContentHandler
import javax.activation.ActivationDataFlavor; //导入依赖的package包/类
PKCS7ContentHandler(
ActivationDataFlavor adf,
DataFlavor[] dfs)
{
_adf = adf;
_dfs = dfs;
}
示例10: XmlDataContentHandler
import javax.activation.ActivationDataFlavor; //导入依赖的package包/类
public XmlDataContentHandler() throws ClassNotFoundException {
flavors = new DataFlavor[3];
flavors[0] = new ActivationDataFlavor(StreamSource.class, "text/xml", "XML");
flavors[1] = new ActivationDataFlavor(StreamSource.class, "application/xml", "XML");
flavors[2] = new ActivationDataFlavor(String.class, "text/xml", "XML String");
}
示例11: getDF
import javax.activation.ActivationDataFlavor; //导入依赖的package包/类
protected ActivationDataFlavor getDF() {
return myDF;
}
示例12: ListItemTransferHandler
import javax.activation.ActivationDataFlavor; //导入依赖的package包/类
public ListItemTransferHandler() {
localObjectFlavor = new ActivationDataFlavor(
Object[].class, DataFlavor.javaJVMLocalObjectMimeType, "Array of items");
}
示例13: ListItemTransferHandler
import javax.activation.ActivationDataFlavor; //导入依赖的package包/类
/**
* Constructs a new handler.
*/
public ListItemTransferHandler() {
super();
localObjectFlavor = new ActivationDataFlavor(Object[].class, DataFlavor.javaJVMLocalObjectMimeType, "Array of items");
}
示例14: ListItemTransferHandler
import javax.activation.ActivationDataFlavor; //导入依赖的package包/类
public ListItemTransferHandler(ResortListener resortListener) {
this.resortListener = resortListener;
localObjectFlavor = new ActivationDataFlavor(Object[].class, DataFlavor.javaJVMLocalObjectMimeType, "Array of items");
}
示例15: canConvert
import javax.activation.ActivationDataFlavor; //导入依赖的package包/类
@Override
public boolean canConvert(final Class<?> type) {
return type == ActivationDataFlavor.class;
}