FileDocCategorySizeDatePackage
XmlBlock.javaAPI DocAndroid 5.1 API21071Thu Mar 12 22:22:10 GMT 2015android.content.res

XmlBlock

public final class XmlBlock extends Object
Wrapper around a compiled XML file. {@hide}

Fields Summary
private static final boolean
DEBUG
private final AssetManager
mAssets
private final long
mNative
final StringBlock
mStrings
private boolean
mOpen
private int
mOpenCount
Constructors Summary
public XmlBlock(byte[] data)


       
        mAssets = null;
        mNative = nativeCreate(data, 0, data.length);
        mStrings = new StringBlock(nativeGetStringBlock(mNative), false);
    
public XmlBlock(byte[] data, int offset, int size)

        mAssets = null;
        mNative = nativeCreate(data, offset, size);
        mStrings = new StringBlock(nativeGetStringBlock(mNative), false);
    
XmlBlock(AssetManager assets, long xmlBlock)
Create from an existing xml block native object. This is -extremely- dangerous -- only use it if you absolutely know what you are doing! The given native object must exist for the entire lifetime of this newly creating XmlBlock.

        mAssets = assets;
        mNative = xmlBlock;
        mStrings = new StringBlock(nativeGetStringBlock(xmlBlock), false);
    
Methods Summary
public voidclose()

        synchronized (this) {
            if (mOpen) {
                mOpen = false;
                decOpenCountLocked();
            }
        }
    
private voiddecOpenCountLocked()

        mOpenCount--;
        if (mOpenCount == 0) {
            nativeDestroy(mNative);
            if (mAssets != null) {
                mAssets.xmlBlockGone(hashCode());
            }
        }
    
protected voidfinalize()

    

         
        close();
    
private static final native longnativeCreate(byte[] data, int offset, int size)

private static final native longnativeCreateParseState(long obj)

private static final native voidnativeDestroy(long obj)

private static final native voidnativeDestroyParseState(long state)

private static final native intnativeGetAttributeCount(long state)

private static final native intnativeGetAttributeData(long state, int idx)

private static final native intnativeGetAttributeDataType(long state, int idx)

private static final native intnativeGetAttributeIndex(long state, java.lang.String namespace, java.lang.String name)

private static final native intnativeGetAttributeName(long state, int idx)

private static final native intnativeGetAttributeNamespace(long state, int idx)

private static final native intnativeGetAttributeResource(long state, int idx)

private static final native intnativeGetAttributeStringValue(long state, int idx)

private static final native intnativeGetClassAttribute(long state)

private static final native intnativeGetIdAttribute(long state)

private static final native intnativeGetLineNumber(long state)

static final native intnativeGetName(long state)

private static final native intnativeGetNamespace(long state)

private static final native longnativeGetStringBlock(long obj)

private static final native intnativeGetStyleAttribute(long state)

private static final native intnativeGetText(long state)

static final native intnativeNext(long state)

public XmlResourceParsernewParser()

        synchronized (this) {
            if (mNative != 0) {
                return new Parser(nativeCreateParseState(mNative), this);
            }
            return null;
        }