2
* Created on 19-dic-2005
4
* TODO To change the template for this generated file go to
5
* Window - Preferences - Java - Code Style - Code Templates
7
package org.herac.tuxguitar.io;
9
import org.herac.tuxguitar.io.gp.GP3InputStream;
10
import org.herac.tuxguitar.io.gp.GP4InputStream;
11
import org.herac.tuxguitar.io.gp.GP5InputStream;
12
import org.herac.tuxguitar.io.pt.PTB4InputStream;
13
import org.herac.tuxguitar.io.tg.TGInputStream;
14
import org.herac.tuxguitar.song.models.Song;
19
* TODO To change the template for this generated type comment go to
20
* Window - Preferences - Java - Code Style - Code Templates
22
public class SongLoader {
23
private String fileName;
25
public SongLoader(String fileName){
26
this.fileName = fileName;
29
public Song load() throws FileFormatFormatException{
33
TGInputStream tg = new TGInputStream(this.fileName);
34
if(tg.isSupportedVersion()){
38
GP3InputStream gp3 = new GP3InputStream(this.fileName);
39
if(gp3.isSupportedVersion()){
40
return gp3.readSong();
43
GP4InputStream gp4 = new GP4InputStream(this.fileName);
44
if(gp4.isSupportedVersion()){
45
return gp4.readSong();
48
GP5InputStream gp5 = new GP5InputStream(this.fileName);
49
if(gp5.isSupportedVersion()){
50
return gp5.readSong();
53
//Power Tab 1.7 Format
54
PTB4InputStream ptb = new PTB4InputStream(this.fileName);
55
if(ptb.isSupportedVersion()){
56
return ptb.readSong();
59
throw new FileFormatFormatException(e);
61
throw new FileFormatFormatException(e);
64
throw new UnsupportedFormatException();