public byte[] readArchive(ArchiveRequest query) {
		int currentChunk = 0;
		int nextSectorId = query.getStartSector();
		ByteBuffer outputBuffer = ByteBuffer.allocate(query.getFileSize());
		while (nextSectorId != 0) {
			Sector sector;
			try {
				sector = readSector(query.getFileId(), nextSectorId);
			} catch (IOException ex) {
				ex.printStackTrace();
				return null;
			}
			if (currentChunk++ != sector.getFileChunk())
				throw new RuntimeException();
			if (!query.checkSector(sector))
				throw new RuntimeException();
			outputBuffer.put(sector.getData(), sector.getDataOffset(),
					Math.min(sector.getData().length - sector.getDataOffset(), outputBuffer.remaining()));
			nextSectorId = sector.getNextSector();
		}
		if (outputBuffer.remaining() != 0)
			throw new RuntimeException();
		return outputBuffer.array();
	}