private void readFile(InputStream in, File outFolder) throws IOException {

		log.trace("Reading packaged file");
		
		int dataSize = readInt(in);
		String fileName = readString(in);
		
		log.trace("Filename: " + fileName + " ("+dataSize+"b)");
		
		File outFile = new File( outFolder, fileName );
		outFile.getParentFile().mkdirs();
		OutputStream out = new FileOutputStream(outFile);
		
		while( dataSize > 0 ) {
			int count = in.read(buf, 0, dataSize > buf.length ? buf.length : dataSize);
			if( count < 0 )
				throw new EOFException("Unexpected end of stream");
			dataSize -= count;
			out.write(buf, 0, count);
		}
		
		out.close();
		
	}