code: private byte[] encode(final RevisionCodecData codecData, final Diff diff)
  		throws UnsupportedEncodingException, EncodingException
  	{
  
  		this.data = new BitWriter(codecData.totalSizeInBits());
  		encodeCodecData(codecData);
  
  		DiffPart part;
  
  		Iterator<DiffPart> partIt = diff.iterator();
  		while (partIt.hasNext()) {
  			part = partIt.next();
  
  			switch (part.getAction()) {
  			case FULL_REVISION_UNCOMPRESSED:
  				encodeFullRevisionUncompressed(part);
  				break;
  			case INSERT:
  				encodeInsert(part);
  				break;
  			case DELETE:
  				encodeDelete(part);
  				break;
  			case REPLACE:
  				encodeReplace(part);
  				break;
  			case CUT:
  				encodeCut(part);
  				break;
  			case PASTE:
  				encodePaste(part);
  				break;
  			/*
  			 * case FULL_REVISION_COMPRESSED:
  			 * encodeFullRevisionCompressed(part); break;
  			 */
  			default:
  				throw new RuntimeException();
  			}
  		}
  
  		return data.toByteArray();
  	}
docs: Creates the binary encoding of the diff while using the codec
  information.
  
  @param codecData
  codec
  @param diff
  diff
  @return binary data
  
  @throws UnsupportedEncodingException
  if the character encoding is unsupported
  @throws EncodingException
  if the encoding failed