# Class ClipboardContent

java.lang.Object
com.codename1.ui.ClipboardContent

Direct Known Subclasses:
  `RichTextClipboardData`

public class ClipboardContent extends Object

A set of alternative clipboard representations keyed by MIME type. A clipboard write should normally include `text/plain` plus any richer formats it can provide. Clipboard readers negotiate by inspecting `#getMimeTypes()` and requesting the representation they understand best.

Values are usually `String` or `byte[]`. Ports may support additional native value types, but must retain the plain-text representation when one is supplied.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `MIME_ASCIIDOC`
  `static final String`
  `MIME_FILE`
  A local file reference (a file path / URI `String`, or a `String[]` for several files).
  `static final String`
  `MIME_GIF`
  GIF image bytes (`byte[]`).
  `static final String`
  `MIME_HTML`
  `static final String`
  `MIME_JPEG`
  JPEG image bytes (`byte[]`).
  `static final String`
  `MIME_MARKDOWN`
  `static final String`
  `MIME_PNG`
  PNG image bytes (`byte[]`).
  `static final String`
  `MIME_RTF`
  `static final String`
  `MIME_TEXT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ClipboardContent()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `findPreferredMimeType(String[] preferredMimeTypes)`
  Returns the first available MIME type from the caller's preference list, or null.
  `byte[]`
  `getBytes(String mimeType)`
  Returns the binary (`byte[]`) representation for a MIME type -- e.g.
  `Object`
  `getData(String mimeType)`
  Returns the representation for a MIME type, or null when it isn't available.
  `String[]`
  `getMimeTypes()`
  Returns the available MIME types in preference order.
  `String`
  `getText(String mimeType)`
  Returns a string representation, or null when the value isn't a string.
  `boolean`
  `hasMimeType(String mimeType)`
  Returns true when this content includes the requested MIME type.
  `ClipboardContent`
  `setData(String mimeType, Object value)`
  Adds or replaces a representation.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### MIME_TEXT

    public static final String MIME_TEXT
    See Also:
      - Constant Field Values

  - ### MIME_HTML

    public static final String MIME_HTML
    See Also:
      - Constant Field Values

  - ### MIME_RTF

    public static final String MIME_RTF
    See Also:
      - Constant Field Values

  - ### MIME_MARKDOWN

    public static final String MIME_MARKDOWN
    See Also:
      - Constant Field Values

  - ### MIME_ASCIIDOC

    public static final String MIME_ASCIIDOC
    See Also:
      - Constant Field Values

  - ### MIME_PNG

    public static final String MIME_PNG
    PNG image bytes (`byte[]`).
    See Also:
      - Constant Field Values

  - ### MIME_JPEG

    public static final String MIME_JPEG
    JPEG image bytes (`byte[]`).
    See Also:
      - Constant Field Values

  - ### MIME_GIF

    public static final String MIME_GIF
    GIF image bytes (`byte[]`).
    See Also:
      - Constant Field Values

  - ### MIME_FILE

    public static final String MIME_FILE
    A local file reference (a file path / URI `String`, or a `String[]` for several files).
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### ClipboardContent

    public ClipboardContent()

- ## Method Details

  - ### setData

    public ClipboardContent setData(String mimeType, Object value)
    Adds or replaces a representation. Passing null removes the MIME type.

  - ### getData

    public Object getData(String mimeType)
    Returns the representation for a MIME type, or null when it isn't available.

  - ### getBytes

    public byte[] getBytes(String mimeType)
    Returns the binary (`byte[]`) representation for a MIME type -- e.g. the raw bytes of an image or file -- or null when it isn't available or isn't binary.

  - ### getText

    public String getText(String mimeType)
    Returns a string representation, or null when the value isn't a string.

  - ### hasMimeType

    public boolean hasMimeType(String mimeType)
    Returns true when this content includes the requested MIME type.

  - ### getMimeTypes

    public String[] getMimeTypes()
    Returns the available MIME types in preference order.

  - ### findPreferredMimeType

    public String findPreferredMimeType(String[] preferredMimeTypes)
    Returns the first available MIME type from the caller's preference list, or null.