当前位置: 首页>>代码示例>>Java>>正文


Java IStreamableFile.getReader方法代码示例

本文整理汇总了Java中org.red5.io.IStreamableFile.getReader方法的典型用法代码示例。如果您正苦于以下问题:Java IStreamableFile.getReader方法的具体用法?Java IStreamableFile.getReader怎么用?Java IStreamableFile.getReader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.red5.io.IStreamableFile的用法示例。


在下文中一共展示了IStreamableFile.getReader方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.red5.io.IStreamableFile; //导入方法依赖的package包/类
/**
 * Initializes file provider. Creates streamable file factory and service, seeks to start position
 */
private void init() throws IOException {
    IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils.getScopeService(scope, IStreamableFileFactory.class, StreamableFileFactory.class);
    IStreamableFileService service = factory.getService(file);
    if (service == null) {
        log.error("No service found for {}", file.getAbsolutePath());
        return;
    }
    IStreamableFile streamFile = service.getStreamableFile(file);
    reader = streamFile.getReader();
    if (start > 0) {
        seek(start);
    }
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:17,代码来源:FileProvider.java

示例2: getStreamLength

import org.red5.io.IStreamableFile; //导入方法依赖的package包/类
/**
 * Returns stream length. This is a hook so it may be removed.
 * 
 * @param name
 *            Stream name
 * @return Stream length in seconds (?)
 */
public double getStreamLength(String name) {
    double duration = 0;
    IProviderService provider = (IProviderService) ScopeUtils.getScopeService(scope, IProviderService.class, ProviderService.class);
    File file = provider.getVODProviderFile(scope, name);
    if (file != null && file.canRead()) {
        IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils.getScopeService(scope, IStreamableFileFactory.class, StreamableFileFactory.class);
        IStreamableFileService service = factory.getService(file);
        if (service != null) {
            ITagReader reader = null;
            try {
                IStreamableFile streamFile = service.getStreamableFile(file);
                reader = streamFile.getReader();
                duration = (double) reader.getDuration() / 1000;
            } catch (IOException e) {
                log.error("Error read stream file {}. {}", file.getAbsolutePath(), e);
            } finally {
                if (reader != null) {
                    reader.close();
                }
            }
        } else {
            log.error("No service found for {}", file.getAbsolutePath());
        }
        file = null;
    }
    return duration;
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:35,代码来源:MultiThreadedApplicationAdapter.java

示例3: init

import org.red5.io.IStreamableFile; //导入方法依赖的package包/类
/**
 * Initializes file provider. Creates streamable file factory and service, seeks to start position
 */
private void init() throws IOException {
	IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils.getScopeService(scope, IStreamableFileFactory.class, StreamableFileFactory.class);
	IStreamableFileService service = factory.getService(file);
	if (service == null) {
		log.error("No service found for {}", file.getAbsolutePath());
		return;
	}
	IStreamableFile streamFile = service.getStreamableFile(file);
	reader = streamFile.getReader();
	if (start > 0) {
		seek(start);
	}
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:17,代码来源:FileProvider.java

示例4: getStreamLength

import org.red5.io.IStreamableFile; //导入方法依赖的package包/类
/**
 * Returns stream length. This is a hook so it may be removed.
 * 
 * @param name
 *            Stream name
 * @return Stream length in seconds (?)
 */
public double getStreamLength(String name) {
	double duration = 0;
	IProviderService provider = (IProviderService) ScopeUtils.getScopeService(scope, IProviderService.class, ProviderService.class);
	File file = provider.getVODProviderFile(scope, name);
	if (file != null && file.canRead()) {
		IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils.getScopeService(scope, IStreamableFileFactory.class, StreamableFileFactory.class);
		IStreamableFileService service = factory.getService(file);
		if (service != null) {
			ITagReader reader = null;
			try {
				IStreamableFile streamFile = service.getStreamableFile(file);
				reader = streamFile.getReader();
				duration = (double) reader.getDuration() / 1000;
			} catch (IOException e) {
				log.error("Error read stream file {}. {}", file.getAbsolutePath(), e);
			} finally {
				if (reader != null) {
					reader.close();
				}
			}
		} else {
			log.error("No service found for {}", file.getAbsolutePath());
		}
		file = null;
	}
	return duration;
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:35,代码来源:MultiThreadedApplicationAdapter.java


注:本文中的org.red5.io.IStreamableFile.getReader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。