@Override
	public String encodeDiff(final RevisionCodecData codecData, final Diff diff)
		throws UnsupportedEncodingException, EncodingException
	{

		String sEncoding;
		byte[] bData = encode(codecData, diff);
		if (MODE_ZIP_COMPRESSION) {

			Deflater compresser = new Deflater();
			compresser.setInput(bData);
			compresser.finish();

			byte[] output = new byte[1000];
			ByteArrayOutputStream stream = new ByteArrayOutputStream();

			int cLength;
			do {
				cLength = compresser.deflate(output);
				stream.write(output, 0, cLength);
			}
			while (cLength == 1000);

			output = stream.toByteArray();

			if (bData.length + 1 < output.length) {
				sEncoding = Base64.encodeBase64String(bData);
			}
			else {
				sEncoding = "_" + Base64.encodeBase64String(output);
			}
		}
		else {
			sEncoding = Base64.encodeBase64String(bData);
		}

		return sEncoding;
	}
@ Override public String encodeDiff ( final RevisionCodecData codecData , final Diff diff ) throws UnsupportedEncodingException , EncodingException { String sEncoding ; byte [ ] bData = encode ( codecData , diff ) ; if ( MODE_ZIP_COMPRESSION ) { Deflater compresser = new Deflater ( ) ; compresser . setInput ( bData ) ; compresser . finish ( ) ; byte [ ] output = new byte [ 1000 ] ; ByteArrayOutputStream stream = new ByteArrayOutputStream ( ) ; int cLength ; do { cLength = compresser . deflate ( output ) ; stream . write ( output , 0 , cLength ) ; } while ( cLength == 1000 ) ; output = stream . toByteArray ( ) ; if ( bData . length + 1 < output . length ) { sEncoding = Base64 . encodeBase64String ( bData ) ; } else { sEncoding = "_" + Base64 . encodeBase64String ( output ) ; } } else { sEncoding = Base64 . encodeBase64String ( bData ) ; } return sEncoding ; }
/*
(non-Javadoc)

@see
de.tud.ukp.kulessa.delta.data.codec.RevisionEncoderInterface#encodeDiff
(de.tud.ukp.kulessa.delta.data.codec.RevisionCodecData,
de.tud.ukp.kulessa.delta.data.tasks.content.Diff)