001
014
015 package com.liferay.portal.kernel.sanitizer;
016
017 import java.io.InputStream;
018 import java.io.OutputStream;
019
020 import java.util.Map;
021
022
026 public class SanitizerUtil {
027
028 public static Sanitizer getSanitizer() {
029 return _sanitizer;
030 }
031
032 public static byte[] sanitize(
033 long companyId, long groupId, long userId, String className,
034 long classPK, String contentType, byte[] byteArray)
035 throws SanitizerException {
036
037 return sanitize(
038 companyId, groupId, userId, className, classPK, contentType,
039 Sanitizer.MODE_ALL, byteArray, null);
040 }
041
042 public static void sanitize(
043 long companyId, long groupId, long userId, String className,
044 long classPK, String contentType, InputStream inputStream,
045 OutputStream outputStream)
046 throws SanitizerException {
047
048 sanitize(
049 companyId, groupId, userId, className, classPK, contentType,
050 Sanitizer.MODE_ALL, inputStream, outputStream, null);
051 }
052
053 public static String sanitize(
054 long companyId, long groupId, long userId, String className,
055 long classPK, String contentType, String s)
056 throws SanitizerException {
057
058 return sanitize(
059 companyId, groupId, userId, className, classPK, contentType,
060 Sanitizer.MODE_ALL, s, null);
061 }
062
063 public static byte[] sanitize(
064 long companyId, long groupId, long userId, String className,
065 long classPK, String contentType, String mode, byte[] byteArray,
066 Map<String, Object> options)
067 throws SanitizerException {
068
069 return sanitize(
070 companyId, groupId, userId, className, classPK, contentType,
071 new String[] {mode}, byteArray, options);
072 }
073
074 public static void sanitize(
075 long companyId, long groupId, long userId, String className,
076 long classPK, String contentType, String mode,
077 InputStream inputStream, OutputStream outputStream,
078 Map<String, Object> options)
079 throws SanitizerException {
080
081 sanitize(
082 companyId, groupId, userId, className, classPK, contentType,
083 new String[] {mode}, inputStream, outputStream, options);
084 }
085
086 public static String sanitize(
087 long companyId, long groupId, long userId, String className,
088 long classPK, String contentType, String mode, String s,
089 Map<String, Object> options)
090 throws SanitizerException {
091
092 return sanitize(
093 companyId, groupId, userId, className, classPK, contentType,
094 new String[] {mode}, s, options);
095 }
096
097 public static byte[] sanitize(
098 long companyId, long groupId, long userId, String className,
099 long classPK, String contentType, String[] modes, byte[] byteArray,
100 Map<String, Object> options)
101 throws SanitizerException {
102
103 return getSanitizer().sanitize(
104 companyId, groupId, userId, className, classPK, contentType, modes,
105 byteArray, options);
106 }
107
108 public static void sanitize(
109 long companyId, long groupId, long userId, String className,
110 long classPK, String contentType, String[] modes,
111 InputStream inputStream, OutputStream outputStream,
112 Map<String, Object> options)
113 throws SanitizerException {
114
115 getSanitizer().sanitize(
116 companyId, groupId, userId, className, classPK, contentType, modes,
117 inputStream, outputStream, options);
118 }
119
120 public static String sanitize(
121 long companyId, long groupId, long userId, String className,
122 long classPK, String contentType, String[] modes, String s,
123 Map<String, Object> options)
124 throws SanitizerException {
125
126 return getSanitizer().sanitize(
127 companyId, groupId, userId, className, classPK, contentType, modes,
128 s, options);
129 }
130
131 public void setSanitizer(Sanitizer sanitizer) {
132 _sanitizer = sanitizer;
133 }
134
135 private static Sanitizer _sanitizer;
136
137 }