import java.io.*;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.text.*;
import java.util.Date;

import SevenZip.Compression.LZMA.Decoder;

public class FileList {
	private static FileList instance = null;
	private byte[] data;
	private int offset;

	private FileList() {
		try {
			ByteArrayOutputStream out = new ByteArrayOutputStream();
			RandomAccessFile in = new RandomAccessFile("files.lzma", "r");
			MappedByteBuffer buf = in.getChannel().map(FileChannel.MapMode.READ_ONLY, 0, in.length());
			in.close();

			Decoder decoder = new Decoder();
			decoder.SetDecoderProperties(Unpack.readProps(buf));

			//from LzmaAlone.java
			int len = 0;
			for (int i = 0; i < 8; i++)
			{
				int v = buf.get() & 0xFF;
				len |= ((long)v) << (8 * i);
			}
			decoder.Code(buf, out, len);
			data = out.toByteArray();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static FileList getInstance() {
		return instance == null ? new FileList() : instance;
	}

	public FileLocation nextFile(){
		int start = offset;
		while (data[offset] != '\n') {
			if (offset+2 == data.length)
				return null;
			offset++;
		}
		String line[] = new String(data, start, offset-start).split(";");
		offset++;
		DateFormat df = new SimpleDateFormat("yyyy.MM.dd kk:mm");
		try {
			Date mtime = df.parse(line[1]);
			return new FileLocation(line[0], Integer.parseInt(line[2]), Integer.parseInt(line[3]), Integer.parseInt(line[4]), Integer.parseInt(line[6]), Integer.parseInt(line[7]), mtime);
		} catch (ParseException e) {
			return null;
		}
	}

	public static class FileLocation {
		public String fileName;
		public int firstSlice, lastSlice;
		public int startOffset, originalSize, compressedSize;
		public Date mtime;
		private FileLocation(String fileName, int firstSlice, int lastSlice, int startOffset, int originalSize, int compressedSize, Date mtime) {
			this.fileName = fileName;
			this.firstSlice = firstSlice;
			this.lastSlice = lastSlice;
			this.startOffset = startOffset;
			this.originalSize = originalSize;
			this.compressedSize = compressedSize;
			this.mtime = mtime;
		}
	}
}

@@ -377,68 +377,420 @@
 %0A%09%09%09
-RandomAccessFile in = new RandomAccessFile(%22files.lzma%22, %22r%22
+//TODO: less ugliness here%0A%09%09%09File tmp = File.createTempFile(%22files%22, %22.lzma%22);%0A%09%09%09%7B%0A%09%09%09%09InputStream tmpin = this.getClass().getClassLoader().getResourceAsStream(%22files.lzma%22);%0A%09%09%09%09FileOutputStream tmpout = new FileOutputStream(tmp);%0A%09%09%09%09byte%5B%5D buf = new byte%5B1024%5D;%0A%09%09%09%09int i = 0;%0A%09%09%09%09while ((i = tmpin.read(buf)) != -1) %7B%0A%09%09%09%09%09tmpout.write(buf, 0, i);%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%09FileInputStream in = new FileInputStream(tmp
 );%0A%09
@@ -875,29 +875,57 @@
  in.
-length());%0A%09%09%09in.clos
+getChannel().size());%0A%09%09%09in.close();%0A%09%09%09tmp.delet
 e();

fix jar execution (but it is very ugly now)