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


Java PullDataSource类代码示例

本文整理汇总了Java中javax.media.protocol.PullDataSource的典型用法代码示例。如果您正苦于以下问题:Java PullDataSource类的具体用法?Java PullDataSource怎么用?Java PullDataSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setSource

import javax.media.protocol.PullDataSource; //导入依赖的package包/类
@Override
public void setSource(DataSource source) throws IOException, IncompatibleSourceException
{
	final String protocol = source.getLocator().getProtocol();
	
	if (USE_DATASOURCE_URL_ONLY)
	{
		if (!(protocol.equals("file")) && !(protocol.equals("http")))
			throw new IncompatibleSourceException();

	}
	else
	{
	
	if (!(source instanceof PullDataSource))
		throw new IncompatibleSourceException();
	}
	
	this.source = (PullDataSource) source;
	
}
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:22,代码来源:QTParser.java

示例2: setSource

import javax.media.protocol.PullDataSource; //导入依赖的package包/类
/**
 * Set the DataSource for this Player.
 *
 * @param      source
 *             The DataSource to try
 *
 * @exception  IncompatibleSourceException
 *             If the DataSource is not a PullDataSource or
 *             does not contain valid streams.
 */
public void setSource(DataSource source)
    throws IncompatibleSourceException
{
    //  Accept only PullDataSources
    if(! (source instanceof PullDataSource) ) {
        throw new IncompatibleSourceException(
            "MediaHandler " + getClass().getName() +
            " does not support " +
            "DataSource " + source.getClass().getName() );
    }

    PullSourceStream[] streams =
        ((PullDataSource)source).getStreams();

    if( streams == null || streams.length == 0 ) {
        throw new IncompatibleSourceException(
            "DataSource " + source.getClass().getName() +
            " does not contain valid streams." );
    }

    super.setSource(source);
    stream = streams[0];
}
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:34,代码来源:Handler.java

示例3: setSource

import javax.media.protocol.PullDataSource; //导入依赖的package包/类
public void setSource(DataSource source)
    throws IOException, IncompatibleSourceException {

    if (!(source instanceof PullDataSource)) {
        throw new IncompatibleSourceException("DataSource not supported: " + source);
    } else {
        streams = ((PullDataSource) source).getStreams();
    }

    if ( streams == null) {
        throw new IOException("Got a null stream from the DataSource");
    }

    if (streams.length == 0) {
        throw new IOException("Got a empty stream array from the DataSource");
    }
    this.source = source;
    
    positionable =  (streams[0] instanceof Seekable);
    seekable =  positionable && ((Seekable)
               streams[0]).isRandomAccess();

    if (!supports(streams))
        throw new IncompatibleSourceException("DataSource not supported: " + source);
}
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:26,代码来源:GsmParser.java

示例4: printMediaInfo

import javax.media.protocol.PullDataSource; //导入依赖的package包/类
/**
 * Prints formatted attributes of this MediaInfo object
 * to System.out
 */
public void printMediaInfo() {
    //  Print out MediaLocator
    System.out.println();
    System.out.print("MediaLocator: ");
    if( medialocator == null ) {
        printError();
    } else {
        System.out.println(medialocator);
    }

    //  Print out protocol
    System.out.println("    Protocol: " + protocol);

    //  Print out DataSource
    System.out.print("  DataSource: ");
    if( datasource == null ) {
        printError();
    } else {
        System.out.println( datasource.getClass().getName() );
    }

    //  Print out content contentType
    System.out.println("Content type: " + contentType);

    //  Print out any stream information
    if( datasource instanceof PullDataSource ) {
        PullSourceStream[] streams = ((PullDataSource)datasource).getStreams();
        for(int i = 0; i < streams.length; i++ ) {
            try {
                System.out.println("      Stream: " + streams[i].getClass().getName());
                System.out.println("      Length: " + streams[i].getContentLength());
            } catch(NullPointerException e) {}
        }
    }

    //  Print out Player
    System.out.print("      Player: ");
    if( player == null ) {
        printError();
    } else {
        System.out.println( player.getClass().getName() );
    }

    if( player != null ) {
        new StateWaiter(player).blockingRealize();
        Frame f = new Frame();
        f.add( player.getVisualComponent() );
        f.pack();
        f.setVisible(true);
        player.start();
    }
}
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:57,代码来源:MediaInfo.java


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