public synchronized InputStream getInputStream(final short fid) {
		try {
			InputStream in = null;
			byte[] file = filesBytes.get(fid);
			if (file != null) {
				/* Already completely read this file. */
				in = new ByteArrayInputStream(file);
				in.mark(file.length + 1);
			} else {
				/* Maybe partially read? Use the buffered stream. */
				in = bufferedStreams.get(fid); // FIXME: some thread may
				// already be reading this one?
				if (in != null && in.markSupported()) {
					in.reset();
				}
			}
			if (in == null) {
				/* Not read yet. Start reading it. */
				startCopyingRawInputStream(fid);
				in = bufferedStreams.get(fid);
			}
			return in;
		} catch (IOException ioe) {
			ioe.printStackTrace();
			throw new IllegalStateException("ERROR: " + ioe.toString());
		}
	}