HTMLContent.java
2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* Decompiled with CFR 0_118.
*/
package com.day.cq.wcm.designimporter.parser;
import com.day.cq.wcm.designimporter.parser.HTMLContentType;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class HTMLContent {
private StringBuffer markupBuffer = new StringBuffer();
private StringBuffer cssBuffer = new StringBuffer();
private StringBuffer scriptBuffer = new StringBuffer();
private List<String> referencedScripts = new ArrayList<String>();
private List<String> referencedStyleSheets = new ArrayList<String>();
private Map<String, String> metaData = new HashMap<String, String>();
public Object get(HTMLContentType htmlContentType) {
switch (htmlContentType) {
case META: {
return this.metaData;
}
case MARKUP: {
return this.markupBuffer.toString();
}
case SCRIPT_INCLUDE: {
return this.referencedScripts;
}
case SCRIPT_INLINE: {
return this.scriptBuffer.toString();
}
case STYLES_INLINE: {
return this.cssBuffer.toString();
}
case STYLESHEET_INCLUDE: {
return this.referencedStyleSheets;
}
}
return null;
}
public void add(HTMLContentType htmlContentType, Object content) {
switch (htmlContentType) {
case META: {
this.metaData.putAll((Map)content);
break;
}
case MARKUP: {
this.markupBuffer.append(content);
break;
}
case SCRIPT_INCLUDE: {
this.referencedScripts.addAll((Collection)content);
break;
}
case SCRIPT_INLINE: {
this.scriptBuffer.append(content);
break;
}
case STYLES_INLINE: {
this.cssBuffer.append(content);
break;
}
case STYLESHEET_INCLUDE: {
this.referencedStyleSheets.addAll((Collection)content);
}
}
}
}