/* * myLib - https://github.com/taktod/myLib * Copyright (c) 2014 ttProject. All rights reserved. * * Licensed under The MIT license. */ package com.ttProject.container.webm.test; import org.apache.log4j.Logger; import org.junit.Test; import com.ttProject.container.IContainer; import com.ttProject.container.IReader; import com.ttProject.container.mkv.type.SimpleBlock; import com.ttProject.container.webm.WebmTagReader; import com.ttProject.nio.channels.FileReadChannel; import com.ttProject.nio.channels.IFileReadChannel; /** * webm load test * @author taktod */ public class WebmTest { /** logger */ private Logger logger = Logger.getLogger(WebmTest.class); /** * analyze file. */ @Test public void analyzerTest() { IFileReadChannel source = null; try { source = FileReadChannel.openFileReadChannel( Thread.currentThread().getContextClassLoader().getResource("test.webm") ); IReader reader = new WebmTagReader(); IContainer container = null; while((container = reader.read(source)) != null) { if(container instanceof SimpleBlock) { // SimpleBlock simpleBlock = (SimpleBlock)container; // logger.info(simpleBlock); } } } catch(Exception e) { logger.warn("例外発生", e); } finally { if(source != null) { try { source.close(); } catch(Exception e) { } source = null; } } } }