001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.documentlibrary.util;
016    
017    import com.liferay.portal.kernel.repository.model.FileVersion;
018    
019    import java.io.InputStream;
020    
021    import java.util.Set;
022    
023    /**
024     * @author Sergio González
025     */
026    public class AudioProcessorUtil {
027    
028            public static void generateAudio(FileVersion fileVersion) throws Exception {
029                    getAudioProcessor().generateAudio(fileVersion);
030            }
031    
032            public static Set<String> getAudioMimeTypes() {
033                    return getAudioProcessor().getAudioMimeTypes();
034            }
035    
036            public static AudioProcessor getAudioProcessor() {
037                    return _audioProcessor;
038            }
039    
040            public static InputStream getPreviewAsStream(FileVersion fileVersion)
041                    throws Exception {
042    
043                    return getAudioProcessor().getPreviewAsStream(fileVersion);
044            }
045    
046            public static long getPreviewFileSize(FileVersion fileVersion)
047                    throws Exception {
048    
049                    return getAudioProcessor().getPreviewFileSize(fileVersion);
050            }
051    
052            public static boolean hasAudio(FileVersion fileVersion) {
053                    return getAudioProcessor().hasAudio(fileVersion);
054            }
055    
056            public static boolean isAudioSupported(FileVersion fileVersion) {
057                    return getAudioProcessor().isAudioSupported(fileVersion);
058            }
059    
060            public static boolean isAudioSupported(String mimeType) {
061                    return getAudioProcessor().isAudioSupported(mimeType);
062            }
063    
064            public static boolean isSupported(String mimeType) {
065                    return getAudioProcessor().isSupported(mimeType);
066            }
067    
068            public static void trigger(FileVersion fileVersion) {
069                    getAudioProcessor().trigger(fileVersion);
070            }
071    
072            public void setAudioProcessor(AudioProcessor audioProcessor) {
073                    _audioProcessor = audioProcessor;
074            }
075    
076            private static AudioProcessor _audioProcessor;
077    
078    }