: Class DataHandler

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.activation
Class DataHandler

    java.lang.Object
      |
      +--javax.activation.DataHandler

All Implemented Interfaces:
  java.awt.datatransfer.Transferable

public class DataHandler
extends java.lang.Object
implements java.awt.datatransfer.Transferable

Data Handler.

Version:
  $Revision: 1.6 $
Author:
  Andrew Selkirk

Constructor Summary
`DataHandler(DataSource source)` Create data handler based on data source.
`DataHandler(java.lang.Object object, java.lang.String mimeType)` Create data handler based on object and MIME type.
`DataHandler(java.net.URL url)` Create data handler based on URL.

Method Summary
`CommandInfo[]` | `getAllCommands()` Get all commands.
`java.lang.Object` | `getBean(CommandInfo commandInfo)` Get beans of command.
`CommandInfo` | `getCommand(java.lang.String command)` Get command information based on command verb.
`java.lang.Object` | `getContent()` Get content.
`java.lang.String` | `getContentType()` Get content type of data handler.
`DataSource` | `getDataSource()` Get data source.
`java.io.InputStream` | `getInputStream()` Get input stream.
`java.lang.String` | `getName()` Get name.
`java.io.OutputStream` | `getOutputStream()` Get output stream.
`CommandInfo[]` | `getPreferredCommands()` Get list of preferred commands.
`java.lang.Object` | `getTransferData(java.awt.datatransfer.DataFlavor dataFlavor)` Get transfer data based on data flavor.
`java.awt.datatransfer.DataFlavor[]` | `getTransferDataFlavors()` Get transfer data flavors.
`boolean` | `isDataFlavorSupported(java.awt.datatransfer.DataFlavor dataFlavor)` Determine if data flavor is supported.
`void` | `setCommandMap(CommandMap map)` Set command map.
`static void` | `setDataContentHandlerFactory(DataContentHandlerFactory newFactory)` Set the data content factory for data handler.
`void` | `writeTo(java.io.OutputStream stream)` Write to output stream.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DataHandler

    public DataHandler(DataSource source)

  Create data handler based on data source.
  Parameters:
    `source` - Data source

### DataHandler

    public DataHandler(java.lang.Object object,
                       java.lang.String mimeType)

  Create data handler based on object and MIME type.
  Parameters:
    `object` - Object
    `mimeType` - MIME type

### DataHandler

    public DataHandler(java.net.URL url)

  Create data handler based on URL.
  Parameters:
    `url` - URL reference

Method Detail

### getName

    public java.lang.String getName()

  Get name.
  Returns:
    Data handler name

### getContent

    public java.lang.Object getContent()
                                throws java.io.IOException

  Get content.
  Returns:
    Content object
  Throws:
    `java.io.IOException` - IO exception occurred

### getInputStream

    public java.io.InputStream getInputStream()
                                       throws java.io.IOException

  Get input stream.
  Returns:
    Input stream
  Throws:
    `java.io.IOException` - IO exception occurred

### writeTo

    public void writeTo(java.io.OutputStream stream)
                 throws java.io.IOException

  Write to output stream.
  Parameters:
    `stream` - Output stream
  Throws:
    `java.io.IOException` - IO exception occurred

### getContentType

    public java.lang.String getContentType()

  Get content type of data handler.
  Returns:
    Content type

### getOutputStream

    public java.io.OutputStream getOutputStream()
                                         throws java.io.IOException

  Get output stream.
  Returns:
    Output stream
  Throws:
    `java.io.IOException` - IO exception occurred

### getAllCommands

    public CommandInfo[] getAllCommands()

  Get all commands.
  Returns:
    Command list

### getBean

    public java.lang.Object getBean(CommandInfo commandInfo)

  Get beans of command.
  Parameters:
    `commandInfo` - TODO
  Returns:
    Instantiated command bean, or null

### getCommand

    public CommandInfo getCommand(java.lang.String command)

  Get command information based on command verb.
  Parameters:
    `command` - Command verb
  Returns:
    Command information

### getDataSource

    public DataSource getDataSource()

  Get data source.
  Returns:
    Data source, or null

### getPreferredCommands

    public CommandInfo[] getPreferredCommands()

  Get list of preferred commands.
  Returns:
    List of preferred commands

### getTransferData

    public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor dataFlavor)
                                     throws java.awt.datatransfer.UnsupportedFlavorException,
                                            java.io.IOException

  Get transfer data based on data flavor.
  Specified by:
    `getTransferData` in interface `java.awt.datatransfer.Transferable`
  Parameters:
    `dataFlavor` - Data flavor
  Returns:
    Transfer data
  Throws:
    `java.awt.datatransfer.UnsupportedFlavorException` - Unsupported data flavor
    `java.io.IOException` - IO exception occurred

### getTransferDataFlavors

    public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()

  Get transfer data flavors.
  Specified by:
    `getTransferDataFlavors` in interface `java.awt.datatransfer.Transferable`
  Returns:
    List of data flavors

### isDataFlavorSupported

    public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor dataFlavor)

  Determine if data flavor is supported.
  Specified by:
    `isDataFlavorSupported` in interface `java.awt.datatransfer.Transferable`
  Parameters:
    `dataFlavor` - Data flavor
  Returns:
    true if supported, false otherwise

### setCommandMap

    public void setCommandMap(CommandMap map)

  Set command map. If null, command map is reset to default.
  Parameters:
    `map` - Command map

### setDataContentHandlerFactory

    public static void setDataContentHandlerFactory(DataContentHandlerFactory newFactory)

  Set the data content factory for data handler. Note that this is a one time call. Further calls result in an Error.
  Parameters:
    `newFactory` - New factory

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

© Copyright 2002 the Free Software Foundation, all rights reserved.