BlinkenArea - GitList
Repositories
Blog
Wiki
BlinkenSimJava
Code
Commits
Branches
Tags
Search
Tree:
f2e0fee
Branches
Tags
master
v0.1
v0.1.1
v0.2
BlinkenSimJava
org
blinkenarea
BlinkenSim
PlaylistPlayer.java
BlinkenSimJava v.0.2 (2006-07-28)
Christian Heimke
commited
f2e0fee
at 2011-07-15 09:13:27
PlaylistPlayer.java
Blame
History
Raw
/* BlinkenSim * version 0.1 date 2006-07-28 * Copyright (C) 2004-2006: Stefan Schuermans <1stein@schuermans.info> * Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html * a blinkenarea.org project */ package org.blinkenarea.BlinkenSim; import java.applet.*; import java.io.*; import java.net.*; public class PlaylistPlayer extends MoviePlayer { public PlaylistPlayer( Applet applet ) { String playlistName = applet.getParameter( "playlist" ); if( playlistName == null || playlistName.length( ) <= 0 ) playlistName = "playlist"; try { URL base = applet.getDocumentBase( ); URL url; if( base != null ) { url = new URL( base, playlistName ); } else { url = new URL( "file:" + playlistName ); } BufferedReader reader = new BufferedReader( new InputStreamReader( url.openStream( ) ) ); int len = 16, cnt = 0; String [] names = new String [len]; try { while( true ) { String line = reader.readLine( ); if( line == null ) break; names[cnt++] = line; if( cnt >= len ) { len *= 2; String [] newNames = new String [len]; for( int i = 0; i < cnt; i++ ) newNames[i] = names[i]; names = newNames; } } } catch( IOException e ) { } String [] movieNames = new String [cnt]; for( int i = 0; i < cnt; i++ ) movieNames[i] = names[i]; setUp( applet, movieNames ); } catch( MalformedURLException e ) { } catch( IOException e ) { } } } // class PlaylistPlayer