code: private static byte[] extract(byte[] result, int length) {
      if (length == result.length) {
        return result;
      } else {
        byte[] trunc = new byte[length];
        System.arraycopy(result, 0, trunc, 0, length);
        return trunc;
      }
    }
docs: TODO(lowasser): document the extent of leniency, probably after adding ignore(CharMatcher)