SerializeOptions.java
5.92 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.internal.xmp.options;
import com.adobe.internal.xmp.XMPException;
import com.adobe.internal.xmp.options.Options;
public final class SerializeOptions
extends Options {
public static final int OMIT_PACKET_WRAPPER = 16;
public static final int READONLY_PACKET = 32;
public static final int USE_COMPACT_FORMAT = 64;
public static final int USE_CANONICAL_FORMAT = 128;
public static final int USE_PLAIN_XMP = 1024;
public static final int INCLUDE_THUMBNAIL_PAD = 256;
public static final int EXACT_PACKET_LENGTH = 512;
public static final int OMIT_XMPMETA_ELEMENT = 4096;
public static final int SORT = 8192;
private static final int LITTLEENDIAN_BIT = 1;
private static final int UTF16_BIT = 2;
public static final int ENCODE_UTF8 = 0;
public static final int ENCODE_UTF16BE = 2;
public static final int ENCODE_UTF16LE = 3;
private static final int ENCODING_MASK = 3;
private int padding = 2048;
private String newline = "\n";
private String indent = " ";
private int baseIndent = 0;
private boolean omitVersionAttribute = false;
public SerializeOptions() {
}
public SerializeOptions(int options) throws XMPException {
super(options);
}
public boolean getOmitPacketWrapper() {
return this.getOption(16);
}
public SerializeOptions setOmitPacketWrapper(boolean value) {
this.setOption(16, value);
return this;
}
public boolean getOmitXmpMetaElement() {
return this.getOption(4096);
}
public SerializeOptions setOmitXmpMetaElement(boolean value) {
this.setOption(4096, value);
return this;
}
public boolean getReadOnlyPacket() {
return this.getOption(32);
}
public SerializeOptions setReadOnlyPacket(boolean value) {
this.setOption(32, value);
return this;
}
public boolean getUseCompactFormat() {
return this.getOption(64);
}
public SerializeOptions setUseCompactFormat(boolean value) {
this.setOption(64, value);
return this;
}
public boolean getUseCanonicalFormat() {
return this.getOption(128);
}
public SerializeOptions setUseCanonicalFormat(boolean value) {
this.setOption(128, value);
return this;
}
public boolean getUsePlainXMP() {
return this.getOption(1024);
}
public SerializeOptions setUsePlainXMP(boolean value) {
this.setOption(1024, value);
return this;
}
public boolean getIncludeThumbnailPad() {
return this.getOption(256);
}
public SerializeOptions setIncludeThumbnailPad(boolean value) {
this.setOption(256, value);
return this;
}
public boolean getExactPacketLength() {
return this.getOption(512);
}
public SerializeOptions setExactPacketLength(boolean value) {
this.setOption(512, value);
return this;
}
public boolean getSort() {
return this.getOption(8192);
}
public SerializeOptions setSort(boolean value) {
this.setOption(8192, value);
return this;
}
public boolean getEncodeUTF16BE() {
return (this.getOptions() & 3) == 2;
}
public SerializeOptions setEncodeUTF16BE(boolean value) {
this.setOption(3, false);
this.setOption(2, value);
return this;
}
public boolean getEncodeUTF16LE() {
return (this.getOptions() & 3) == 3;
}
public SerializeOptions setEncodeUTF16LE(boolean value) {
this.setOption(3, false);
this.setOption(3, value);
return this;
}
public int getBaseIndent() {
return this.baseIndent;
}
public SerializeOptions setBaseIndent(int baseIndent) {
this.baseIndent = baseIndent;
return this;
}
public String getIndent() {
return this.indent;
}
public SerializeOptions setIndent(String indent) {
this.indent = indent;
return this;
}
public String getNewline() {
return this.newline;
}
public SerializeOptions setNewline(String newline) {
this.newline = newline;
return this;
}
public int getPadding() {
return this.padding;
}
public SerializeOptions setPadding(int padding) {
this.padding = padding;
return this;
}
public boolean getOmitVersionAttribute() {
return this.omitVersionAttribute;
}
public String getEncoding() {
if (this.getEncodeUTF16BE()) {
return "UTF-16BE";
}
if (this.getEncodeUTF16LE()) {
return "UTF-16LE";
}
return "UTF-8";
}
public Object clone() throws CloneNotSupportedException {
try {
SerializeOptions clone = new SerializeOptions(this.getOptions());
clone.setBaseIndent(this.baseIndent);
clone.setIndent(this.indent);
clone.setNewline(this.newline);
clone.setPadding(this.padding);
return clone;
}
catch (XMPException e) {
return null;
}
}
protected String defineOptionName(int option) {
switch (option) {
case 16: {
return "OMIT_PACKET_WRAPPER";
}
case 32: {
return "READONLY_PACKET";
}
case 64: {
return "USE_COMPACT_FORMAT";
}
case 1024: {
return "USE_PLAIN_XMP";
}
case 256: {
return "INCLUDE_THUMBNAIL_PAD";
}
case 512: {
return "EXACT_PACKET_LENGTH";
}
case 4096: {
return "OMIT_XMPMETA_ELEMENT";
}
case 8192: {
return "NORMALIZED";
}
}
return null;
}
protected int getValidOptions() {
return 14192;
}
}