mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-05 17:45:52 +01:00
ExtMXSerializer: added possibility to set default encoding.
This commit is contained in:
parent
ac1bc7ca54
commit
64fe894062
@ -145,6 +145,7 @@ final public class AndrolibResources {
|
||||
serial.setProperty(serial.PROPERTY_SERIALIZER_INDENTATION, " ");
|
||||
serial.setProperty(serial.PROPERTY_SERIALIZER_LINE_SEPARATOR,
|
||||
System.getProperty("line.separator"));
|
||||
serial.setProperty(ExtMXSerializer.PROPERTY_DEFAULT_ENCODING, "UTF-8");
|
||||
return serial;
|
||||
}
|
||||
|
||||
|
@ -28,12 +28,34 @@ public class ExtMXSerializer extends MXSerializer {
|
||||
@Override
|
||||
public void startDocument(String encoding, Boolean standalone) throws
|
||||
IOException, IllegalArgumentException, IllegalStateException {
|
||||
super.startDocument(encoding != null ? encoding : "UTF-8", standalone);
|
||||
super.startDocument(encoding != null ? encoding : mDefaultEncoding,
|
||||
standalone);
|
||||
super.out.write(lineSeparator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOutput(OutputStream os, String encoding) throws IOException {
|
||||
super.setOutput(os, encoding != null ? encoding : "UTF-8");
|
||||
super.setOutput(os, encoding != null ? encoding : mDefaultEncoding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getProperty(String name) throws IllegalArgumentException {
|
||||
if (PROPERTY_DEFAULT_ENCODING.equals(name)) {
|
||||
return mDefaultEncoding;
|
||||
}
|
||||
return super.getProperty(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperty(String name, Object value)
|
||||
throws IllegalArgumentException, IllegalStateException {
|
||||
if (PROPERTY_DEFAULT_ENCODING.equals(name)) {
|
||||
mDefaultEncoding = (String) value;
|
||||
}
|
||||
super.setProperty(name, value);
|
||||
}
|
||||
|
||||
public final static String PROPERTY_DEFAULT_ENCODING = "DEFAULT_ENCODING";
|
||||
|
||||
private String mDefaultEncoding;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user