FileDocCategorySizeDatePackage
WbxmlSerializer.javaAPI DocAndroid 1.5 API4214Wed May 06 22:42:46 BST 2009com.android.im.imps

WbxmlSerializer

public final class WbxmlSerializer extends Object

Fields Summary
private OutputStream
mOut
private int
mNativeHandle
private static int
PUBLIC_ID_IMPS_11
private static int
PUBLIC_ID_IMPS_12
private static int
PUBLIC_ID_IMPS_13
Constructors Summary
public WbxmlSerializer(com.android.im.imps.ImpsConstants.ImpsVersion impsVersion)


       
        if (impsVersion == ImpsVersion.IMPS_VERSION_11) {
            mNativeHandle = nativeCreate(PUBLIC_ID_IMPS_11);
        } else if (impsVersion == ImpsVersion.IMPS_VERSION_12) {
            mNativeHandle = nativeCreate(PUBLIC_ID_IMPS_12);
        } else if (impsVersion == ImpsVersion.IMPS_VERSION_13) {
            mNativeHandle = nativeCreate(PUBLIC_ID_IMPS_13);
        } else {
            throw new IllegalArgumentException("Unsupported IMPS version");
        }
        if (mNativeHandle == 0) {
            throw new OutOfMemoryError();
        }
    
Methods Summary
public voidcharacters(java.lang.String chars)

        try {
            nativeCharacters(mNativeHandle, chars);
        } catch (IllegalArgumentException e) {
            throw new SerializerException(e);
        }
    
public voidendElement()

        try {
            nativeEndElement(mNativeHandle);
        } catch (IllegalArgumentException e) {
            throw new SerializerException(e);
        }
    
protected voidfinalize()

        if (mNativeHandle != 0) {
            nativeRelease(mNativeHandle);
        }
    
native voidnativeCharacters(int nativeHandle, java.lang.String characters)

native intnativeCreate(int publicId)

native voidnativeEndElement(int nativeHandle)

native voidnativeRelease(int nativeHandle)

native voidnativeReset(int nativeHandle)

native voidnativeStartElement(int nativeHandle, java.lang.String name, java.lang.String[] atts)

voidonWbxmlData(byte[] data, int len)
Called by native encoder to send result data.

param
data
param
len
throws
IOException

        if (mOut != null) {
            mOut.write(data, 0, len);
        }
    
public voidreset()

        nativeReset(mNativeHandle);
        mOut = null;
    
public voidsetOutput(java.io.OutputStream out)

        mOut = out;
    
public voidstartElement(java.lang.String name, java.lang.String[] atts)

        try {
            nativeStartElement(mNativeHandle, name, atts);
        } catch (IllegalArgumentException e) {
            throw new SerializerException(e);
        }