views:

161

answers:

1

Recently I've stumbled upon a class named javax.activation.DataHandler. But while reading the javadoc of JDK6, I was not able to understand the aim and rationale of the framework. If you have have used the framework in real life project, please share your experience and explain what a developer can "earn" from it.

+3  A: 

I used it in a JAX-WS web service using CXF for streaming of attachments with MTOM:

@XmlMimeType("application/octet-stream")
private DataHandler data;

A JAX-WS generated client will use the class too. From that class you can access the underlying input/output streams as required. When calling a web service method which includes a DataHandler, clients can write to the OutputStream, and on the server side, you can read from the InputStream. This way the data is never buffered in memory on client or server.

I'm sure there are other uses for this class, but this is only one that I've come across.

So is it worth learning? Well it was for me.

kipz