本文整理汇总了Java中com.rometools.modules.mediarss.MediaModule类的典型用法代码示例。如果您正苦于以下问题:Java MediaModule类的具体用法?Java MediaModule怎么用?Java MediaModule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MediaModule类属于com.rometools.modules.mediarss包,在下文中一共展示了MediaModule类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testParse
import com.rometools.modules.mediarss.MediaModule; //导入依赖的package包/类
/**
* @throws Exception if file not found or not accessible
*/
public void testParse() throws Exception {
final File test = new File(super.getTestFile("xml"));
final File[] files = test.listFiles();
for (int j = 0; j < files.length; j++) {
if (!files[j].getName().endsWith(".xml")) {
continue;
}
final SyndFeed feed = getSyndFeed(files[j]);
final List<SyndEntry> entries = feed.getEntries();
final SyndFeedOutput output = new SyndFeedOutput();
output.output(feed, new File("target/" + j + ".xml"));
final SyndFeed feed2 = getSyndFeed(new File("target/" + j + ".xml"));
for (int i = 0; i < entries.size(); i++) {
BufferedWriter b = new BufferedWriter(new FileWriter("target/" + j + "a.txt"));
b.write("" + entries.get(i).getModule(MediaModule.URI));
b.close();
b = new BufferedWriter(new FileWriter("target/" + j + "b.txt"));
b.write("" + feed2.getEntries().get(i).getModule(MediaModule.URI));
b.close();
assertEquals(entries.get(i).getModule(MediaModule.URI), feed2.getEntries().get(i).getModule(MediaModule.URI));
}
}
}
示例2: testGoogleVideo
import com.rometools.modules.mediarss.MediaModule; //导入依赖的package包/类
public static void testGoogleVideo() throws Exception {
final SyndFeedInput input = new SyndFeedInput();
final SyndFeed feed = input.build(new InputStreamReader(new URL("http://video.google.com/videofeed?type=top100new&num=20&output=rss").openStream()));
for (final Object element : feed.getEntries()) {
final SyndEntry entry = (SyndEntry) element;
final MediaEntryModule m = (MediaEntryModule) entry.getModule(MediaModule.URI);
System.out.print(m);
}
}
示例3: testGoogleVideo
import com.rometools.modules.mediarss.MediaModule; //导入依赖的package包/类
/**
* @throws Exception if file not found or not accessible
*/
public void testGoogleVideo() throws Exception {
final SyndFeed feed = getSyndFeed(new File(getTestFile("data/YouTube-MostPopular.rss")));
for (final Object element : feed.getEntries()) {
final SyndEntry entry = (SyndEntry) element;
final MediaEntryModule m = (MediaEntryModule) entry.getModule(MediaModule.URI);
assertNotNull(m);
}
}
示例4: testParseThumbnailWithEmptyDimensions
import com.rometools.modules.mediarss.MediaModule; //导入依赖的package包/类
/**
* tests parsing thubnails with empty dimensions
* (https://github.com/rometools/rome-modules/issues/7).
*
* @throws IOException if file not found or not accessible
* @throws FeedException when the feed can't be parsed
*
*/
public void testParseThumbnailWithEmptyDimensions() throws FeedException, IOException {
final SyndFeed feed = getSyndFeed("org/rometools/feed/module/mediarss/issue-07.xml");
final SyndEntry entry = feed.getEntries().get(0);
final MediaEntryModule module = (MediaEntryModule) entry.getModule(MediaModule.URI);
final Thumbnail[] thumbnails = module.getMetadata().getThumbnail();
assertThat(thumbnails, is(notNullValue()));
}
示例5: testParseDecimalDuration
import com.rometools.modules.mediarss.MediaModule; //导入依赖的package包/类
/**
* tests parsing a decimal duration (https://github.com/rometools/rome-modules/issues/8).
*
* @throws IOException if file not found or not accessible
* @throws FeedException when the feed can't be parsed
*
*/
public void testParseDecimalDuration() throws FeedException, IOException {
final SyndFeed feed = getSyndFeed("org/rometools/feed/module/mediarss/issue-08.xml");
final SyndEntry entry = feed.getEntries().get(0);
final MediaEntryModule module = (MediaEntryModule) entry.getModule(MediaModule.URI);
final Thumbnail[] thumbnails = module.getMetadata().getThumbnail();
assertThat(thumbnails, is(notNullValue()));
}
示例6: testParseRatingWithoutScheme
import com.rometools.modules.mediarss.MediaModule; //导入依赖的package包/类
/**
* tests parsing rating without scheme (https://github.com/rometools/rome-modules/issues/12).
*
* @throws IOException if file not found or not accessible
* @throws FeedException when the feed can't be parsed
*
*/
public void testParseRatingWithoutScheme() throws FeedException, IOException {
final SyndFeed feed = getSyndFeed("org/rometools/feed/module/mediarss/issue-12.xml");
final SyndEntry entry = feed.getEntries().get(0);
final MediaEntryModule module = (MediaEntryModule) entry.getModule(MediaModule.URI);
final Rating[] ratings = module.getMetadata().getRatings();
assertThat(ratings, is(notNullValue()));
}
示例7: testParseMediaContentContainingURLWithSpaces
import com.rometools.modules.mediarss.MediaModule; //导入依赖的package包/类
/**
* test url with whitespace in media element
* (https://github.com/rometools/rome-modules/issues/20).
*
* @throws Exception if file not found or not accessible
*/
public void testParseMediaContentContainingURLWithSpaces() throws Exception {
final SyndFeed feed = getSyndFeed("org/rometools/feed/module/mediarss/issue-20.xml");
final SyndEntry entry = feed.getEntries().get(0);
final MediaEntryModule m = (MediaEntryModule) entry.getModule(MediaModule.URI);
assertNotNull("missing media entry module", m);
final MediaContent[] mcs = m.getMediaContents();
assertNotNull("missing media:content", mcs);
assertEquals("wrong count of media:content", 1, mcs.length);
final MediaContent mc = mcs[0];
assertEquals("http://www.foo.com/path/containing+spaces/trailer.mov", mc.getReference().toString());
}
示例8: getNamespaceUri
import com.rometools.modules.mediarss.MediaModule; //导入依赖的package包/类
@Override
public String getNamespaceUri() {
return MediaModule.URI;
}