001 /** 002 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. 003 * 004 * This library is free software; you can redistribute it and/or modify it under 005 * the terms of the GNU Lesser General Public License as published by the Free 006 * Software Foundation; either version 2.1 of the License, or (at your option) 007 * any later version. 008 * 009 * This library is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 011 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 012 * details. 013 */ 014 015 package com.liferay.portal.kernel.util; 016 017 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission; 018 019 import java.io.Reader; 020 021 /** 022 * <p> 023 * This class can compare two different versions of HTML code. It detects 024 * changes to an entire HTML page such as removal or addition of characters or 025 * images. 026 * </p> 027 * 028 * @author Julio Camarero 029 */ 030 public class DiffHtmlUtil { 031 032 public static String diff(Reader source, Reader target) throws Exception { 033 return getDiffHtml().diff(source, target); 034 } 035 036 public static DiffHtml getDiffHtml() { 037 PortalRuntimePermission.checkGetBeanProperty(DiffHtmlUtil.class); 038 039 return _diffHtml; 040 } 041 042 public void setDiffHtml(DiffHtml diffHtml) { 043 PortalRuntimePermission.checkSetBeanProperty(getClass()); 044 045 _diffHtml = diffHtml; 046 } 047 048 private static DiffHtml _diffHtml; 049 050 }