Package org.silverpeas.components.gallery

## Class MediaUtil

- java.lang.Object
- - org.silverpeas.components.gallery.MediaUtil

-     public class MediaUtil
      extends Object

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static void` | `pasteInternalMedia​(org.silverpeas.core.process.io.file.FileHandler fileHandler, MediaPK fromPK, InternalMedia media, boolean cut)` | Pastes media from a source to a destination.
    `static void` | `processPhoto​(org.silverpeas.core.process.io.file.FileHandler fileHandler, Photo photo, File image, Watermark watermark)` | Saves uploaded photo file on file system with associated thumbnails and watermarks.
    `static void` | `processPhoto​(org.silverpeas.core.process.io.file.FileHandler fileHandler, Photo photo, org.apache.commons.fileupload.FileItem image, Watermark watermark)` | Saves uploaded photo file on file system with associated thumbnails and watermarks.
    `static void` | `processSound​(org.silverpeas.core.process.io.file.FileHandler fileHandler, Sound sound, File uploadedFile)` | Saves uploaded sound file on file system (In case of drag And Drop upload)
    `static void` | `processSound​(org.silverpeas.core.process.io.file.FileHandler fileHandler, Sound sound, org.apache.commons.fileupload.FileItem fileItem)` | Saves uploaded sound file on file system
    `static void` | `processVideo​(org.silverpeas.core.process.io.file.FileHandler fileHandler, Video video, File uploadedFile)` | Saves uploaded video file on file system (In case of drag And Drop upload)
    `static void` | `processVideo​(org.silverpeas.core.process.io.file.FileHandler fileHandler, Video video, org.apache.commons.fileupload.FileItem fileItem)` | Saves uploaded video file on file system
    `static void` | `setMetaData​(org.silverpeas.core.process.io.file.FileHandler fileHandler, Photo photo)` | Sets metadata to given instance which represents a photo in memory.

    - ### Methods inherited from class java.lang.Object

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

- - ### Method Detail

    - #### processSound

          public static void processSound​(org.silverpeas.core.process.io.file.FileHandler fileHandler,
                                          Sound sound,
                                          org.apache.commons.fileupload.FileItem fileItem)
                                   throws Exception

      Saves uploaded sound file on file system
      Parameters:
        `fileHandler` - the current session file handler
        `sound` - the current sound media
        `fileItem` - the current uploaded sound
      Throws:
        `Exception`

    - #### processSound

          public static void processSound​(org.silverpeas.core.process.io.file.FileHandler fileHandler,
                                          Sound sound,
                                          File uploadedFile)
                                   throws Exception

      Saves uploaded sound file on file system (In case of drag And Drop upload)
      Parameters:
        `fileHandler` - the current session file handler
        `sound` - the current sound media
        `uploadedFile` - the current uploaded sound
      Throws:
        `Exception`

    - #### processVideo

          public static void processVideo​(org.silverpeas.core.process.io.file.FileHandler fileHandler,
                                          Video video,
                                          org.apache.commons.fileupload.FileItem fileItem)
                                   throws Exception

      Saves uploaded video file on file system
      Parameters:
        `fileHandler` - the current session file handler
        `video` - the current video media
        `fileItem` - the current uploaded video
      Throws:
        `Exception`

    - #### processVideo

          public static void processVideo​(org.silverpeas.core.process.io.file.FileHandler fileHandler,
                                          Video video,
                                          File uploadedFile)
                                   throws Exception

      Saves uploaded video file on file system (In case of drag And Drop upload)
      Parameters:
        `fileHandler` - the current session file handler
        `video` - the current video media
        `uploadedFile` - the current uploaded video
      Throws:
        `Exception`

    - #### processPhoto

          public static void processPhoto​(org.silverpeas.core.process.io.file.FileHandler fileHandler,
                                          Photo photo,
                                          org.apache.commons.fileupload.FileItem image,
                                          Watermark watermark)
                                   throws Exception

      Saves uploaded photo file on file system with associated thumbnails and watermarks.
      Parameters:
        `fileHandler` - the current session file handler
        `photo` - the photo media
        `image` - the image to register
        `watermark` - if watermark must be handled, the data are represented by this `Watermark` instance.
      Throws:
        `Exception` - on technical error.

    - #### processPhoto

          public static void processPhoto​(org.silverpeas.core.process.io.file.FileHandler fileHandler,
                                          Photo photo,
                                          File image,
                                          Watermark watermark)
                                   throws Exception

      Saves uploaded photo file on file system with associated thumbnails and watermarks. (In case of drag And Drop upload)
      Parameters:
        `fileHandler` - the current session file handler
        `photo` - the photo media
        `image` - the image to register
        `watermark` - if watermark must be handled, the data are represented by this `Watermark` instance.
      Throws:
        `Exception` - on technical error.

    - #### pasteInternalMedia

          public static void pasteInternalMedia​(org.silverpeas.core.process.io.file.FileHandler fileHandler,
                                                MediaPK fromPK,
                                                InternalMedia media,
                                                boolean cut)

      Pastes media from a source to a destination.
      Parameters:
        `fileHandler` - the file handler (space quota management).
        `fromPK` - the source.
        `media` - the destination.
        `cut` - true if it is a cut operation, false if it is a copy one.

    - #### setMetaData

          public static void setMetaData​(org.silverpeas.core.process.io.file.FileHandler fileHandler,
                                         Photo photo)
                                  throws MediaMetadataException

      Sets metadata to given instance which represents a photo in memory.
      Parameters:
        `fileHandler` - the file handler (quota space management).
        `photo` - the photo to set.
      Throws:
        `IOException`
        `MediaMetadataException`