public Integer recompressChunkData(byte[] buffer, boolean overwriteInput, long[] hashes, PassthroughConnection ptc) {

		if(buffer.length < 163840) {
			return null;
		}

		int inputOffset = inputDataBufferSize + outputDataBufferSize;
		int inputSize = 81920;
		int outputOffset = overwriteInput?0:inputDataBufferSize;
		int outputSize = outputDataBufferSize;
		
		if(hashes != null) {
			int pos = inputSize + inputOffset;
			for(int a=0;a<40;a++) {
				long hash = hashes[a];

				for(int b=0;b<8;b++) {
					buffer[pos++] = (byte)hash;
					hash = hash >> 8;
				}
			}
			inputSize += 8*40;
		}
		
		ptc.deflate.reset();
		ptc.deflate.setInput(buffer, inputOffset, inputSize);
		ptc.deflate.finish();
		int compressedLength = ptc.deflate.deflate(buffer, outputOffset, outputSize);

		if(!ptc.deflate.finished()) {
			return null;
		} else {
			return compressedLength;
		}

	}