FileDocCategorySizeDatePackage
XmlBlock.javaAPI DocAndroid 1.5 API21021Wed May 06 22:41:54 BST 2009android.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 int
mNative
private 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, int 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();
            }
        }
    
protected voidfinalize()

    

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

private static final native intnativeCreateParseState(int obj)

private static final native voidnativeDestroy(int obj)

private static final native voidnativeDestroyParseState(int state)

private static final native intnativeGetAttributeCount(int state)

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

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

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

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

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

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

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

private static final native intnativeGetClassAttribute(int state)

private static final native intnativeGetIdAttribute(int state)

private static final native intnativeGetLineNumber(int state)

private static final native intnativeGetName(int state)

private static final native intnativeGetNamespace(int state)

private static final native intnativeGetStringBlock(int obj)

private static final native intnativeGetStyleAttribute(int state)

private static final native intnativeGetText(int state)

private static final native intnativeNext(int state)

public XmlResourceParsernewParser()

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