public HashMap getTags(RandomAccessFile s) throws IOException {
		int xoff  = 4;  // skip file magic
		int retry = 64;
		boolean need_infos = true;
		boolean need_tags = true;
		HashMap infos = new HashMap();
		HashMap tags = new HashMap();

		for(; retry > 0; retry--) {
			PageInfo pi = parse_stream_page(s, xoff);
			if(pi.type == FLAC_TYPE_STREAMINFO) {
				infos = parse_streaminfo_block(s, xoff+pi.header_len, pi.payload_len);
				need_infos = false;
			}
			if(pi.type == FLAC_TYPE_COMMENT) {
				tags = parse_vorbis_comment(s, this, xoff+pi.header_len, pi.payload_len);
				need_tags = false;
			}

			if(pi.last_page == true || (need_tags == false && need_infos == false))
				break; // eof reached

			// else: calculate next offset
			xoff += pi.header_len + pi.payload_len;
		}

		// Copy duration to final hashmap if found in infoblock
		if(infos.containsKey("duration")) {
			tags.put("duration", infos.get("duration"));
		}

		return tags;
	}