fis.read(hdr); long size = readLongReverse(fis); fis.read(hdr);  try{ Chunk chunk = new Chunk(fis); while(chunk.isGood()) { chunks.add(chunk); chunk = new Chunk(fis); } } catch(IOException ioe){}   Chunk c = findChunk("MPHD"); if(c != null) { ret = readMPHDChunk(c.getInputStream()); }else{ throw new IOException("No MPHD chunk found!"); }  c = findChunk("BODY"); if(c != null) {
try{ Chunk chunk = new Chunk(fis); while(chunk.isGood()) { chunks.add(chunk); chunk = new Chunk(fis); } } catch(IOException ioe){}   Chunk c = findChunk("MPHD"); if(c != null) { ret = readMPHDChunk(c.getInputStream()); }else{ throw new IOException("No MPHD chunk found!"); }  c = findChunk("BODY"); if(c != null) {
    public Map readMap(String filename) throws Exception {	Map ret = null;	chunks = new LinkedList();	blocks = new Vector();	byte [] hdr = new byte[4];	FileInputStream fis = new FileInputStream(filename);		fis.read(hdr);	long size = readLongReverse(fis);	fis.read(hdr);		try{	    Chunk chunk = new Chunk(fis);	    while(chunk.isGood()) {		chunks.add(chunk);		chunk = new Chunk(fis);	    }	} catch(IOException ioe){}	//now build a Tiled map...	Chunk c = findChunk("MPHD");		if(c != null) {	    ret = readMPHDChunk(c.getInputStream());	}else{	    throw new IOException("No MPHD chunk found!");	}	c = findChunk("BODY");	if(c != null) {            readBODYChunk(ret, c.getInputStream());        }else{            throw new IOException("No BODY chunk found!");        }	return ret;    }