Methods Summary |
---|
private void | append(char c)
int pos = mPos;
if (pos >= (BUFFER_LEN-1)) {
flush();
pos = mPos;
}
mText[pos] = c;
mPos = pos+1;
|
private void | append(java.lang.String str, int i, int length)
if (length > BUFFER_LEN) {
final int end = i + length;
while (i < end) {
int next = i + BUFFER_LEN;
append(str, i, next<end ? BUFFER_LEN : (end-i));
i = next;
}
return;
}
int pos = mPos;
if ((pos+length) > BUFFER_LEN) {
flush();
pos = mPos;
}
str.getChars(i, i+length, mText, pos);
mPos = pos + length;
|
private void | append(char[] buf, int i, int length)
if (length > BUFFER_LEN) {
final int end = i + length;
while (i < end) {
int next = i + BUFFER_LEN;
append(buf, i, next<end ? BUFFER_LEN : (end-i));
i = next;
}
return;
}
int pos = mPos;
if ((pos+length) > BUFFER_LEN) {
flush();
pos = mPos;
}
System.arraycopy(buf, i, mText, pos, length);
mPos = pos + length;
|
private void | append(java.lang.String str)
append(str, 0, str.length());
|
private void | appendIndent(int indent)
indent *= 4;
if (indent > sSpace.length()) {
indent = sSpace.length();
}
append(sSpace, 0, indent);
|
public org.xmlpull.v1.XmlSerializer | attribute(java.lang.String namespace, java.lang.String name, java.lang.String value)
append(' ");
if (namespace != null) {
append(namespace);
append(':");
}
append(name);
append("=\"");
escapeAndAppendString(value);
append('"");
mLineStart = false;
return this;
|
public void | cdsect(java.lang.String text)
throw new UnsupportedOperationException();
|
public void | comment(java.lang.String text)
throw new UnsupportedOperationException();
|
public void | docdecl(java.lang.String text)
throw new UnsupportedOperationException();
|
public void | endDocument()
flush();
|
public org.xmlpull.v1.XmlSerializer | endTag(java.lang.String namespace, java.lang.String name)
mNesting--;
if (mInTag) {
append(" />\n");
} else {
if (mIndent && mLineStart) {
appendIndent(mNesting);
}
append("</");
if (namespace != null) {
append(namespace);
append(':");
}
append(name);
append(">\n");
}
mLineStart = true;
mInTag = false;
return this;
|
public void | entityRef(java.lang.String text)
throw new UnsupportedOperationException();
|
private void | escapeAndAppendString(java.lang.String string)
final int N = string.length();
final char NE = (char)ESCAPE_TABLE.length;
final String[] escapes = ESCAPE_TABLE;
int lastPos = 0;
int pos;
for (pos=0; pos<N; pos++) {
char c = string.charAt(pos);
if (c >= NE) continue;
String escape = escapes[c];
if (escape == null) continue;
if (lastPos < pos) append(string, lastPos, pos-lastPos);
lastPos = pos + 1;
append(escape);
}
if (lastPos < pos) append(string, lastPos, pos-lastPos);
|
private void | escapeAndAppendString(char[] buf, int start, int len)
final char NE = (char)ESCAPE_TABLE.length;
final String[] escapes = ESCAPE_TABLE;
int end = start+len;
int lastPos = start;
int pos;
for (pos=start; pos<end; pos++) {
char c = buf[pos];
if (c >= NE) continue;
String escape = escapes[c];
if (escape == null) continue;
if (lastPos < pos) append(buf, lastPos, pos-lastPos);
lastPos = pos + 1;
append(escape);
}
if (lastPos < pos) append(buf, lastPos, pos-lastPos);
|
public void | flush()
//Log.i("PackageManager", "flush mPos=" + mPos);
if (mPos > 0) {
if (mOutputStream != null) {
CharBuffer charBuffer = CharBuffer.wrap(mText, 0, mPos);
CoderResult result = mCharset.encode(charBuffer, mBytes, true);
while (true) {
if (result.isError()) {
throw new IOException(result.toString());
} else if (result.isOverflow()) {
flushBytes();
result = mCharset.encode(charBuffer, mBytes, true);
continue;
}
break;
}
flushBytes();
mOutputStream.flush();
} else {
mWriter.write(mText, 0, mPos);
mWriter.flush();
}
mPos = 0;
}
|
private void | flushBytes()
int position;
if ((position = mBytes.position()) > 0) {
mBytes.flip();
mOutputStream.write(mBytes.array(), 0, position);
mBytes.clear();
}
|
public int | getDepth()
throw new UnsupportedOperationException();
|
public boolean | getFeature(java.lang.String name)
throw new UnsupportedOperationException();
|
public java.lang.String | getName()
throw new UnsupportedOperationException();
|
public java.lang.String | getNamespace()
throw new UnsupportedOperationException();
|
public java.lang.String | getPrefix(java.lang.String namespace, boolean generatePrefix)
throw new UnsupportedOperationException();
|
public java.lang.Object | getProperty(java.lang.String name)
throw new UnsupportedOperationException();
|
public void | ignorableWhitespace(java.lang.String text)
throw new UnsupportedOperationException();
|
public void | processingInstruction(java.lang.String text)
throw new UnsupportedOperationException();
|
public void | setFeature(java.lang.String name, boolean state)
if (name.equals("http://xmlpull.org/v1/doc/features.html#indent-output")) {
mIndent = true;
return;
}
throw new UnsupportedOperationException();
|
public void | setOutput(java.io.OutputStream os, java.lang.String encoding)
if (os == null)
throw new IllegalArgumentException();
if (true) {
try {
mCharset = Charset.forName(encoding).newEncoder();
} catch (IllegalCharsetNameException e) {
throw (UnsupportedEncodingException) (new UnsupportedEncodingException(
encoding).initCause(e));
} catch (UnsupportedCharsetException e) {
throw (UnsupportedEncodingException) (new UnsupportedEncodingException(
encoding).initCause(e));
}
mOutputStream = os;
} else {
setOutput(
encoding == null
? new OutputStreamWriter(os)
: new OutputStreamWriter(os, encoding));
}
|
public void | setOutput(java.io.Writer writer)
mWriter = writer;
|
public void | setPrefix(java.lang.String prefix, java.lang.String namespace)
throw new UnsupportedOperationException();
|
public void | setProperty(java.lang.String name, java.lang.Object value)
throw new UnsupportedOperationException();
|
public void | startDocument(java.lang.String encoding, java.lang.Boolean standalone)
append("<?xml version='1.0' encoding='utf-8' standalone='"
+ (standalone ? "yes" : "no") + "' ?>\n");
mLineStart = true;
|
public org.xmlpull.v1.XmlSerializer | startTag(java.lang.String namespace, java.lang.String name)
if (mInTag) {
append(">\n");
}
if (mIndent) {
appendIndent(mNesting);
}
mNesting++;
append('<");
if (namespace != null) {
append(namespace);
append(':");
}
append(name);
mInTag = true;
mLineStart = false;
return this;
|
public org.xmlpull.v1.XmlSerializer | text(char[] buf, int start, int len)
if (mInTag) {
append(">");
mInTag = false;
}
escapeAndAppendString(buf, start, len);
if (mIndent) {
mLineStart = buf[start+len-1] == '\n";
}
return this;
|
public org.xmlpull.v1.XmlSerializer | text(java.lang.String text)
if (mInTag) {
append(">");
mInTag = false;
}
escapeAndAppendString(text);
if (mIndent) {
mLineStart = text.length() > 0 && (text.charAt(text.length()-1) == '\n");
}
return this;
|