mirror of
https://github.com/revanced/Apktool.git
synced 2025-02-02 23:27:41 +01:00
Added ExtXmlSerializer interface.
This commit is contained in:
parent
b11d41aefb
commit
26cdc8299a
@ -23,8 +23,7 @@ import brut.androlib.res.data.value.ResXmlSerializable;
|
||||
import brut.androlib.res.decoder.*;
|
||||
import brut.androlib.res.decoder.ARSCDecoder.ARSCData;
|
||||
import brut.androlib.res.decoder.ARSCDecoder.FlagsOffset;
|
||||
import brut.androlib.res.util.ExtFile;
|
||||
import brut.androlib.res.util.ExtMXSerializer;
|
||||
import brut.androlib.res.util.*;
|
||||
import brut.common.BrutException;
|
||||
import brut.directory.*;
|
||||
import brut.util.*;
|
||||
@ -241,8 +240,9 @@ final public class AndrolibResources {
|
||||
|
||||
public ExtMXSerializer getResXmlSerializer() {
|
||||
ExtMXSerializer serial = new ExtMXSerializer();
|
||||
serial.setProperty(serial.EXT_PROPERTY_SERIALIZER_INDENTATION, " ");
|
||||
serial.setProperty(serial.EXT_PROPERTY_SERIALIZER_LINE_SEPARATOR,
|
||||
serial.setProperty(ExtXmlSerializer.PROPERTY_SERIALIZER_INDENTATION
|
||||
, " ");
|
||||
serial.setProperty(ExtXmlSerializer.PROPERTY_SERIALIZER_LINE_SEPARATOR,
|
||||
System.getProperty("line.separator"));
|
||||
serial.setProperty(ExtMXSerializer.PROPERTY_DEFAULT_ENCODING, "UTF-8");
|
||||
return serial;
|
||||
|
@ -23,13 +23,13 @@ import org.xmlpull.mxp1_serializer.MXSerializer;
|
||||
/**
|
||||
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
||||
*/
|
||||
public class ExtMXSerializer extends MXSerializer {
|
||||
public class ExtMXSerializer extends MXSerializer implements ExtXmlSerializer {
|
||||
@Override
|
||||
public void startDocument(String encoding, Boolean standalone) throws
|
||||
IOException, IllegalArgumentException, IllegalStateException {
|
||||
super.startDocument(encoding != null ? encoding : mDefaultEncoding,
|
||||
standalone);
|
||||
super.out.write(lineSeparator);
|
||||
this.newLine();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -55,12 +55,10 @@ public class ExtMXSerializer extends MXSerializer {
|
||||
}
|
||||
}
|
||||
|
||||
public final String EXT_PROPERTY_SERIALIZER_INDENTATION =
|
||||
PROPERTY_SERIALIZER_INDENTATION;
|
||||
public final String EXT_PROPERTY_SERIALIZER_LINE_SEPARATOR =
|
||||
PROPERTY_SERIALIZER_LINE_SEPARATOR;
|
||||
|
||||
public final static String PROPERTY_DEFAULT_ENCODING = "DEFAULT_ENCODING";
|
||||
public ExtXmlSerializer newLine() throws IOException {
|
||||
super.out.write(lineSeparator);
|
||||
return this;
|
||||
}
|
||||
|
||||
private String mDefaultEncoding;
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Copyright 2011 Ryszard Wiśniewski <brut.alll@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package brut.androlib.res.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.xmlpull.v1.XmlSerializer;
|
||||
|
||||
/**
|
||||
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
||||
*/
|
||||
public interface ExtXmlSerializer extends XmlSerializer {
|
||||
|
||||
public ExtXmlSerializer newLine() throws IOException;
|
||||
|
||||
public static final String PROPERTY_SERIALIZER_INDENTATION =
|
||||
"http://xmlpull.org/v1/doc/properties.html#serializer-indentation";
|
||||
public static final String PROPERTY_SERIALIZER_LINE_SEPARATOR =
|
||||
"http://xmlpull.org/v1/doc/properties.html#serializer-line-separator";
|
||||
public static final String PROPERTY_DEFAULT_ENCODING = "DEFAULT_ENCODING";
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user