问题描述
什么是使用的主要的原因一个的javax.activation.DataHandler
?
What is the main reason of using a javax.activation.DataHandler
?
是不是方便的对象,不实现Serializable的转移,在网络上?
Is it to facilitate the transfer of objects, that do not implement Serializable, over the network?
即。比如我看到文件的转换,从本地文件系统,以字节,然后创建一个的DataHandler
这些字节传送的DataHandler
在网络上。结果
这是一个将使用的原因的DataHandler
?
I.e. for instance I have seen the conversion of files, from local file systems, to bytes and then create a DataHandler
with these bytes and transfer the DataHandler
over the network.
Is this the reason that one would use DataHandler
?
推荐答案
我会从的:
I'll lead off with the start of the description from the API entry for DataHandler
:
该DataHandler的类提供了一个一致的接口在许多不同来源和格式的数据。它管理简单流到字符串的转换以及使用DataContentHandlers相关业务。
诚然,这不是最清晰的描述。 的DataHandler
与XML和SOAP,您可以从的的使用标签。和你一样,我用它,因为它是被从一个Web服务组件发送到另一个处理再约上载文件present数据。
Admittedly, that's not the clearest description. DataHandler
has to do with XML and SOAP, which you can see from the the use tab of its API page. Like you, I've used it to represent data about an uploaded file as it's being sent from one web service component to another for processing.
这是的DataHandler
实现是不完全指的是同种序列化交易转移的转换
接口。这是关于在一个程序分开的部件之间的信息传输,或单独的程序,而不是保存供以后使用的对象。请参阅 API入口转让
了解。你会发现,它链接到,里面有什么与的DataHandler
,但确实说明了一个使用转换
。
The Transferable
interface that DataHandler
implements is not exactly referring to "transfer" of the kind serialization deals with. It's about transfer of information between separate components in a program, or separate programs, not saving an object for later use. See the API entry for Transferable
for more. You'll notice that it links to the Drag 'n' Drop Java Tutorial, which has little to do with DataHandler
but does illustrate a use of Transferable
.
这篇关于为什么我需要一个DataHandler的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!